Learning to Program
My personal favorite language, of course is Java. But Java is difficult to learn. Consider the Hello World program in Java:
public class MyClass{
public static void main(String[] arg){
System.out.println("Hello World");
}
}
Now consider the same program in other languages (Python, Perl, Ruby, Groovy):
print "Hello World"
When learning Java as the first programming language, the learner is forced to understand, difficult to understand concepts like package, command line parameter, visibility, arrays, etc. in the very first program itself. This is not beginner friendly.
Eric S. Raymond recommended Python for beginners. But now a days it could be any of the new scripting languages: Ruby, Groovy, Scala, or of course Python itself. Each of these dynamic scripting languages have very minimal infrastructure code. So when writing a program to do something, the code exactly means that. Very beginner friendly.
Java
After being exposed to so many languages, I still love Java. Of course, I spend lot of time still writing infrastructure code instead of core business logic even now, many of these are changing in Java. For example, to read a user input from command line, long back ago we had to write:
Before Java 5
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
br.close();
}
catch(IOException ex){
// ...
}
Java 5:
Scanner in = new Scanner(System.in); String s = in.nextLine(); in.close();
Now, in Java 6 this has been replaced with:
String s = System.console().readLine(); // No IOException thrown
Things are getting more developer friendly day by day.
Java Swing
One of my favorite parts in Java is Swing programming. All over the years since I first touched Java, Swing has constantly made me learn new things. And I have also been awe inspired so often at the wonderful extensible design of the Swing API itself.
Using Swing APIs itself is a covert educating process. When I started writing event processing code, I was covertly introduced to Observer design pattern. There is thousands of such instances where I learned good OOP design approaches without any formal education. Another area where in normal Java coding we do not spend much time is concurrency. When writing any non-trivial Swing applications, you will have to think about concurrency!
Swing has constantly challenged me to think and design smart applications. This is an area which must be covered for learning Java.
Enterprise Java
Enterprise Java is one thing I work day-in and day-out. But the majority of the time I spend when writing Enterprise Java code is: figuring out how. The Enterprise Java platform takes care of the critical areas like resource pooling, transaction management, concurrency etc., so at the end of the day, the programmer is relieved of writing this same code again-and-again. But this ease comes with the cost of configuring the system for it. Also, is Enterprise Java a good learning platform for programming? Well, for programming not exactly. But for many practices, it is. Practices include: packaging, build, testing among others.