|Join Nairaland / Login / Trending / Recent / New|
Stats: 1243304 members, 1651679 topics. Date: Tuesday, 23 September 2014 at 09:22 AM
|Re: 10 Reasons Why .NET Is Better Than Java by Kobojunkie: 6:27am On Nov 07, 2009|
I agree with that being a weakness for Java. Ever notices how there are so many Java based frameworks out there? Most of them are designed to help SIMPLY that particular Java coding problem. When it comes to coding, Verbosity IS a problem, and I hope the Java team are working on that.
Would you rather sit writing thousands of lines of code when you can get the same result in just 500 lines of code? It is simple!!
If we were talking assembler here, then we would be on a different page entirely. A higher level programming language is not meant to mimic assembly language. Instead it ought to provide some level of abstraction, be easier and simpler to use, use natural language as much as possible, be flexible, yet very powerful and portable.
At the end of the day, if I have to write more code, it is not better. The less code, the better then language/framework. Not saying Java is bad, but these particular points are some of those against Java.
|Re: 10 Reasons Why .NET Is Better Than Java by logica(m): 7:24pm On Nov 07, 2009|
Kobojunkie:Wow! I've heard it all. Verbosity leads to a proliferation of frameworks?
|Re: 10 Reasons Why .NET Is Better Than Java by Ghenghis(m): 7:40pm On Nov 07, 2009|
I'm surprised you think Java is more verbose than C#.
You spoke about natural language, natural language is verbose and ambiguous : and English is the most verbose of them all simply because it has the largest number of words.
To cut some of the story short, I think it C#'s verbosity(though its not much) that gave it the edge over Java.
I've used both languages professional, i prefer Java because of its simplicity and consistency (Personal bias , ).
Delegates, attributes,events etc. are all syntactic sugar, since not even all .NET languages support these features.
Yeah C# is great, it made the Java people in the JCP wake up. The dust clouds have now settled and Java is as strong as ever(thanks to C# of course).
On frameworks covering up for verbosity, that not a fair statement without mentioning some of these frameworks, we can learn from each other ; so your list please ,
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 7:48pm On Nov 07, 2009|
No, kobo is saying; verbosity leads to directly to bugs, sweat and blood. In order to avoid this, several frameworks have been built to address specific issues (only to be forked, then re-forked, then re-re-forked, thus blowing the brains of its developer victim's ).
|Re: 10 Reasons Why .NET Is Better Than Java by logica(m): 8:15pm On Nov 07, 2009|
Are you sure you know what you are talking about? Verbosity actually leads to less bugs. A terse language is more likely to incur bugs than a verbose one. Reason being the terseness leads to complexity of expressions and therefore confuse developers.
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 9:01pm On Nov 07, 2009|
Try coding a modestly complex app in the most verbose of them all, assembler. . . And experience a truly useless way to fry the mind .
|Re: 10 Reasons Why .NET Is Better Than Java by Kobojunkie: 9:03pm On Nov 07, 2009|
There is a difference between a TERSE LANGUAGE and writing TERSE CODE. Same way there is a difference between a language being VERBOSE and a developer writing VERBOSE CODE.
Verbose languages leave wide room for introduction of bugs during development; you notice code is less MANAGEABLE, increase in testing time, as well as resource consumption, and in some cases less readable code.
.NET Languages are not necessarily all Terse. Many of the languages give you the flexibility to choose to write verbose code, but with the option to go the other way if you really wanted to save time, effort (reduce development and testing time), and increase throughput.
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 11:51pm On Nov 07, 2009|
Hehe. You really do have choices.
eg, you can can create or overwrite a text file, using a built in .NET function in a single line of code, like so;
File.WriteAllText(string path, string contents);
Or suffer in a "javalike" way like so;
public static void WriteAllText(string path, string text, Encoding encoding)
return;// better to raise an error here
using (StreamWriter streamWriter = new StreamWriter(path, false, encoding))
private static bool IsNullOrEmpty(string text)
if (text != null)
return (text.Length == 0);
|Re: 10 Reasons Why .NET Is Better Than Java by Ghenghis(m): 12:53am On Nov 08, 2009|
Verbose means more flesh, not less ,
@Beaf I don't get the purpose of the code , are you comparing the Java language to c# or .NET CLR to the JRE ?
Ironically your both code snippets are C#
Also if we assumed you wrote the 2nd snippet in java, what is the null check for ? Why is the encoding part not important ?
All these arguments about verbosity is even funny, what do you want weakly typed language proponents like (python to say).
Yes C# is more powerful that Java, but at what price ? complexity ? inconsistency ? (so i've said it , )
Hmm, na wa o!
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 5:03am On Nov 08, 2009|
I was agreeing with kobojunkie that you can actually write verbose C# if you want (the difference is that java is always verbose).
So yes its all C#, both examples are equivalent. One example is a single line and thats the point I'm stressing.
Now, for my code class
The encoding is surely important, the streamwriter is initialised with the it. The null check? Its the last man standing, in case UI validation checks either failed or were bypassed; its done so errors can be thrown for more deserving reasons.
C# is not just more powerful than java, it much easier to learn, better architected and more suited to rad techniques. Its win, win, win.
|Re: 10 Reasons Why .NET Is Better Than Java by Ghenghis(m): 7:42am On Nov 08, 2009|
A C# programmer has a lot to contend with :
what are delegates, attributes, indexer, etc.
In C#(and other .NET languages) you have to worry about the behavior of inherited behavior: is the method virtual ?
u have to know if an object is created on the stack or heap ,
u have operator overloading ,
You think all these don't translate to confusion ?
check out what others think.
|Re: 10 Reasons Why .NET Is Better Than Java by Kobojunkie: 7:59am On Nov 08, 2009|
I know you sort of feel your loyalty to Java demands you do all you can but COME ON!!!
I laughed real hard when reading your post there. It just seems really desperate, and to be honest, of no need considering people will always choose the language of their choice.
By the way, are you sure you should really trust the TIOBE list. Not sure I would trust any list that has TSQL with 24 ranking.
|Re: 10 Reasons Why .NET Is Better Than Java by logica(m): 11:04am On Nov 08, 2009|
So of what use is having terseness as an option in a language when the rule-of-thumb suggests a moderately verbose approach?
Beaf, you seem to think the size of instructions required to write code is related to verbosity. When we talk about verbosity/terseness, we are referring to High Level Languages. Nobody will ever refer to Assembly Language as "verbose". Assembly code is lengthier simply because of its limited grammar and primitive constructs.
A good example of "terse" versus "verbose" was 5 lines of code in Python which somebody claimed would require 100 lines in Java. Unfortunately, I couldn't make sense of the code. It was that complex. And in my opinion, it would have been coded in Java quicker (or in any other more verbose form) because I know to have come up with that code, the programmer would have spent thousands of hours honing and adjusting the code, and not to add at least 20 years of experience to have a clear understanding of the terse code he was writing.
Kobojunkie, with regards to this: "you notice code is less MANAGEABLE, increase in testing time, as well as resource consumption, and in some cases less readable code". Once a piece of code is all what you mentioned in the quote, I doubt it is verbose. Verbose code for one is definitely much more readable than terse code.
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 4:09pm On Nov 08, 2009|
I was only showing that you could go through voluntary pain in c#, if you choose to (you can't choose in java, pain is part of the game).
The reality is that the .NET framework offers much more than any java framework and C# having tons of additional constructs and improvements over java.
Simply put, because C# is an evolution of java, it takes away those areas where is unecassary pain (eg anonymous classes vs delegates). C# has tons more data types and several areas where java simply has no equivalent (lambdas and expression trees, multi-cast delegates, namespaces etc). C# offers richer polymorphism, unrivalled event handling. . .
How do you begin to imagine a comparison between what I can knock up in a few minutes with C# and WPF and java / swing ?
|Re: 10 Reasons Why .NET Is Better Than Java by Ghenghis(m): 4:21pm On Nov 08, 2009|
@beaf the comparison with delegates is inner classes(not anonymous classes), C# has inner classes too(not for the same reason as java).
how often do you use multicast delegates and for what ?
richer polymorphism ? what's that ? how is overrides polymorphic ?
are namespaces different from packages ?
also what you can knock up in a few minutes using c# is very subjective, it also depends of your level of experience with programming(or with C#).
besides can't i knock up similar apps with with J# (were both languages can leverage the Visual studio IDE)
|Re: 10 Reasons Why .NET Is Better Than Java by logica(m): 6:30pm On Nov 08, 2009|
I think a demonstration of terse versus verbose using a code snippet is required here, for those who don't realize the idea behind verbosity in Java:
Snippet 1 is the tacit version of Snippet 2. But guess what? Snippet 2 results in a better performance by the compiler in resolution of dependencies, which is why IDEs generally generate code like Snippet 2 and not Snippet 1. With Snippet 1, the compiler basically pre-loads all the classes in the package, while Snippet 2 tells it which classes to load, hence the efficiency.
The other advantage of Snippet 2 is, it presents the class dependencies to anybody reading the code at a single glance. Snippet 1 merely tells you that certain classes will be loaded from the package "java.util", but no more. You do not know the actual classes until you start looking through the code. So Snippet 2 is more readable.
The fact is, Java could have been designed such that you do not need import statements, making the compiler/translator do the work of figuring out which classes to load. That will be a higher degree of terseness. But this results in inefficient compilation/linkage.
You need to understand the reason behind verbosity/terseness, and not just think they are fancy terms to be bandied around.
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 7:59pm On Nov 08, 2009|
Java has anonymous inner classes (which are very weak, verbose and toturous compared to the simple elegance of c# delegates).
You use a multicast delegate whenever you need to execute several methods with a single delegate.
C#'s polymorphism promotes better design (and security as to what 3rd party code can access). The virtual keyword is just one item in the jigsaw, I'd rather hardcode that than have no (obvious) choice over whether a method is virtual or not. Anyway, "final" in java does the opposite of "virtual" in c#, so thats simply a case of chicken and egg. These are some c# modifiers that are absent from java.
protected (no java equiv)
internal protected (no java equiv)
You can nest namespaces, but not packages. Namespaces are not limited to a single source file, you can have as many as you want. namespaces do not dictate app file structure, rather they are logical groupings only.
J# is not java, it is part of the .NET framework (although quite limited compared to c#). There's no java environment rivaling Visual Studio or framework rivaling WPF or XAML. The screw just gets tighter every year.
Take the step, these are free;
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 8:04pm On Nov 08, 2009|
There are many situations where you need less code in c# than java. It is so, because the c# compiler is smarter and c# is better architected.
As long as your app compiles, neither option above impacts on performance in .NET. The compiler is that smart.
|Re: 10 Reasons Why .NET Is Better Than Java by logica(m): 8:42pm On Nov 08, 2009|
And you know this because you have tested it? You have a tendency of making blanket statements with nothing to back you up. To me, you are just a C# fan-boy and nothing more.
The impact on performance we are talking about is on the actual compilation. This is trivial in most cases but non-trivial as the number of classes and packages increase, and as each package contains a huge number of classes (say in the region of millions - which really is stretching it as I have never seen such a package, and having millions of classes in a package may indicate a poor design strategy).
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 8:51pm On Nov 08, 2009|
Charlie, name some "blanket" statements you want "backing" for na.
Give me some time to find the using statement info for you, it is quite obscure. But I am 100% sure of what I am saying. One thing, how come you said the way you declare your imports affect jvm performance and now it is compile time?
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 8:53pm On Nov 08, 2009|
That didn't take any time, See http://msdn.microsoft.com/en-us/library/aa664764(VS.71).aspx
|Re: 10 Reasons Why .NET Is Better Than Java by logica(m): 8:58pm On Nov 08, 2009|
Sorry, that was not supposed to be "JVM", but the compiler (javac for instance), as both sources will compile into the same byte-code.
Beaf:I don't quite get this. You mean packages cannot be nested? You mean a package is limited to a single source file? You mean packages are not logical groupings? This namespace thing you are touting is not much of a big deal. It's really a similar concept to the package concept and it's even used in some Java frameworks (such as Struts2 configuration files). How is it such a big deal?
|Re: 10 Reasons Why .NET Is Better Than Java by logica(m): 9:03pm On Nov 08, 2009|
Beaf:I don't see anywhere in that document that the tacit "using" directive has no impact on compilation performance compared to the "verbose" directive. You can do your benchmark by creating a package with a million dummy classes and trying both. Get back to us with the results. Good luck.
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 9:08pm On Nov 08, 2009|
Using directives impact the name resolution process of namespace-or-type-names (Section 3.8 ) and simple-names (Section 7.5.2), but unlike declarations, using directives do not contribute new members to the underlying declaration spaces of the compilation units or namespaces within which they are used.http://msdn.microsoft.com/en-us/library/aa664764(VS.71).aspx
|Re: 10 Reasons Why .NET Is Better Than Java by logica(m): 9:15pm On Nov 08, 2009|
This guy. How does what you quoted imply that compilation using a tacit "uses" directive does not result in longer compilation times? You don't seem to know what performance measure is of concern during compilation. Nobody is saying using a tacit "uses" directive will result in a bloated application (such as was the issue with the "include" directive in C/C++ which literally, well, includes all required classes). In Java, that issue was resolved as imported classes do not bloat the application size, and are referenced on an "as-needed" basis.
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 9:45pm On Nov 08, 2009|
If it does'nt add to il how can it even begin to affect compiler performance? It says it there as clear as day.
|Re: 10 Reasons Why .NET Is Better Than Java by logica(m): 9:50pm On Nov 08, 2009|
Beaf:In Java, the compilation using the tacit import directive as opposed to the verbose version has a potential impact on compilation performance (which is mostly unnoticeable anyway, as packages usually contain just a few hundred classes at the most). Yet, the referenced classes ARE NOT ADDED to the dependent classes. I expect the same with C#.
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 9:57pm On Nov 08, 2009|
Nice article here from a Java fan
His CV is here http://www.clapper.org/bmc/resume/resume.html
|Re: 10 Reasons Why .NET Is Better Than Java by Beaf: 10:04pm On Nov 08, 2009|
I see where youre going with this, in c# you cannot do something like;
You can import several namespaces as I pointed out here http://www.nairaland.com/nigeria/topic-47678.96.html#msg4884209
But whether, you use them or not does not affect performance in any way.
|Re: 10 Reasons Why .NET Is Better Than Java by logica(m): 10:16pm On Nov 08, 2009|
Beaf:This is not a matter of what Java can do and C# cannot do. It is merely to point out that verbosity has its benefits, and there is usually a rationale behind it.
|Re: 10 Reasons Why .NET Is Better Than Java by Ghenghis(m): 12:39am On Nov 09, 2009|
@Beaf, @Logica is right, import statements or using only indicate the intention of using a specific library to the compiler. its a sort of compiler directive. Hence importing an entire package or namespace instead of specific classes means the compiler has slightly more work to resolve the classes at compile time (only).
Java has the protected keyword, and the effect of overrides and virtual in C# are messy.
the final keyword in java does not mean a method is no longer polymorphic ,
|Re: 10 Reasons Why .NET Is Better Than Java by candylips(m): 11:53am On Nov 09, 2009|
I think comparing the language features of Java to .NET will not suffice because it will be akin to cheating.
C sharp is a better Java in terms of language features and the designer of C sharp made sure of these.
The main reason why i am for Java on the server side is because i have more flexibility on how i choose to deploy my app, i don't want to be bothered about licenses, i need a vibrant open source community
and i just DON'T TRUST MICROSOFT because I have had my hands burnt before ( Visual basic 6 apps portability) and will not want to experience it again.
|Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health |
religion celebs tv-movies music-radio literature webmasters programming techmarket
Nairaland - Copyright © 2005 - 2014 Oluwaseun Osewa. All rights reserved. See Nairalist and How To Advertise. 137