Java for c# developers
December 20, 2011 9:19 AM   Subscribe

Java for c# developers.

In the new year i will begin programming in java after several years of exclusively working with a Microsoft stack. I would appreciate links to any guides/videos/books that are aimed at experienced programmers learning java. I am more interested in information about the tooling than I am the language itself. The biggest problem I am having is that most guides that explain the basics of say Eclipse also devote a lot of time to explaining what a variable is.

Anonymous because my coworkers read metafilter.
posted by anonymous to Computers & Internet (7 answers total) 8 users marked this as a favorite
Java in a Nutshell.

Also, exploratory programming using the online docs and NetBeans or Eclipse auto-complete.
posted by pmb at 9:43 AM on December 20, 2011 [2 favorites]

I've done the same thing going from a C# to a Java programmer.

The most important things I found to learn, as a web developer, were Spring, Hibernate, Jaxb/general XML handling. The Spring manual online is pretty good, goes through step-to-step wiring and you can play with JSP and JSF as well.

The language itself is pretty similar.
posted by Wysawyg at 1:18 PM on December 20, 2011

I've always had this bookmarked for when I need to switch between the two (though this is just for syntax.)
posted by thewumpusisdead at 1:24 PM on December 20, 2011

You should take a look at Java Precisely by Michael Archer. From the blurb "This concise guide to the Java programming language, version 5.0, offers a quick reference for the reader who wants to know the language in greater detail than that provided by the standard text or language reference book. ...The final section summarizes and illustrates the new features of Java 5.0 and compares them to the C# programming language."
posted by about_time at 5:47 PM on December 20, 2011

I'm doing Java work in addition to C# work. I've found that working with Eclipse is simple once you understand the package organization intent. Unlike C#, packages need to be organized by filename/hierarchy in the filesystem. The Java compiler itself appears to get perturbed if FooClass is not in, and while I'm sure that can be subverted, it's best not to.

The hardest thing I've encountered with Eclipse/Java is doing continuous integration on an automated build server. Sure, I could write parallel ant scripts to do the build on its own, but shouldn't I be able to coerce eclipse to do that easily? (shyea, right as if).

Far more of a problem, IMHO, are the language differences that are easy to fall into. Java makes every method virtual by default, C# doesn't. This is a philosophical difference - Java wants to encourage subclassing for extension, C# wants you to consider other approaches first. So in transitioning to Java, you curse the language committee for making you type 'final' over and over to the point where you want to write a unit test to ensure that all public get/set accessors are really declared final. You also want to cuss them out for making you reimplement the broadcaster/listener pattern for events again and again and again and for not having delegates at least (no, anonymous classes are not a good substitute). The enum types in Java are cute - it's nice that they can encompass multiple values - but when it comes to doing something practical like flags, you appreciate the FlagsAttribute in C# and come to hate EnumSet, which is the Java proscribed mechanism for doing that.
posted by plinth at 3:32 AM on December 21, 2011

YMMV but I came to Java after extensive experience with Python and C++. I found that skimming Java in a Nutshell cover-to-cover was enough to get started, and then I thoroughly read the epic, magnificent
Effective Java (2nd Edition)
by Joshua Bloch.

For me the easy part of any language is the syntax and basic keyboard-mashing, and let's face it, C# is pretty similar to Java in language-terms. The difficult part is coming to grips with idioms, patterns, or rules-of-thumb, and Block's book helps.
posted by asymptotic at 5:28 AM on December 21, 2011

Also another problem for me is avoiding "Not-Invented-Here" syndrome. For a given language what is considered solved, or thoroughly explored? This StackOverflow thread is rather useful:

Most useful free third-party Java libraries

Won't lie to you, I haven't used everything in the list. However, Guava is a godsend. Read all of the presentation slide links on the front page, i.e.: As an example in Java every one of my classes now uses "Objects.equal", "Objects.hashCode", and "Objects.toStringHelper", which is covered in the first presentation.
posted by asymptotic at 5:37 AM on December 21, 2011

« Older Are people gaming the NYT crossword app?   |   Psych Consulting? Newer »
This thread is closed to new comments.