Presentation by Rod Johnson on Persistence Strategy
The ServerSide has posted a presentation by Rod Johnson on Persistence Strategy. This is an excellent presentation that every Java developer should check out. In it he outlines the problems with persisting objects and some of the solutions. He also goes into why the “roll your own” solution to persistence is bad. This is something that I definitely agree with. If you have the choice between coding something yourself or using Hibernate, use Hibernate. At the end of the presentation, he goes into how Spring implements persistence and how it abstracts that persistence away from the business layer, but still provides all the functionality and power of the underlying database.
In the presentation, Rod outlines eight points or lessons:
- Data tends to stick where it lands. You can’t assume that any Java application controls the schema, and the schema may outlive the application.
- Tools are useful, but are a bandaid solution. If you’re using tools to do things that could not be done by hand - you’ve got problems.
- Peristence should not be tied to a specific environment.
- Databases are very good at what they do - but it’s necessary to let them do it in a natural way.
- Don’t attempt to build your own persistence framework, unless your requirments are truly unique (like not accessing common types of persistent stores).
- O/R mapping works well in 90-95% of cases, but many developers get burnt applying it everywhere.
- Using JDBC directly should be a sackable [english slang for fired] offence.
- Don’t afraid to use DB specific features if you have a sound architecture (isolate them behind interfaces).
I personally like the seventh lesson.