OFBiz Framework: An Innovative Approach to E-commerce

Upcoming trends in E-commerce focus on alleviating a developer’s problems in building breakthrough E-commerce applications. E-commerce frameworks are effective only if they reduce the developer’s pain of reproducing an application with same functionality/coding and allow them to customize the existing code to the utmost extent. Else, the framework should faciliate creation of new functionalities/coding which can in turn be reused in future application development process.

OFBiz Framework

OFBiz is one such noteworthy free opensource framework that is based on Sun JAVA, J2EE, W3C XML,WfMC XPDL,HTML, OMG GL and SOA. It has a loosely coupled multilayered architecture that implements design patterns such as Model-View-Controller (MVC), Service Oriented Architecture (SOA), and database-independant persistance layer that allows existing or custom-developed applications to be added by dropping into a components-based architecture.

OFBiz: Component-Oriented Architecture

OFBiz is totally a component-oriented architecture in which each module or a functionality can be defined as a seperate component and can be integrated into the same application or reused across many applications deployed in the same server. For this, OFBiz comes up with its own in-built server OFBiz that in itself contains Tomcat 6.0 and Tomcat 5.5, out of which we can choose one.

OFBiz: MVC Architecture

The MVC mainly consists of reusable decorator patterns in the form of special purpose templating language called FTL (FreeMarker Template Language) instead of the traditional JSP pages. The templates together work with actions in the form XML meta-programming that are coded as Screen Widgets. The widgets and FTL together become reusable across many different applications, for example, the same Login Widget can be used in both Shopping as well as Accounting applications. Thus, MVC achieves the true means of reusability in the form FTL templates and Screen Widgets. The actions can be invoked using special scripting language called BeanShell Script or Groovy. To add look and feel for the application, OFBiz greatly supports integrating predefined visual themes or customizing the existing themes or a newly created theme.

OFBiz: Service-Oriented Architecture (SOA)

Next comes Service-Oriented Architecture (SOA) which sits in the middle part of the tiered framework and contains the core business logic to be processed. Services in OFBiz operate in a Service-Oriented Architecture (SOA). These services not only have the ability to invoke other services internally, but can also be ‘opened up’ and invoked by remote applications using, amongst other methods, the widely adopted messaging protocol SOAP.

Behavioral Model’ for Code Organization

Besides serving as a platform for interoperability, OFBiz services also offer us additional capability to organize our code. Java has made a paradigm shift towards object-oriented programming design from traditional procedural model by encapsulating methods and variables together into objects to form a “real world object model” for code organization. Likewise OFBiz also groups up behavior together to form a coherent “service”. Thus, OfBiz services goes yet to another higher level than Java’s object towards code organization.

Minilang reduces development time

The services functionally are defined either using service configuration in the form of Minilang, an XML-based language or can be defined in Java. But Minilang would be the better option because with Minilang, the developers time is much reduced as it is used to implement simple and repetitive tasks. We need not compile our code each time because of its XML based script and is implemented much faster than Java services. With Minilang, we need not restart our application each time the services are redefined or modified. A simple browser refresh is enough to see the changes.

Minilang vs Java

Minilang services are referred to as “simple” services. They are defined and invoked in the same way as Java services. They can be invoked by the control servlet from the controller.xml file or from code in the same way as a Java service.

With Minilang, the developer must make a choice. Some developers choose not to increase the already steep learning curve associated with the framework by learning the syntax by heart. Since everything that is possible in Minilang is possible in Java and the fact that Java offers limitless possibilities, while Minilang is limited, many developers choose never to develop in Minilang. However, it is undisputedly easier to code quick and simple services in Minilang than in Java. Especially if you use an auto-completion XML editor, like XMLBuddy, which is again open source. When designing their code, the developer should decide how complex their service is going to be and decide whether to use Java or Minilang.

How far does Minilang provide security for services?

Since OFBiz is mainly meant for E-commerce based application, the e-commerce component of OFBiz should allow customers to edit and view their own orders, obviously checks need to be made to be sure that customers are not viewing or editing other people’s orders. In such a scenario, permissions can be checked in Minilang, say, tags that are already predefined in Minilang.

OFBiz – Entity Persistence Layer

The most salient and independent part of the OFBiz framework is its Entity Persistence Layer, which is totally database independent. The developers need not go and create tables indeed or do any hardcoding in Java to connect their application with database and pass parameters to insert into table, do updation or deletion, or even pass queries to retrieve data. The entire thing is taken care by OFBiz’s Entity Engine itself which consists of two XML files namely entity-model.xml and entiy-group.xml that can be configured to fit into any database of the developers’ choice. This enables the developers to easily migrate their database from one vendor to another vendor and easy code maintainance, i.e. developers need not do any minor change to their code for the cause of database migration.

Main Menu
Responsive Menu Clicked Image