Advertisements
Posted by: jsonmez | February 4, 2010

C# vs Java Part 2: The Platforms (Web)

Back in the C++ days it wasn’t about the platform at all.  It was all about knowing the intricacies of the language and pointer manipulation.

Modern programming languages are more about platforms and libraries than about the language themselves.  In both Java and C# knowing what libraries are available and how to use them is a much more important factor than knowing all the features of the language.  A developer who understands the platforms and base class libraries, will be able to accomplish more than a language expert, which is a stark contrast to how programming used to be.

One more note before I dive into the platforms.  When I use the term platform here, what I am really referring to is the technology platform, base class libraries, and frameworks in general.

The Web

Java

For a long time Java has been dominating this space.  If you are doing basic Java web development you will most likely be using Java EE 5 or Java EE 6 which used to be called J2EE.  Aside from that commonality, the rest is a very big question mark.  Here is a list of 10 popular frameworks for developing a Java EE application.

Java web frameworks are huge, cross-cut many different concerns and the choices are daunting, but they are also very good.  For a long time while the .NET community was dragging and dropping controls onto a .aspx page, the Java community was building highly scalable model view controller (MVC) frameworks with distinct separation of concerns.

Most Java web application frameworks are built on top of the basic framework available in Java SE, specifically around applets and beans.  The current generation of the base Java SE specification has been greatly simplified to make writing enterprise web applications much easier than it was in the past.  This is the point where the platform and tooling overlap a little bit.  After selecting a web framework for developing in Java (which pretty much all of them are MVC of some sort), if you have a tool which supports developing on that framework (IDE plugin), development on that framework can be very easy.

Here is the difficulty… information overload.  If you took a look at that list of Java web frameworks, you can see there are many of them to chose from, and each one requires pretty extensive research to understand.  Some of them even combine, like Struts + Spring.  In fairness though,  part of the proliferation of frameworks is due to the age of the platform.  If you can wade through the choices, and settle on a framework, most of the good ones are really good and proven.

C#

ASP.NET for a long time was analogous with Web Forms.  Up until the release of ASP.NET MVC the only way to do C# web development was with ASP.NET Web Forms.  This technology was not bad.  It just did not have enough guidance.  It truly is amazing how easily you can drag and drop a control onto a page and have it automatically populated with data from your database and allow edits to that data all without writing a line of code.  Amazing, but in a ‘violate all separation of concerns, mix all my layers together,  look I’m accessing the database directly from the UI’ type of way.

Now don’t get me wrong here.  I’m trying to be fair and honest, and Java took a beating in my previous post about languages; ASP.NET Web Forms is going to take one here.  With that said, yes, it is possible to write a good separation of concerns MVC style application using ASP.NET Web Forms.  And yes, it is possible to write an ASP.NET web forms application that properly uses business objects that use the data access layer and still bind the business objects or data transfer objects to the UI.  Before MVC was around, I built several ASP.NET applications which did exactly that.  The problem is that you really had to figure out creative ways to do it, and there wasn’t any kind of real guidance.  I always felt like the platform was trying to push me into dragging and dropping, like a little devil sitting on my shoulder saying “but it is so much easier to just bind that control directly to the database.  Look, the wizard will do it for you.”

Fortunately that problem has been solved with the ASP.NET MVC platform.  It is very new and still needs some maturing, but it encourages good design practices that separate the concerns.  Under the covers it is still using the Web Forms view engine as a default, but that can be swapped out with any number of view engines which are starting to pop up.  There still is a bit of a complexity issue with ASP.NET MVC in my opinion, especially in regards to AJAX.  I know that some of this has been solved, but some people will find it very difficult to come from a platform where you could drag and drop a server control, have a wizard to set it’s properties, and have the HTML automatically generated for you, to one where you have to hand code much of the HTML.  ASP.NET MVC uses HTML helper classes to help render the HTML for you, which is a good step, but I think it still has some room for improvement.

Microsoft has also done an excellent job of getting information out there about how to develop in ASP.NET MVC.  This is one of the areas where MVC shines.  When I go to search for how to develop on Sprint or Struts there are some tutorials, but nothing like the volume of information that is out there and easily accessible about ASP.NET MVC.

Rich Internet Applications (RIAs)

Quick blurb on this topic.  .NET and Java both have competitors to Adobe Flex and Air in this space: Silverlight and JavaFX respectively.  There really isn’t even a competition here between Silverlight and JavaFX.  JavaFX does not have a visual design and has some strange new language to learn which mixes layers of abstraction.  Silverlight gives you the full power of the .NET framework and uses a common design with Windows Presentation Foundation (WPF) through XAML.  I am not sure what Sun was thinking here.

Conclusion

It is very hard to compare the web platforms, without giving so many details about them.  I really haven’t even gone into very much depth at all.  Java EE has a much larger web platform, but it is also more fractured.  ASP.NET is only split between two technologies, but the MVC platform is not very mature at this point.  (Although it is growing and improving extremely fast.)  One consideration as a developer is specialization.  It is not possible to be an expert in every single web platform or framework.  If you going the Java route, you’d better pick carefully, because the nature of open source development leads to many dead projects.  A considerable investment in learning could be lost.  ASP.NET MVC is still a gamble at this point, but I think it is a good one, because Microsoft is devoting a large amount of resources to it and the adoption seems to be widespread.

To be continued…

I thought I was going to be able to cover more than the web in this post, but I didn’t realize how much there is about the web platform.  Tomorrow I will cover desktop development, and future sections will cover IO operations, databases and concurrency, and mobile.

Advertisements

Responses

  1. “One consideration as a developer is specialization. It is not possible to be an expert in every single web platform or framework. If you going the Java route, you’d better pick carefully, because the nature of open source development leads to many dead projects. A considerable investment in learning could be lost.”

    This could lead into a discussion about the paradox of choice and how do you go about evaluating the technologies you want to specialize in. There are no guarantees with whatever you choose. Some great technologies have been largely ignored over the years while lesser ones seem to never die.

    I heard someone the other day (think it was on the Herding Code podcast) say the best code he ever wrote never made it to production due to business decisions outside of his control. The worst code he ever wrote … is still running today years later.

    I think the same could be said for platforms/languages in many cases. Whatever your technology darling is today, it could be an outcast tomorrow. How do you choose wisely?

    I think one approach is to specialize in two or three technologies and not just a single one. It’s unrealistic to specialize in 10 different things but I think most developers should be able to handle 2 or 3. Unfortunately, in the .NET space, the majority of the developers I know have tunnel vision and only know one thing.

    • Good point. I have also had some of the best code end up not making it to production, and some of the worst ending up being used way more than I would expect.

      I guess my main point here is that when you have many choices off a main branch to choose from, it is more likely that the 1 or 2 your pick will end up dying off, but if you have few choices off a main branch, you are less likely to see that happen.

      But definitely I agree with you. A developer should be well versed in several technology choices.

  2. […] C# vs Java Part 2: The Platforms (Web) […]

  3. […] C# vs Java Part 2: Platforms […]

  4. […] C# vs Java Part 2: Platforms […]

  5. My very first job as a java developer was to retractor some application, just because the developers behind open source framework for the old app had scrapped it along time ago. I always wondered, what if the the developers for current framework repeat this ?

    are we going to invest and develop a new version for the our Application from scratch !! very sad.

    • That’s a smart way of thninkig about it.

  6. My very first job as a java developer was to retractor some application, just because the developers behind open source framework for the old app had scrapped it along time ago. I always wondered, what if the the developers for current framework repeat this ?

    are we going to invest and develop a new version for the our Application from scratch !! very sad.

  7. I’ve never did much with Java but I use the C# features you’ve mentioned almost daily. It’s fun to get an idea of what developing in Java might feel like.

  8. hey there and thank you for your information
    – I’ve definitely picked up anything new from right here. I did however expertise several technical issues using this web site, as I experienced to reload the web site lots of times previous to I could get it to load correctly. I had been wondering if your web hosting is OK? Not that I’m
    complaining, but slow loading instances times will sometimes affect your
    placement in google and can damage your high-quality score if ads and marketing with Adwords.
    Anyway I’m adding this RSS to my e-mail and could look out for a lot more of your respective interesting content. Ensure that you update this again soon.

  9. I do not even understand how I finished up right here, however I believed
    this post used to be great. I don’t understand who you are but certainly you are going to a well-known blogger when you aren’t
    already. Cheers!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: