Monday, May 08, 2006

Spring Experiences - I

Best way to develop is to develop by developing small, simple testable modules. Every programmer knows that. It's a saving in the long run. No wonder "Hello World" is like the developers "Shree Ganesh" (Indian auspicious words spoken at the onset of any work).

Anyways, once fundamentals are clear, there are too many things yet to be explored. What if you have to develop some advanced application but you just know the basics? Can you do it? Usually, tutorials, step-by-step approach are most helpful in such cases. You save your research time, follow tutorial, step-by-step, with customizations as and wherever, whenever needed, with comfortable understanding and confidence.

I am going to try to enlist my successful / unsuccessful experiences of development of a medium-to-large scale application on spring framework.

Goal: To develop a multi-tier extensible, scalable, flexible enterprise application.
Framework and others: Spring as overall application glue. Spring will be used to loosely couple various components. Jetty will be our servlet [webserver]. MySql will be our database and Hibernate will be ORM / DAO layer.

So lets start!

We can start in 2 ways - 1. first design classes and then, further develop 2. first design database tables and further proceed. Usually first step is most difficult, especially if there are too many unknowns to be researched. In my case, I started with design of DB tables, as the overall application was more data-centric.
Design of MySql Relational Tables Pointers:
1. MyIsam is default table and most optimized for DB operations. But it does not support relational linking. For any type of relational linking, MySql's InnoDB tables must be used. In general, we should try to split tables, certain tables hold information that can be linked with other more functional tables. It's usually these functional tables, that may have heavy DB operations and they can be made MyIsam. When we have such case where there exists a relational logic, but it is not supported by database, the responsbility gets obviously pushed on the back-end access layer (or maybe business layer) to maintain synchronization.
2. Most of the tables can be InnoDB, to have well defined and organized relational linking.

Now, after we have created the database or coded the db.sql, we have the database with tables. We will consider each each table as a business object and try to achieve this, by defining class for each table. Thus we are trying to map the classes over data now. It's here, where hibernate comes in very very handy! Hibernate manages all data flow using XML mapped files.
In the next part, we will try explore the power of Hibernate to automate the process of code-generation for the all the classes that map tables in our database.

0 Comments:

Post a Comment

<< Home