I am currently learning C #. My client has organized a new data store, and the client application will be on Windows. As a new consultant, experience in .NET / C # also does not hurt, even if I prefer to develop on any platform other than Windows ... As a consultant, I have to take care of future contracts. If for this you should use and develop under Windows - I will do it, even at home.
I love Java VM. It is mature, fast, extremely mobile (portable) and there are a lot of languages that work on it. When I was programming in Java, I was the only person on the team who was on a Linux desktop, all others used Windows. When you write in Java - it does not matter. In reality, it was even an advantage. Some of our clients used software on Unix-like systems. Having at least one developer who used and tested our product on Linux was already a win. Our build system worked on a weak Linux server. Since Java runs wherever there is a Java VM, any of our team, like our clients, could run software.
But Java, as a language, began to oppress me. He was left on a dusty shelf. Scala is my favorite Java VM language, incorporating many new ideas that are still looking for their way to Java.
The worst thing about Java enthusiasts - Java fell behind C #. I studied C # from the
O'Reilly C # in a Nutshell book. This book is an excellent way to learn a new language, if before that you already know the n-th number of other languages. I should have given Micorosft a chance (even if it hurts me). Here are some things in C # that Java can't:
- Lambda functions that are much better than internal anonymous classes, which are also in C #
- Delegates. Yes, this can be done in Java, but it will not be as beautiful.
- Operator overloading. This thing can turn everything into hell, but it is still convenient, especially in libraries and DSL
- Properties No need to write getters and setters. Everything looks like a direct appeal, even if it is not. These are also Python and Scala idioms, and once you start using them, you no longer want to use getters and setters. foo.x + = 1 is more readable than foo.setX (foo.getX () + 1)
- Yield support in iterations. Although I prefer the Python (and Scala) syntax to C #, this is a powerful and very convenient thing. If you have ever used it to create lazy iterators (in Python, Scala, C #, no difference) - you will understand what I mean.
- Extension methods. This is the equivalent in C # of implicit type casting in Scala, and it’s damn convenient. This allows you to extend existing classes, even if they are ready, without real extensions. As in the Scala version, there is an implicit casting mechanism, they do not happen automatically. ( Mark : as Tomi Morris noted, in the comments to the article, extension methods are not quite equivalent to implicit type casting in Scala, in it all is implemented much more powerful. Now it is clear that C # borrowed one useful aspect, but it is also clear that Java does not even have a close resemblance of this concept).
- Operator support ??, which offers simple syntax for retrieving a value of a reference type if it is not null or the default value specified
In addition, Java has many of the same things with C #, including:
- Interfaces
- Generics
- Automatic packaging and unpacking.
- Annotations (in C # these are attributes)
I am still prone to JVM, rather than CLR. JVM is huge, mature, fast and, most importantly, mobile. But Java, the language, has fallen behind and now it has a big lack of useful features that C # has. I still use Scala because it corrects for Java flaws, provides many advanced features, while allowing you to use the power and convenience of the JVM. Using libraries or built-in features, Scala provides the same features as C # and more. But in the .NET world, C # is
lingua franca . Both C # and .NET are big Java competitors.
')
Sun and the Java community have allowed Java to stagnate compared to C # and Scala, and is not pleasant to use. As a longtime Java programmer, I have to say that I am distressed.