Thursday, August 10, 2006

POJO Based Development

POJO is an acronym for Plain Old Java Object. Nowadays, in java community , POJO based development approach is getting more attention by java developers. So, you may ask yourself what is a pojo object and why its gaining more attention by developers. POJO object is an ordinary java bean, no more no less. If you developed applications using EJB technology, that is a part of J2EE technology stack. you know creating an entity bean is a complex task. when you develop an enterprise application using a framework such as EJB, domain classes in your application have to extend or implement a framework classes. If you have a class that implements or extends any class it is difficult to reuse that class. For example, if a class have to extend a framework class to get some framework services that class never extend any class in our application. Reusing that classes in others parts of applications becomes difficult.Also, when your classes extends or implements framework classes, your domain objects becomes tightly coupled to the framework. As a result of tightly coupling it is hard to test domain objects outside of framework. If you used EJB for persistency in your project, for an entity object , you can only run and test your object inside of an J2EE container. Outside of EJB container your object will be useless. Coupling is a very bad thing for an application. In the case of EJB based application your application are coupled to EJB container.Every application has coupling. Loose coupling gives us a lot of flexibility in reusing,unit testing,deployment and tuning. When you develop an application using a framework a degree of coupling between your application and framework is important. More coupling shows that your domain objects would be more complex, hard to manage and test as a result your application would be complex application. Less coupling shows that your domain objects would be simple objects(POJOs) , easy to manage and test as a result your application would be simple application. If your application simple it is easy to maintain and testing.

There are a common complaints about java development that learning curve is long and coding with java is difficult and applications developed using java are too complex. Java as a programming language is very powerful and simple. J2EE is a standart java based enterprise application development technology for the web based java development. J2EE technology is a well known and dominant framework in java community also dominated by the Sun. J2EE technology stack contains technologies such as EJB, Servlet, JSPs,JNDI and other technologies. J2EE is a heavyweight approach to the web based development because of EJB technology is a distributed application architecture. Developing applications using distributed application is a complex task. If your application is a distributed application, any object in your application may be reside on any any machine in the network. Solving problems using a distributed architecture results with a complex solution. Although your problem domain is simple your application would be complex because of based complex architectre . Developing web applications using EJB are complicated. If you decide to use EJB in our project you also decided your application architecture probably be a distributed application architecute.

If we ask question again , why applications developed using java are complex? The main reason is EJB a complex architecture and generally results with a complex solution(application).

There are a lot of new frameworks based on java technology. Most of them lightweight frameworks.

POJO based development aims to simplify application development and unit testing and allows to develop loosely coupled applications. J2EE is dominant framework in java community,