Learning is an important part in life of Software developer. With fast changing technology one has to keep oneself updated of current happenings. When I took this field as my carrier around two years ago I did not had any formal education in computer science. For me programming was a hobby since college days. Luckily the company I joined had a great belief in open source technology and I got a first hand experience with them. With that started my learning.
The open source project are a treasure mine for any body to learn how to do things and write code. How to follow best practices and avoid errors. I have gone through code of many open source project and each time I got to learn something from them. Here I would mention few of the projects that I learned from which may help new commers in Java to start with
- Spring – This is a fantastic piece of code. It was the second open source project (after Struts) that I used and explored (and still exploring !!). I would recommend any newbie to go through Spring code base. What it taught me was invaluable…
- Writing comments – Its code is highly organized and documented. The javadocs are complete and you get to know how to document the facts. And really it improves readability. Remember that code is written once and read much more.
- Organizing packages – How to structure your code. Here is excellent talk on this aspect by Juergen Hoeller.
- Template Pattern – Spring uses Template Pattern heavily for all Transaction,JDBC handling. Wait what is a pattern !!. I saw the first reference to that in Spring doc and then I realized there usefulness and later I studied many more
- Proxy pattern and AOP – Initially Txn management looked a magic to me. I always wondered how it gets done transparently. Again the code answered my query and I came across two great concepts AOP and Proxy pattern. It further taught me what a good framework is.
- Dependency Injection – Frankly speaking this was strange for me for the first time. I had no experience of working with EJB’s till now so had no clue of what service locator pattern is. And why the code cannot be tested easily without it. It was a bit later I realized its importance when I worked with some older code and found how difficult it is to test your code without getting the whole application up
- Test cases – Spring test cases taught me how to write true test cases. Those test which have real assert statements and not just to increase the coverage. How to take advantage of DI to its fullest.
- Thread Locals – How the Spring know about transaction status when you call a method!! Where the state is maintained. Thread local can provide a very neat solution for such kind of problems where state has to be maintained across method calls
- Hibernate– This one was tough one but given the complexity of orm you cannot blame it also. Though code wise its not of that good quality but solution wise its cool. By clearity I mean comments and documentation.I always wondered how it generates those queries and performs on demand loading of collections. From it I learned about
- CGLIB and ASM libraries – The magic behind the power of Hibernate lies in runtime code genration. Going through its code I came across this aspect of Java. And that forced me to understand about what a bytecode is. I always knew that Java is a bytecode based language but never understood what a bytecode means. Now these libraries can generate class bytecodes at runtime. So they are a powerful tool to solve few classes of problem
- ANTLR – The HQL language that is used with Hibernate has a parser for it. Again I realized that parser can be used for such thing also. Till now I thought they were only meant to do something with the code only.
- Hibernate in Action – If someone has to understand Hibernate this is a must. It would teach you much more beyond Hibernate and explains what ORM tries to solve. What are transactions and what are domain objects.
- Cache – Hibernate can cache the domain objects transparently. And thus I understood the importance of cache and there use
- ACEGI– I came across this project while working on a security framework. It uses Spring configuration heavily and followed same practices a s Spring. But what i learned from it was how to design your code. Whats the use of Interfaces and how your design should be open to extension and not to modification. It reminds me of building blocks where you assemble your structure by assembling small pieces. Similarly it provides you all the ingredients and its upto you to assemble them. If you do not like a particular part replace it WITHOUT modifying the framework code.Initially it may seem overwhelming but once you get past the original learning curve you would get the big picture. Security is a complex domain and with a solution like this you can easily tackle any of your product requirement
- JDK – This is a real big mine and has lot more to offer.And With the code available out there you cannot ask for more. I have not seen the code for most but the one I got hooked into was the Concurrent package. For me threads and concurrency were like advanced concepts referred in last section of any Java book. And I never mustered enough courage to understand them. I read about the Concuurent package in some blog and then explored this alien area for the first time. Luckily I got to know of a book called Java Concurrency in Practice . It cleared many of my doubts in this area but still few remained. But the code for concurrent package cleared most of them Locks,Buffers ,Non blocking data structures etc. You might not use them but understanding how they work by seeing the code really helps. Further the documentation for this package is excellent and explains clearly what to expect and how to use.
The list can go on and on as there is no end to the learning. I tried to list few of the code bases I explored. For any person with few years of experience these things might look obvious but for a new person and especially from non cs background they are the initial steps. Java land is a big one and its churning out things at a fast rate. Some of the open source stuff would amaze you with what they can do. For any new person starting may seem a difficult thing at first. But slowly going through such projects he can understand how things work. With frameworks abstracting out most such things it becomes more important to know such things. As till they work fine you do not have a problem but when they went wrong it would be you who has to solve the issue.
There are many projects and technologies which are on my todo list and I am not getting time to invest. I would list few as a reminder for me
- Terracotta – It can share a normal POJO across multiple jvm and that to without code change. Power of AOP and a innovative way to manage the delta in object changes. It remain on top of my list
- Grizzly – Use NIO for non blocking connections. It can significantly increase the scalibilty of any multi threaded application involved in network IO. NIO is still a enigma to me. My concepts are still not clear on non blocking and blocking operations
So from where do people learn in Java land??