I’m wondering what Sun is going to do. They’ve always touted Java as a simple language, but as we know with Jav a 5.0 they’ve been paying attention what Microsoft has been doing with C#.
Sun is at a crossroad in regard to Java. Do they play catchup with C# game again, or do something different? IMHO, Sun should put a feature freeze on Java after Mustang comes out and start with a clean slate.
Now before Java fans get all huffy and puffy, I don’t mean ditch Java. Sun should continue to promote Java, port it to platforms where needed, make it rock-solid (a benefit of feature freeze), and maybe develop some libraries as needed as addons.
But Sun as a company needs to look at the future. Is dumbed down C++ with continually tacked on features really the road to go? Sun needs to leapfrog Microsoft. Sun has Fortress, but that’s more of a Fortran replacement, then a general purpose language.
Sun needs to look at Python, Ruby, Lisp, Haskell, Boo and a bunch of other languages, analyze what the future programming needs are going to be, and most importantly come up with something that developers can get excited about.
Let’s face it. Java is the COBOL of the 21st century. It never made it on the client because of various problems, and it probably never will.
Hows the memory consumption of c# compared to java?
I’ve been doing most of my freelance work in java sinced I can jump from one OS to another without any problem, so if mono and .net framework can cooperate, c# would certainly be a contender.
I’ll just hope Sun can match up with c# with their upcoming release
I have to admit, I was skeptical of C# since it’s beginning. I didn’t pay much attention as I thought it would be a Java clone, nothing more. As I always loved C/C++ and never really liked Java, I decided to stick with the good old languages.
Then a couple weeks ago I stepped on my ego, and decided to try C#. I’m hooked since then. What a beautiful, clean language. It really feel good coding with it, and also think I’m much more productive using it than C++, even tho I’m still learning it.
I’ll keep using C/C++ for non-PC devices (PSP homebrew) but on Windows, I’m gonna use C# exclusivelly.
Long story short, Microsoft did a LOT of mistake and made products in their existence, but once in a while they just nail it in short time. C#/.NET is one of those success.
Now I just need to put more time on MONO, to see if I can easily jump from one to the other without much hassles.
I agree. I took a full year of C# last year in college and right now I’m taking a semester of Java. I like C# much better. It is much cleaner and much more consistant. After learning C#, Java seems like a jumbled mess. Why do I need to have Swing, AWT, JWT, and who knows what other windowing toolkit when I could have one that does everything I need?
Those languages are evolving fast. It’s nice to see that they can take good things from “dynamic” languages to make life easier, when you really want. A very good enhacements for productivity.
I wouldn’t complain about Java guys on Sun however it’s been a while that people I know (and that I read of) are satisfied with C# as opposed to Java, though Microsoft will need to tune up a little bit to go in direct competition with Java in Enterprise field.
If Microsoft will be successfull in making WPF technology available to many platforms via plug-ins for browsers, I have no doubts that more Java people will look into C#/VB/.NET.
I doubt it; what sucks about Java is this; the Java IDEs suck royally; look at what Microsoft provide and look at what IBM, SUN and BEA provide; its bloody atrocious; I wouldn’t wish those tools on my worst enemy.
As for what SUN also needs to do is simplify the language and make it easy enough for a Visual Basic coder to use but compex enough to allow a master programmer to have access to the powerful features he or she might need.
Suck in what way? Have you tried the latest netbeans (4.1) with the latest java release? I usually code swing applications in netbeans (freelance) aside from the load time, swing can match up with the speed of native programs (with the exception of some areas). Java IDE’s are one of the best.. please elaborate
I doubt it; what sucks about Java is this; the Java IDEs suck royally; look at what Microsoft provide and look at what IBM, SUN and BEA provide; its bloody atrocious; I wouldn’t wish those tools on my worst enemy.
Have you used NetBeans 5.0 or Java Studio Creator 2? (OK both still early access so try NetBeans 4.1).
NetBeans 5.0 has a very good form designer (in many ways it handles layouts better than VS.NET 2005).
Eclipse 3.1?
Your comments would have been very true 2 years ago, but a lot has changed – as long as you have enough RAM to run these tools. VS.NET 2005 isn’t exactly light on resources either.
As for what SUN also needs to do is simplify the language and make it easy enough for a Visual Basic coder to use but compex enough to allow a master programmer to have access to the powerful features he or she might need.
Java is already a very simple, clean language (quite the opposite of where C# looks to be heading).
Java already has plenty of features – unless you want non-features such as goto or operator overloading.
Eclipse is very good, but VE module is slow like a hell. And the modules the biggest problems with Eclipse – without modules you can’t do anything with Eclipse, but the useable modules are not always free, and not always follows the Eclipse development, and you can’t use Eclipse 3.0 or older modules to 3.1.
I don’t know, the VS seems more comfortable for me. And the pure IDE is not enought in 2005. VS is not a perfect tool (an integrated UML modeller is missing, there is only class designer in vs2k5 beta) but IMHO the VS+.NET seems the best developer environtment what I ever seen.
Eclipse is very good, but VE module is slow like a hell. And the modules the biggest problems with Eclipse – without modules you can’t do anything with Eclipse, but the useable modules are not always free, and not always follows the Eclipse development, and you can’t use Eclipse 3.0 or older modules to 3.1.
That is why I use Netbeans. I agree about the Eclipse Visual Editor module being slow – in fact it is borderline useless.
The matisse form editor in the upcomping Netbeans 5.0 blows it away. Matisse will even give VS2005 something to think about.
All this C#3.0 stuff makes it look more and more like Javascript. I know that that Java Mustang is going to have the Rhino javascript engine built in, which seems like a better idea. Keep your loose typing seperate from your strongly typed objects. Bit more honest.
The querying ELinq or whatever stuff looks good, java has the potential to do this too. The Apache JXPath lets you do XPath queries on Collections, but this seems a bit better.
They’ll end up with C#4.0 being pure Javascript, or Lisp
They’ll end up with C#4.0 being pure Javascript, or Lisp
🙂
Who knows… 😉 However, I think they’re trying to provide enough flexibility for users who want it. “Dynamic” languages are getting popular expecially for simple and/or quick projects (there are many people who are constantly stating that they’re suitable for larger projects… that becomes a matter of taste but I feel more secure with compile-time checkings) so they’re trying to extend C# (and VB.NET) in order to provide some of those benefits.
However, you can just avoid using them and use C# 1.x or 2.x syntax to achieve type safety.
While I won’t use all of those features because I’m more comfortable with type-safety, I think it’s generally good to have choice so many people who right now think that C# or Java (or VB.NET 😉 are very difficult (expecially in Web development where people is accustomed to ASP or PHP) might consider switching because they find support for some of their way of developing.
I really think MS is making a big mistake by introducing layer after layer of new syntactical sugar with each release.
As the syntax becomes more and more obscure the code written to that syntax is going to become more obscure.
Quite frankly, many software engineers can’t write clean, readable code in a language with simple syntax. I can’t imagine the horrors that will be created with implicitly typed local variables, anonymous types, IQL, etc.
You couldn’t pay me enough to support someone else’s C# code.
The new “syntactic sugars” makes your code cleaner and easier to read. At leas between the C# 1.x and 2.x. The biggest problem of the java language: too simple and too orthdox. No operator overloading, no properties, etc.
>The new “syntactic sugars” makes your code cleaner and
>easier to read.
I would very much debate that.
>No operator overloading
Operator overloading is just an obscure way of defining and invoking a function. I have in the past taken over codebases from other developers who I would not trust within 500 miles of operator overloading. IMHO, the handful of keystrokes saved by operator overloading is more than offset by the confusion of trying to decipher a codebase with poorly defined operator overloads.
>no properties
C# properties are just an obscure way of defining and invoking a function. The biggest problem is that the syntax used is identical to the syntax for member access, making it impossible to differentiate between a propery access and a member access without close code scrutiny. This can (and has) led to problem such as infinite loops in untested code.
The implicit (but not dynamic) typing of C# 3 should go a long ways toward making C# code an unintelligible mess.
the handful of keystrokes saved by operator overloading is more than offset by the confusion of trying to decipher a codebase with poorly defined operator overloads.
If you create an object with operator overloading, the correct definition of this thing (and the correct working of all functions) is your (and your object’s) responsibility. Ordinarily the simple objects doesn’t need this functionality, but if you create common used objects, components this thing can make your code cleaner and easier to read.
he biggest problem is that the syntax used is identical to the syntax for member access, making it impossible to differentiate between a propery access and a member access without close code scrutiny. This can (and has) led to problem such as infinite loops in untested code.
I created with many code with Delphi and the properties proved far more useful then harmful. Let see this code:
Label.setFontSize(12) or Label.Font.Size=12; The properties are special members: you can handle the getting and setting process. And it can be VERY useful if you know what do you do.
>If you create an object with operator overloading, the
>correct definition of this thing (and the correct
>working of all functions) is your (and your object’s)
>responsibility. Ordinarily the simple objects doesn’t
>need this functionality, but if you create common used
>objects, components this thing can make your code
>cleaner and easier to read.
Once again, I will vigorously debate the “cleaner and easier to read” part. What happens when you take over another developer or team project and they have decided to implement an inconsistent (if not random) set of operator overloads? The code is unreadable. You think this is impossible… belive me it happens.
>Label.setFontSize(12) or Label.Font.Size=12; The
>properties are special members: you can handle the
>getting and setting process. And it can be VERY useful
>if you know what do you do.
What exactly is the advantage? You saved three characters of typing and in exchange misrepresented two function calls as a single assignment.
How can you be sure that Size a property and not a public member? Can you guarantee that all properties will begin with initial caps? What happens if a bonehead developer capitilizes his private members and lowercases his property names? What if he begins some properties with lowercase and others with upper? How about if one member of the team uses lowercase for property names, but another uses caps within the same file?
Surely a competent developer would not make these mistakes? Well, I cannot tell you how many times I’ve seen inconsistent coding standards within a single source file. Classes, member varialbes and methods all beginning w/ varying case. Some member variables beginging with “_”, some beginning with “m_”, some always prefixed with “this”.
Now you tell me on a cursorary code inspection… which is a simple assignment and which is a property accessor.
> Now you tell me on a cursorary code inspection… which
> is a simple assignment and which is a property accessor.
That’s like saying “polymorphism is bad because you can’t tell which method will be called”. It’s called “abstraction”. Just treat them all like properties.
> Now you tell me on a cursorary code inspection… which
> is a simple assignment and which is a property accessor.
That’s like saying “polymorphism is bad because you can’t tell which method will be called”. It’s called “abstraction”. Just treat them all like properties.
> Now you tell me on a cursorary code inspection… which
> is a simple assignment and which is a property accessor.
That’s like saying “polymorphism is bad because you can’t tell which method will be called”. It’s called “abstraction”. Just treat them all like properties.
Properties are very useful. They free you from defining getter and setter methods for every single attribute: you can start with public fields and gradually turn them into properties as required, without changing the interface. That removes the need for preventive dumb accessor methods.
How many times have you written methods like this:
>They free you from defining getter and setter methods
>for every single attribute: you can start with public
>fields and gradually turn them into properties as
>required, without changing the interface. That removes
>the need for preventive dumb accessor methods.
So do you start your public member variables with intial caps to make them look like properties? When you convert to properties, do you rename the members? Does this cause any versioning problems with serialized objects?
>How many times have you written methods like this:
Never. My IDE writes them for me.
>The property approach is way more interesting.
I prefer my approaches to be easily maintainable over “interesting”.
This is why consistent naming guidelines need to be laid down and followed by IT departments, and then enforced during the build cycle (or even check-in cycle) by a tool such as FXCop. I disagree with the original poster though in that I think all public fields should always be encapsulated by public properties wrapped around a private field of the same type; it’s cleaner design and allows for easier changes to the field w/o breaking the public interface. Also, intellisense is a _huge_ help for determining what’s a method and what’s a property…but if proper naming guidelines are followed (i.e. properties = nouns, methods = actions such as Get[foo] or Set[foo] which is very much how MS does it w/ the BCL), simply scanning the code should be enough.
Properties are very useful. They free you from defining getter and setter methods for every single attribute: you can start with public fields and gradually turn them into properties as required, without changing the interface. That removes the need for preventive dumb accessor methods.
Start with public fields? Perhaps you shouldn’t post a suggestion like that publicly, it is a very bad idea?
Besides the syntax for defining get and set for properties in C# isn’t really much different from defining a get and set in Java. Besides Java programmers have been using refactoring to generate getters and setters for years. I believe refactoring is one of the “innovative” new features in VS.NET 2005.
How many times have you written methods like this:
int getSomething() {
return something;
}
void setSomething(int value) {
something = value;
}
The property approach is way more interesting.
It is quite simple really. Highlight the fields you want to encapsulate then select refactor->encapsulate and the IDE will generate these for you.
An interesting side-effect of getters and setters is that it becomes very easy to narrow down code-completion options to get or set properties, by simply typing “get”. When using VS.NET I have to look through everything to find the properties I am looking for and I have to keep checking the icons to see which are properties and which are methods to figure out how I should access them. Rather trivial, but an intersting observation nonetheless.
Java follows the C philosophy which states “Keep the language as simple as possible. If you need features, add it to the library.”.
Java doesn’t need to go the way of C#, C# already exists. What it does need to do is to make sure that it’s library is rich enough to handle anything that the modern environment can throw at it.
The key problem with the “extend the language” approach is that it permanently leaves an artifact in the language that has to interact with other artifacts in unexpected ways. If the language feature becomes obsolete, you’re stuck with a dead language feature and forced to decide if you want to add other features that do basically the same thing. For example “call by name” was a neat feature of ALGOL, but lambda expressions and reference variables are far better and more maintainable ways of expressing this feature.
Also, the more complex the language, the harder it is to maintain code in the language. I learned C++ when it was called “C with Classes” and kept up with it until it got standardized. I consider myself a C++ guru. here are many things to love about the language, but I learned the hard way that most people are not C++ gurus and when you have to work with a lot of “self-taught through on the job experience” C++ programmers (as is common in the working world), C++’s advanced features can cause major problems when these semi-unexperienced programmers try to maintain the code. Things can get much worse if these semi-unexperienced programmers try to actually use these advanced features for the first time in a critical project. IMO, the only way to deal with these issues to restrict yourself to a subset of the language, one that is basically the same as Java.
You are correct about the whole “dead artifact” issue; that was one of the initial things most people hated about LINQ back when it was still X#/Xen…it was to be built into the language itself. The features of LINQ have been moved into the System.Query namespace and has it’s own library. The fact that you can use LINQ to query any object that implements IEnumerable<T> will prove more than useful though, I am pretty sure it’s here to stay. Good post though.
“C# properties are just an obscure way of defining and invoking a function. The biggest problem is that the syntax used is identical to the syntax for member access, making it impossible to differentiate between a propery access and a member access without close code scrutiny. This can (and has) led to problem such as infinite loops in untested code.”
Amen.
Platform independence is another nice issue I’m having with both languages. While Microsoft has promoted C#/.net to be platform independent, they only care about Windows PCs wich is ok, since that’s where they make money, however they shouldn’t praise the platform independence while actually not caring about it. Sun on the other hand is at least trying to make Java as platform independent as possible (they could have said Solaris+sparc and nothing else but then again, who would use Java if that was the case).
Still I’m not able to run Java 5.0 stuff on my Powerbook because I don’t use OS X. Ok, this is some odd software/hardware combination but I still belive C is the most platform independence you can get.
Ok, this is some odd software/hardware combination but I still belive C is the most platform independence you can get.
The platform independence is a very interesting question. C is very platform independent until you use only the <stdio.h>, <stdlib.h>, etc. But if you want to send a simple message dialog box to your screen you must use platform-specific functions – or any platform-independent class library (like wxWidgets, Qt, Fox, fltk, etc /but this stuffs are C++/). This things are mostly wrappers on top of your OS system libraries, but some functions handled by this libs (drawing special widgets, etc). The java and .NET is very similar, but this tools handled more functions and uses less system libraries (IMHO the .NET uses more system libs, the java uses less). But the .NET also realizable on other platforms: let see mono.
well in order for .net to gain platform independence you have to go through the task of installing mono and making sure that mono supports your arch/OS. And what if you were developing in .net in windows, how is that compatible with mono. Unlike with java, you just throw in the jre (depending on the arch/os also). and your ready to go, sinced coding in jre in windows is more or less the same in linux and other COMMON arch/os.
nice, after posting this OSnews told me that the forums are disabled so I can’t post now, so I tried it a few times later …. looks like they were not really disabled …
I’d like to suggest that the Eiffel approach may represent a compelling alternative.
Any variable that’s effectively public (Eiffel doesn’t really have public/private/protected as they’re commonly known) is read-only externally.
For instance, in the case of arrays, they have a “count” feature which indicates the length of the array. Is this a special function which returns the value of some encapsulated variable? No. It’s the variable itself, but since I can’t modify it from outside of the object, that’s ok.
Perhaps a way of integrating this into a language like C# might be something like:
I hate arguments against “syntactic sugar”. Foreach is syntactic sugar as are classes, properties and iterators. Hell, “for” is syntactic sugar for “while” but in all cases, the “syntactic” sugar prevents errors by making things more clear and less likely for a programmer to make a mistake.
Noone can seriously think that this:
obj.setValue(obj.GetValue() + obj.GetValue2());
is more clear than:
obj.Value = obj.Value + obj.Value2;
And then there’s iterators. Microsoft is (finally) moving C# into a more functional/declaractive model of programming which is an amazing move. It’ll be as revolutionary as industry wide the move to OOP because of Java. Iterators aren’t new by any benchmark but it’s quite impressive that someone like Microsoft would include them in their language.
How many lines of Java would it take to write this?
public IEnumerable<int> Filter<int>(IEnumerable<int> numbers, Predicate<int> accept)
{
foreach (int x in numbers)
{
if accept(x) yield return x;
}
}
public IEnumerable<int> AllIntegers()
{
for (int i = int.MinValue; i <= int.MaxValue;i++)
{
yield return i;
}
}
// Get even numbers
evenNumbers = Filter(AllIntegers(), x => x % 2 == 0);
// Get odd numbers
evenNumbers = Filter(AllIntegers(), x => x % 2 != 0);
The new LINQ stuff is like list comprehension in steriods. I don’t believe you’ll find anyone in the functional programming community who think that list comprehension is merely “syntactic sugar”.
With regards to properties and fields. I believe if might be a good idea to include a “property” attribute that will automatically hide a field and generate a property for it. That way, fields can be “upgraded” into properties without breaking the public interface.
something like:
[Property]
public int MyProperty;
I believe boo has an intrinsic attribute that can do something similar.
yeah, sure we should just go back to assembly so that everything’s clearer.
declarative programming and functional programming is the way of the future. Syntactic sugar reduces pages of error prone, commonly used patterns of manually written code into a couple of lines of declarative code will almost always a welcome addition imho.
In my experience the reduction is usually much smaller. A couple of pages to a couple of lines – two orders of magnitude improvement?
Yes. Sometimes more. Look at my iterator example. Alternatively, try doing any equivalent to logical programming in java and get back to me about how many lines of code it takes…
I agree that some syntactic sugar is needed at times for readability, but I just get concerned that too many features are being added too fast.
Why? Features like iterators (continuations) and indeed, almost any declarative construct dramatically improve clarity in the code as well as reduce the amount of errors and lines you have to write. What’s wrong with that?
VL = Vendor Lockin
Yawn.
I’m wondering what Sun is going to do. They’ve always touted Java as a simple language, but as we know with Jav a 5.0 they’ve been paying attention what Microsoft has been doing with C#.
Sun is at a crossroad in regard to Java. Do they play catchup with C# game again, or do something different? IMHO, Sun should put a feature freeze on Java after Mustang comes out and start with a clean slate.
Now before Java fans get all huffy and puffy, I don’t mean ditch Java. Sun should continue to promote Java, port it to platforms where needed, make it rock-solid (a benefit of feature freeze), and maybe develop some libraries as needed as addons.
But Sun as a company needs to look at the future. Is dumbed down C++ with continually tacked on features really the road to go? Sun needs to leapfrog Microsoft. Sun has Fortress, but that’s more of a Fortran replacement, then a general purpose language.
Sun needs to look at Python, Ruby, Lisp, Haskell, Boo and a bunch of other languages, analyze what the future programming needs are going to be, and most importantly come up with something that developers can get excited about.
Let’s face it. Java is the COBOL of the 21st century. It never made it on the client because of various problems, and it probably never will.
Java is in feature freeze from JDK 1.1 😉
Hows the memory consumption of c# compared to java?
I’ve been doing most of my freelance work in java sinced I can jump from one OS to another without any problem, so if mono and .net framework can cooperate, c# would certainly be a contender.
I’ll just hope Sun can match up with c# with their upcoming release
sun just needs to make sure its the right road and java will succeed no problem
I have to admit, I was skeptical of C# since it’s beginning. I didn’t pay much attention as I thought it would be a Java clone, nothing more. As I always loved C/C++ and never really liked Java, I decided to stick with the good old languages.
Then a couple weeks ago I stepped on my ego, and decided to try C#. I’m hooked since then. What a beautiful, clean language. It really feel good coding with it, and also think I’m much more productive using it than C++, even tho I’m still learning it.
I’ll keep using C/C++ for non-PC devices (PSP homebrew) but on Windows, I’m gonna use C# exclusivelly.
Long story short, Microsoft did a LOT of mistake and made products in their existence, but once in a while they just nail it in short time. C#/.NET is one of those success.
Now I just need to put more time on MONO, to see if I can easily jump from one to the other without much hassles.
I agree. I took a full year of C# last year in college and right now I’m taking a semester of Java. I like C# much better. It is much cleaner and much more consistant. After learning C#, Java seems like a jumbled mess. Why do I need to have Swing, AWT, JWT, and who knows what other windowing toolkit when I could have one that does everything I need?
Why do I need to have Swing, AWT, JWT, and who knows what other windowing toolkit when I could have one that does everything I need?
Use Swing it replaced AWT about 7 years ago.
JWT?? <- typo? I have never heard of JWT and it is certainly not included with the JDK.
Those languages are evolving fast. It’s nice to see that they can take good things from “dynamic” languages to make life easier, when you really want. A very good enhacements for productivity.
I wouldn’t complain about Java guys on Sun however it’s been a while that people I know (and that I read of) are satisfied with C# as opposed to Java, though Microsoft will need to tune up a little bit to go in direct competition with Java in Enterprise field.
If Microsoft will be successfull in making WPF technology available to many platforms via plug-ins for browsers, I have no doubts that more Java people will look into C#/VB/.NET.
C# 3.0 seems to be taking a lot of features from Boo. (which is a good thing)
Type inference:
C# 3.0: var i = 5;
Boo: i = 5
Lambda expressions:
C# 3.0: x => X + 1
Boo: { x as int | return x + 1 }
Object initializers:
C# 3.0: var a = new Point { X = 0, Y = 1 }
Boo: a = Point(X: 0, Y: 1)
Query expressions:
C# 3.0: from c in customers where c.City == “London” select c
Boo: c for c in customers if c.City == “London”
There are a few proposed others that will be put in Boo in a little while. (but probably before C# 2.0 comes out of beta)
If you want to at least check out these nice features today, while having a prettier syntax, take a look at Boo.
http://boo.codehaus.org/
irc://irc.codehaus.org/#boo
I doubt it; what sucks about Java is this; the Java IDEs suck royally; look at what Microsoft provide and look at what IBM, SUN and BEA provide; its bloody atrocious; I wouldn’t wish those tools on my worst enemy.
As for what SUN also needs to do is simplify the language and make it easy enough for a Visual Basic coder to use but compex enough to allow a master programmer to have access to the powerful features he or she might need.
Suck in what way? Have you tried the latest netbeans (4.1) with the latest java release? I usually code swing applications in netbeans (freelance) aside from the load time, swing can match up with the speed of native programs (with the exception of some areas). Java IDE’s are one of the best.. please elaborate
What is wrong with Eclipse ? I use it for C development and I have to admit that it works quite well.
I doubt it; what sucks about Java is this; the Java IDEs suck royally; look at what Microsoft provide and look at what IBM, SUN and BEA provide; its bloody atrocious; I wouldn’t wish those tools on my worst enemy.
Have you used NetBeans 5.0 or Java Studio Creator 2? (OK both still early access so try NetBeans 4.1).
NetBeans 5.0 has a very good form designer (in many ways it handles layouts better than VS.NET 2005).
Eclipse 3.1?
Your comments would have been very true 2 years ago, but a lot has changed – as long as you have enough RAM to run these tools. VS.NET 2005 isn’t exactly light on resources either.
As for what SUN also needs to do is simplify the language and make it easy enough for a Visual Basic coder to use but compex enough to allow a master programmer to have access to the powerful features he or she might need.
Java is already a very simple, clean language (quite the opposite of where C# looks to be heading).
Java already has plenty of features – unless you want non-features such as goto or operator overloading.
Eclipse is very good, but VE module is slow like a hell. And the modules the biggest problems with Eclipse – without modules you can’t do anything with Eclipse, but the useable modules are not always free, and not always follows the Eclipse development, and you can’t use Eclipse 3.0 or older modules to 3.1.
Java is already a very simple, clean language
Too simple…
>Eclipse is very good, but VE module is slow like a hell.
Like I said, for laying out windows forms, the VS designer is servicable.
For programming tasks, Eclipse is superior.
I don’t know, the VS seems more comfortable for me. And the pure IDE is not enought in 2005. VS is not a perfect tool (an integrated UML modeller is missing, there is only class designer in vs2k5 beta) but IMHO the VS+.NET seems the best developer environtment what I ever seen.
Eclipse is very good, but VE module is slow like a hell. And the modules the biggest problems with Eclipse – without modules you can’t do anything with Eclipse, but the useable modules are not always free, and not always follows the Eclipse development, and you can’t use Eclipse 3.0 or older modules to 3.1.
That is why I use Netbeans. I agree about the Eclipse Visual Editor module being slow – in fact it is borderline useless.
The matisse form editor in the upcomping Netbeans 5.0 blows it away. Matisse will even give VS2005 something to think about.
>I doubt it; what sucks about Java is this; the Java IDEs
>suck royally; look at what Microsoft provide and look at
>what IBM, SUN and BEA provide; its bloody atrocious; I
>wouldn’t wish those tools on my worst enemy.
I guess if all you are doing is laying out win forms then the Visual Studio Form Designer is servicable.
But as someone who has used both, I can honestly say that for any real work Eclipse is superior to VS in every way imaginable.
How can you live without proper refactoring tools?
All this C#3.0 stuff makes it look more and more like Javascript. I know that that Java Mustang is going to have the Rhino javascript engine built in, which seems like a better idea. Keep your loose typing seperate from your strongly typed objects. Bit more honest.
The querying ELinq or whatever stuff looks good, java has the potential to do this too. The Apache JXPath lets you do XPath queries on Collections, but this seems a bit better.
They’ll end up with C#4.0 being pure Javascript, or Lisp
They’ll end up with C#4.0 being pure Javascript, or Lisp
🙂
Who knows… 😉 However, I think they’re trying to provide enough flexibility for users who want it. “Dynamic” languages are getting popular expecially for simple and/or quick projects (there are many people who are constantly stating that they’re suitable for larger projects… that becomes a matter of taste but I feel more secure with compile-time checkings) so they’re trying to extend C# (and VB.NET) in order to provide some of those benefits.
However, you can just avoid using them and use C# 1.x or 2.x syntax to achieve type safety.
While I won’t use all of those features because I’m more comfortable with type-safety, I think it’s generally good to have choice so many people who right now think that C# or Java (or VB.NET 😉 are very difficult (expecially in Web development where people is accustomed to ASP or PHP) might consider switching because they find support for some of their way of developing.
I really think MS is making a big mistake by introducing layer after layer of new syntactical sugar with each release.
As the syntax becomes more and more obscure the code written to that syntax is going to become more obscure.
Quite frankly, many software engineers can’t write clean, readable code in a language with simple syntax. I can’t imagine the horrors that will be created with implicitly typed local variables, anonymous types, IQL, etc.
You couldn’t pay me enough to support someone else’s C# code.
The new “syntactic sugars” makes your code cleaner and easier to read. At leas between the C# 1.x and 2.x. The biggest problem of the java language: too simple and too orthdox. No operator overloading, no properties, etc.
>The new “syntactic sugars” makes your code cleaner and
>easier to read.
I would very much debate that.
>No operator overloading
Operator overloading is just an obscure way of defining and invoking a function. I have in the past taken over codebases from other developers who I would not trust within 500 miles of operator overloading. IMHO, the handful of keystrokes saved by operator overloading is more than offset by the confusion of trying to decipher a codebase with poorly defined operator overloads.
>no properties
C# properties are just an obscure way of defining and invoking a function. The biggest problem is that the syntax used is identical to the syntax for member access, making it impossible to differentiate between a propery access and a member access without close code scrutiny. This can (and has) led to problem such as infinite loops in untested code.
The implicit (but not dynamic) typing of C# 3 should go a long ways toward making C# code an unintelligible mess.
> The implicit (but not dynamic) typing of C# 3 should go a long ways toward making C# code an unintelligible mess.
I really suggest taking a look at Boo, because its inference of types is surely not “an unintelligible mess.”
the handful of keystrokes saved by operator overloading is more than offset by the confusion of trying to decipher a codebase with poorly defined operator overloads.
If you create an object with operator overloading, the correct definition of this thing (and the correct working of all functions) is your (and your object’s) responsibility. Ordinarily the simple objects doesn’t need this functionality, but if you create common used objects, components this thing can make your code cleaner and easier to read.
he biggest problem is that the syntax used is identical to the syntax for member access, making it impossible to differentiate between a propery access and a member access without close code scrutiny. This can (and has) led to problem such as infinite loops in untested code.
I created with many code with Delphi and the properties proved far more useful then harmful. Let see this code:
Label.setFontSize(12) or Label.Font.Size=12; The properties are special members: you can handle the getting and setting process. And it can be VERY useful if you know what do you do.
>If you create an object with operator overloading, the
>correct definition of this thing (and the correct
>working of all functions) is your (and your object’s)
>responsibility. Ordinarily the simple objects doesn’t
>need this functionality, but if you create common used
>objects, components this thing can make your code
>cleaner and easier to read.
Once again, I will vigorously debate the “cleaner and easier to read” part. What happens when you take over another developer or team project and they have decided to implement an inconsistent (if not random) set of operator overloads? The code is unreadable. You think this is impossible… belive me it happens.
>Label.setFontSize(12) or Label.Font.Size=12; The
>properties are special members: you can handle the
>getting and setting process. And it can be VERY useful
>if you know what do you do.
What exactly is the advantage? You saved three characters of typing and in exchange misrepresented two function calls as a single assignment.
How can you be sure that Size a property and not a public member? Can you guarantee that all properties will begin with initial caps? What happens if a bonehead developer capitilizes his private members and lowercases his property names? What if he begins some properties with lowercase and others with upper? How about if one member of the team uses lowercase for property names, but another uses caps within the same file?
Surely a competent developer would not make these mistakes? Well, I cannot tell you how many times I’ve seen inconsistent coding standards within a single source file. Classes, member varialbes and methods all beginning w/ varying case. Some member variables beginging with “_”, some beginning with “m_”, some always prefixed with “this”.
Now you tell me on a cursorary code inspection… which is a simple assignment and which is a property accessor.
> Now you tell me on a cursorary code inspection… which
> is a simple assignment and which is a property accessor.
That’s like saying “polymorphism is bad because you can’t tell which method will be called”. It’s called “abstraction”. Just treat them all like properties.
> Now you tell me on a cursorary code inspection… which
> is a simple assignment and which is a property accessor.
That’s like saying “polymorphism is bad because you can’t tell which method will be called”. It’s called “abstraction”. Just treat them all like properties.
> Now you tell me on a cursorary code inspection… which
> is a simple assignment and which is a property accessor.
That’s like saying “polymorphism is bad because you can’t tell which method will be called”. It’s called “abstraction”. Just treat them all like properties.
Properties are very useful. They free you from defining getter and setter methods for every single attribute: you can start with public fields and gradually turn them into properties as required, without changing the interface. That removes the need for preventive dumb accessor methods.
How many times have you written methods like this:
int getSomething() {
return something;
}
void setSomething(int value) {
something = value;
}
The property approach is way more interesting.
>They free you from defining getter and setter methods
>for every single attribute: you can start with public
>fields and gradually turn them into properties as
>required, without changing the interface. That removes
>the need for preventive dumb accessor methods.
So do you start your public member variables with intial caps to make them look like properties? When you convert to properties, do you rename the members? Does this cause any versioning problems with serialized objects?
>How many times have you written methods like this:
Never. My IDE writes them for me.
>The property approach is way more interesting.
I prefer my approaches to be easily maintainable over “interesting”.
This is why consistent naming guidelines need to be laid down and followed by IT departments, and then enforced during the build cycle (or even check-in cycle) by a tool such as FXCop. I disagree with the original poster though in that I think all public fields should always be encapsulated by public properties wrapped around a private field of the same type; it’s cleaner design and allows for easier changes to the field w/o breaking the public interface. Also, intellisense is a _huge_ help for determining what’s a method and what’s a property…but if proper naming guidelines are followed (i.e. properties = nouns, methods = actions such as Get[foo] or Set[foo] which is very much how MS does it w/ the BCL), simply scanning the code should be enough.
Properties are very useful. They free you from defining getter and setter methods for every single attribute: you can start with public fields and gradually turn them into properties as required, without changing the interface. That removes the need for preventive dumb accessor methods.
Start with public fields? Perhaps you shouldn’t post a suggestion like that publicly, it is a very bad idea?
Besides the syntax for defining get and set for properties in C# isn’t really much different from defining a get and set in Java. Besides Java programmers have been using refactoring to generate getters and setters for years. I believe refactoring is one of the “innovative” new features in VS.NET 2005.
How many times have you written methods like this:
int getSomething() {
return something;
}
void setSomething(int value) {
something = value;
}
The property approach is way more interesting.
It is quite simple really. Highlight the fields you want to encapsulate then select refactor->encapsulate and the IDE will generate these for you.
An interesting side-effect of getters and setters is that it becomes very easy to narrow down code-completion options to get or set properties, by simply typing “get”. When using VS.NET I have to look through everything to find the properties I am looking for and I have to keep checking the icons to see which are properties and which are methods to figure out how I should access them. Rather trivial, but an intersting observation nonetheless.
Java follows the C philosophy which states “Keep the language as simple as possible. If you need features, add it to the library.”.
Java doesn’t need to go the way of C#, C# already exists. What it does need to do is to make sure that it’s library is rich enough to handle anything that the modern environment can throw at it.
The key problem with the “extend the language” approach is that it permanently leaves an artifact in the language that has to interact with other artifacts in unexpected ways. If the language feature becomes obsolete, you’re stuck with a dead language feature and forced to decide if you want to add other features that do basically the same thing. For example “call by name” was a neat feature of ALGOL, but lambda expressions and reference variables are far better and more maintainable ways of expressing this feature.
Also, the more complex the language, the harder it is to maintain code in the language. I learned C++ when it was called “C with Classes” and kept up with it until it got standardized. I consider myself a C++ guru. here are many things to love about the language, but I learned the hard way that most people are not C++ gurus and when you have to work with a lot of “self-taught through on the job experience” C++ programmers (as is common in the working world), C++’s advanced features can cause major problems when these semi-unexperienced programmers try to maintain the code. Things can get much worse if these semi-unexperienced programmers try to actually use these advanced features for the first time in a critical project. IMO, the only way to deal with these issues to restrict yourself to a subset of the language, one that is basically the same as Java.
You are correct about the whole “dead artifact” issue; that was one of the initial things most people hated about LINQ back when it was still X#/Xen…it was to be built into the language itself. The features of LINQ have been moved into the System.Query namespace and has it’s own library. The fact that you can use LINQ to query any object that implements IEnumerable<T> will prove more than useful though, I am pretty sure it’s here to stay. Good post though.
“C# properties are just an obscure way of defining and invoking a function. The biggest problem is that the syntax used is identical to the syntax for member access, making it impossible to differentiate between a propery access and a member access without close code scrutiny. This can (and has) led to problem such as infinite loops in untested code.”
Amen.
Platform independence is another nice issue I’m having with both languages. While Microsoft has promoted C#/.net to be platform independent, they only care about Windows PCs wich is ok, since that’s where they make money, however they shouldn’t praise the platform independence while actually not caring about it. Sun on the other hand is at least trying to make Java as platform independent as possible (they could have said Solaris+sparc and nothing else but then again, who would use Java if that was the case).
Still I’m not able to run Java 5.0 stuff on my Powerbook because I don’t use OS X. Ok, this is some odd software/hardware combination but I still belive C is the most platform independence you can get.
Ok, this is some odd software/hardware combination but I still belive C is the most platform independence you can get.
The platform independence is a very interesting question. C is very platform independent until you use only the <stdio.h>, <stdlib.h>, etc. But if you want to send a simple message dialog box to your screen you must use platform-specific functions – or any platform-independent class library (like wxWidgets, Qt, Fox, fltk, etc /but this stuffs are C++/). This things are mostly wrappers on top of your OS system libraries, but some functions handled by this libs (drawing special widgets, etc). The java and .NET is very similar, but this tools handled more functions and uses less system libraries (IMHO the .NET uses more system libs, the java uses less). But the .NET also realizable on other platforms: let see mono.
well in order for .net to gain platform independence you have to go through the task of installing mono and making sure that mono supports your arch/OS. And what if you were developing in .net in windows, how is that compatible with mono. Unlike with java, you just throw in the jre (depending on the arch/os also). and your ready to go, sinced coding in jre in windows is more or less the same in linux and other COMMON arch/os.
nice, after posting this OSnews told me that the forums are disabled so I can’t post now, so I tried it a few times later …. looks like they were not really disabled …
I’d like to suggest that the Eiffel approach may represent a compelling alternative.
Any variable that’s effectively public (Eiffel doesn’t really have public/private/protected as they’re commonly known) is read-only externally.
For instance, in the case of arrays, they have a “count” feature which indicates the length of the array. Is this a special function which returns the value of some encapsulated variable? No. It’s the variable itself, but since I can’t modify it from outside of the object, that’s ok.
Perhaps a way of integrating this into a language like C# might be something like:
class MyClass
{
public readonly int Foo;
}
Which would allow:
MyClass bar = new MyClass();
Console.WriteLine(bar.Foo);
But not:
bar.Foo = 42;
I hate arguments against “syntactic sugar”. Foreach is syntactic sugar as are classes, properties and iterators. Hell, “for” is syntactic sugar for “while” but in all cases, the “syntactic” sugar prevents errors by making things more clear and less likely for a programmer to make a mistake.
Noone can seriously think that this:
obj.setValue(obj.GetValue() + obj.GetValue2());
is more clear than:
obj.Value = obj.Value + obj.Value2;
And then there’s iterators. Microsoft is (finally) moving C# into a more functional/declaractive model of programming which is an amazing move. It’ll be as revolutionary as industry wide the move to OOP because of Java. Iterators aren’t new by any benchmark but it’s quite impressive that someone like Microsoft would include them in their language.
How many lines of Java would it take to write this?
public IEnumerable<int> Filter<int>(IEnumerable<int> numbers, Predicate<int> accept)
{
foreach (int x in numbers)
{
if accept(x) yield return x;
}
}
public IEnumerable<int> AllIntegers()
{
for (int i = int.MinValue; i <= int.MaxValue;i++)
{
yield return i;
}
}
// Get even numbers
evenNumbers = Filter(AllIntegers(), x => x % 2 == 0);
// Get odd numbers
evenNumbers = Filter(AllIntegers(), x => x % 2 != 0);
The new LINQ stuff is like list comprehension in steriods. I don’t believe you’ll find anyone in the functional programming community who think that list comprehension is merely “syntactic sugar”.
With regards to properties and fields. I believe if might be a good idea to include a “property” attribute that will automatically hide a field and generate a property for it. That way, fields can be “upgraded” into properties without breaking the public interface.
something like:
[Property]
public int MyProperty;
I believe boo has an intrinsic attribute that can do something similar.
<sarcasm>
Syntactic suger is always the best way to go. Just look at perl. </sarcasm>
yeah, sure we should just go back to assembly so that everything’s clearer.
declarative programming and functional programming is the way of the future. Syntactic sugar reduces pages of error prone, commonly used patterns of manually written code into a couple of lines of declarative code will almost always a welcome addition imho.
Syntactic sugar reduces pages of error prone, commonly used patterns of manually written code into a couple of lines of declarative code
In my experience the reduction is usually much smaller. A couple of pages to a couple of lines – two orders of magnitude improvement?
I agree that some syntactic sugar is needed at times for readability, but I just get concerned that too many features are being added too fast.
In my experience the reduction is usually much smaller. A couple of pages to a couple of lines – two orders of magnitude improvement?
Yes. Sometimes more. Look at my iterator example. Alternatively, try doing any equivalent to logical programming in java and get back to me about how many lines of code it takes…
I agree that some syntactic sugar is needed at times for readability, but I just get concerned that too many features are being added too fast.
Why? Features like iterators (continuations) and indeed, almost any declarative construct dramatically improve clarity in the code as well as reduce the amount of errors and lines you have to write. What’s wrong with that?