Sunday, March 9, 2008

Starting Java - A Beginner's Guide / Road Map

If you are java newbie starting to learn java then you may be wondering where to start. You may be overwhelmed hearing so many jargon like Java 5, J2EE, EJB, Servlet, Struts, Spring, Hibernate etc.

I am trying to create a road map for people who are new to Java. Java is so wide and diverse that a good road map is must for beginners. Good road map helps to focus your energy and attention rather than getting confused by jargons.

Here is my recommended order of learning Java:

  1. Learn Java fundamentals.
  2. Give Sun Certified Java Programmer Exam (Optional)
  3. Learn about some basic tools like Eclipse editor, Ant, JUnit etc.
  4. Start learning about J2EE starting with servlets and jsp.
  5. Get a basic idea about EJB.
  6. Learn widely used Java framework like Struts, Spring and Hibernate.
  7. Dive into the realm of design patterns and application architecture.
  8. Get familiar with XML.
  9. Read about web service and Java APIs for web service.

Learn Java fundamentals:
The first thing you should do is get familiar with basic Java. This includes basic programming constructs (data type, variable declaration, for & while loops etc). With this knowledge you can start writing simple Java programs.

Since Java is a pure object oriented language, now is the time to get some basics about object oriented paradigm. Try to learn about inheritance, polymorphism, interfaces etc and how to use them in Java.

To make your Java program more robust and to write real world programs you need knowledge of Java exception handling, I/O mechanism, Collections and Threads.

Having learned the above things, you will get a good understanding of the Java fundamentals. If you want to test yourself then you can go for Sun certified Java programmer certification.

Also start using a good Java editor to write and build you Java program. I would recommend Eclipse open source editor which is free and has good support for Java. You may want to get some idea about good build tools like Ant which can be very useful especially for big projects. You should always follow good coding standards so that programs are easy to understand and maintain. Sun has a good coding convention for Java. And don't forget to write unit tests for your programs. Unit test help you to catch bugs in your code so that you can make your code more robust. Also they make your program more maintainable - if in future either you or your friend makes some modification in the program he can run the unit tests to make sure that he is not breaking anything. You can use JUnit to write your unit tests.




J2EE And building web and distributed applications:
After getting a decent knowledge about Java basic, you can start learning J2EE. J2EE enables developing real world applications. Start with learning about Servlets and then move on to JSP. Learn how to create web applications using Servlets and JSP. I would suggest spending a little time just getting an overview about EJB. You may need to work with EJB later, but I would recommend not spending much time learning EJB until you definitely know that you are going to use them. But for now getting a brief overview of EJB and knowing what are the pros and cons of using EJB should be sufficient.

There are a lot of frameworks in J2EE world. Different people have their own favorites. Actually there are so many frameworks that there is no end to learning frameworks. But I would recommend learning three of the most popular ones: Struts & Spring which are application framework and Hibernate which is a data persistence framework.

Design Patterns and Architecture:
An important part of building good application is writing well designed code. Good design helps us to understand the code better, enables us to modify/extend functionality relatively easily while minimizing the impact on the existing code and hence makes the code more maintainable. Extensibility and maintainability are very important because eventually majority of your time will be spent maintaining the application you write. Good design skills will come from experience. But a good way to kick start it is by learning design patterns. I would recommend learning two kinds of design patterns: a) General patterns (also known as GOF patterns) And J2EE related patterns. GOF patterns will help you to write good object oriented code. While J2EE patterns are extension of the GOF pattern for building web or distributed application using J2EE technology.



XML and Web Service:
XML is primarily used to facilitate the sharing of structured data across different information systems. And with the growth of internet the importance of XML has grown tremendously. A Java programmer need not be a XML guru, but it is highly imperative to understand XML. So I would recommend learning the following things: what is XML, XML structure, namespaces, schema and DTD. Also as a Java programmer you should know about the Java SAX and DOM APIs to parse XML. Basic knowledge about XPath and XQuery is also recommended.
A good book for learning XML is:
Java and XML, 3rd Edition,by Brett McLaughlin & Justin Edelson published by O'Reilly Media, Inc.




W3C defines Web service as "a software system designed to support interoperable Machine to Machine interaction over a network.". With growth of network enabled systems there is a need for interaction and exchange of information in an interoperable way between them. This is exactly what Web Service tries to solve. For last couple of years there was a rush to get the systems web enabled. Now there is a rush to get the systems web service enabled. So as a Java programmer it is imperative to know about web service. But unfortunately web service technology is rapidly evolving and books get outdated very soon. Java web service APIs like JAXB, JAXM, JAX RPC have been superseded by JAX WS. So to get a grasp of this rapidly evolving yet very important technology I would recommend following roadmap:
First learn about Web Service, SOAP and WSDL whi are at heart of web service and are standards that are technology independent( i.e. doesn't matter if you are using .NET WCF or JAX WS). Good book for this is:
Java Web Services Architecture (The Morgan Kaufmann Series in Data Management Systems) by James McGovern, Sameer Tyagi, Michael Stevens, and Sunil Mathew

After that I would recommend learning JAX WS. But since JAX WS is very new there are very few books available. The book I like is:
SOA Using Java(TM) Web Services by Mark D. Hansen





This will help you to get a good understanding of XML and Web Service.

1 comment:

Charl said...

Hello

I'm just beginning to learn Java. I have been attempting to learning ASP.NET since 2003, but I haven't been able to really concentrate on it due to family matters. I am an expert in HTML and CSS. I am improving in Javascript.

I absolutely appreciate your taking the time to write this roadmap. Your blog written in 2008. Since it is now 2010, would these books and path that you recommend here still be a great way to learn Java programming?

I anxiously await your reply.

You may email me directly at chqdzn@yahoo.com.

Thank you in advance.

Sincerely,
Charl