18 September 2012

I was asked recently how I might suggest going about learning a framework (like Spring). I replied in an email and I reproduce most of that email below.

Basically, don't learn a framework first. Learn how to solve the problem. Once you learn how to solve the problem, identify common design patterns that will help you solve the problem. Then, find the framework that lets you work with those design patterns. If you're trying to build a web application - learn what principles people use in building web applications. One common pattern when building web applications is MVC. Spring MVC makes it very easy to build MVC-based applications. If you're trying to build a service, you will typically learn about data-access technologies and repositories and ORM. Spring and Spring Data have great support for building service objects (a pattern) and repositories or data access objects (DAOs). If you're trying to build an application that has many layers - services, web tier, repositories, unit tests, etc.- then it is helpful to have dependency injection, which is another pattern that Spring also supports. That is the 'correct way' to learn new technologies, in my opinion. If you understand the problem you're trying to solve, and you've identified a good technology, then looking at other people's code can be VERY helpful. This is one of the reasons I love open source so much. You can look at so many other peoples' code.GitHub is an amazing place. Look at the SpringSource repository and you'll see the source code for many different projects. If you look, you will often find '-samples' projects inside of the SpringSource project. Also, the Cloud Foundry Samples repository provides great, multi-language samples that you can refer to for getting started on Cloud Foundry. These projects show how to use the patterns. The Spring Hibernate Template shows a good example of building an application on Spring MVC and Spring that works on Cloud Foundry. In addition to looking at source code and looking at design patterns, you should always ask questions. If you have a chance, go to the Java User Groups in your area. Ask questions on the SpringSource forums or Stack Overflow. And, of course, i am always happy to help answer questions, too ;-)