The future of Java.

Associate
Joined
2 Nov 2009
Posts
1,132
You'd have to put a gun to my head to make me go from C# to Java. It wouldn't be easy giving up LINQ, lambdas, expression trees, proper generics, value-types (!!) and all that functional-esque goodness. Camel casing, bizarre attribute syntax and the lack of properties are mere annoyances by comparison.

Java is at least 7 years behind C# now.

Java is the epitome of "enterprise development". And yes whilst the .NET ecosystem is not perfect, in my experience I find the "enterprise development" that goes on in .NET land is far more terse and minimalist. This is perhaps partly as a result of its long standing support of generics and function pointers (delegates/lambdas/closures or whatever the new name happens to be this year) which has enabled better frameworks to be developed. Look at an IoC container for Java and then compare it to, for example, Autofac for .NET. It is like night and day. Java has way too much pomp and ceremony going on in its ecosystem. For example I can't actually remember the last time I had to hand roll a "factory" class nor any sort of "resolver" type responsibility. Whereas in Java, if you aren't doing those sort of things every day then generally something is wrong or you are actually on holiday!

Or use DI instead of factories...
 
Caporegime
Joined
18 Oct 2002
Posts
29,491
Location
Back in East London
Factory pattern is one of the most valuable Patterns in existence. It is especially useful when using dependency injection. :) Many don't realise they are violating the single role principle by constructing objects in line. Sure just creating a simple object isn't going to get my knickers in a twist; but any kind of logic to create it should be passed off to a factory.

Deciding which type to instantiate or which dependencies to use on the object you are instantiating is one role on its own.
 
Back
Top Bottom