Click here to Skip to main content
13,554,611 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 21 Jul 2011
Licenced CPOL

A .NET Developer’s Journey into Java

, 21 Jul 2011
Rate this:
Please Sign up or sign in to vote.
A .NET developer's journey into Java

In my new job working in mobile development, I am getting to know Java more in depth, because native applications for both BlackBerry and Android are typically built with Java. I was excited about Mono for Android as an option for me, but I think it’s a little too new to gather much acceptance for the kinds of clients I am currently dealing with, as well as my colleagues who are mostly Java developers. And now, the uncertainty around the Mono project makes this untenable for the near future.


As I continue to dive deeper, I am genuinely surprised at how much Java and C# overlap. There are of course differences, but these are much fewer than the similarities.


Of course, this point has nothing to do with the language differences, but it affects how you get there. Getting to know Eclipse has been interesting. Since I was a recent convert to ReSharper with Visual Studio, initially Eclipse seemed like a real step backward. The autocomplete is not as good as VS Intellisense, and the syntax highlighting isn’t as good. I learned about FindBugs, a plug-in for Eclipse that performs code quality inspections similar to ReSharper. It’s not as robust, but for the time being it’s workable. I still haven’t found the productivity tools ReSharper provides. I want to get to know IntelliJ IDEA (assuming it’s as good as ReSharper because it’s also from JetBrains), but I have two problems so far:

  • BlackBerry development can only be done with Eclipse
  • All the Java devs around me are using Eclipse

I’m going to try IntelliJ IDEA for doing some Android work on the side. If it’s much better, I’ll work on swaying my colleagues.

It’s also interesting that most folks have multiple copies of Eclipse installed, each one configured with the plugins dedicated to a certain kind of development, i.e., one for BlackBerry, one for Android, one for back-end web services, etc. Apparently Eclipse doesn’t use the registry, so multiple copies is not an issue. Installing the plugins is a pain. Sometimes you get them from the IDE using a built in feature, other times you download and install them separately. I guess VS is similar, you just need to do it much less often.

Lack of Properties

Right off the bat, this was difficult for me. You can make members public, but as in .NET, this is frowned upon. So you end up creating getPropertyName() and setPropertyName(value) functions explicitly, and they show up as methods not as members. I guess I am spoiled by the auto-implemented properties in .NET. I needed to change the way I looked at accessing data in a class.


While string objects themselves are very similar (immutable, StringBuilder, etc.), formatting them is different. There is a static String.format() function, but it requires little more stringent parameters than the .NET version, akin to the string formatting you do in .NET during declarative databinding in ASPX pages. Java also has dedicated classes for formatting numbers and dates.


While events are built into the Java language, it’s in a much more rudimentary way in comparison to .NET. You have to do all the plumbing yourself. Frameworks like AWT and Swing help with this, but as a mobile developer, these aren’t doing me any good. It seems to me there isn’t as much focus on this as there is in .NET.


The kind of functionality you get from Linq is not built into Java directly. You need a 3rd party library to do something similar, like lambdaj. In fact, using 3rd party libraries is more of a pattern in Java than in .NET. There are tons of open source libraries to extend the language, which is not as common in .NET.

Open source continues to be a problem for me. I keep doing work for large corporations, and mostly they will not accept open source in software solutions. Essentially, they don’t trust the source from a legal perspective, so unless some third party comes along and indemnifies the source for them (like RedHat or Novell has done for Linux), large corporations just don’t want to use it. Now that I have seen how easily hackers can affect open source, I can see where their paranoia is coming from. Ultimately, they are actively choosing sub-optimal solutions to avoid any risk, instead of managing the risk. I’m sure there is a scaling factor here for the largest companies. This is another hidden contributor to the costs and failures of software development.

Null Pointer Exception

Null Pointer Exception == Object Reference not set to an instance of an object. Which one is a clearer message describing the actual problem? Neither one.


The naming conventions in Java differ somewhat from what is accepted in .NET. Methods start with lowercase letters. I’ve seen a bunch of recent code written by other Java developers and am deeply disturbed that Hungarian notation is alive and well. It’s down but not out in the .NET world, I hope I don’t find it thriving in Java….

Class Duplication/Refactoring

I’m finding with all the different namespaces and open source projects available, that lots of open source developers adopt the “not invented here” attitude and create their own version of a class, ranging from slightly to wildly different. Classes for handling JSON are a great example of this. I have found at least half a dozen implementations of the JSONArray class. Uncle Google is no help for this newcomer. Which one should I be using? Will I need to build a façade into my designs so I can use more than one? Do I now need to build time into my estimation to research all the possible implementations of a concept. How do Java teams manage that?

As I continue delving into the differences, I’ll likely have more posts.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

David Truxall
Team Leader Hewlett-Packard
United States United States
Dave has been programming for a living since 1995, working previously with Microsoft technologies modeling internal business processes, and now working as a mobile architect and team lead. He is currently employed by in the metropolitan Detroit area.

You may also be interested in...


Comments and Discussions

GeneralMy sentiments exactly Pin
MomentSurfer25-Jul-11 18:55
memberMomentSurfer25-Jul-11 18:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180515.1 | Last Updated 21 Jul 2011
Article Copyright 2011 by David Truxall
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid