News: Confucius - A J2EE Framework for Middle Tier Programming
A new open source J2EE framework has walked into town. Confucius is an Avalon based J2EE Framework which minimizes the complexity and coding effort for middle tier programming by externalize SQL, business logic and workflow logic into XML configuration files.
- Posted by: Gang Chang
- Posted on: February 05 2004 19:11 EST
Confucius is a generic Framework based on Apache Avalon.
The main purposes of this framework are:
1. To provide generic, interchangeable, ready to use components for the middle tier: Business Object layer, Data Access Layer and Facade Service layer.
2. To minimize the complexity and coding effort for middle tier programming by externalize SQL, business logic and workflow logic into XML configuration files.
3. To improve application maintainability by developing application based on Component Oriented Architecture.
4. To fully utilizes the benefits provided by Avalon Framework
1. To write repeated code existing in most applications only once and provide them as components in Confucius. For example, the way Data Access Objects are written, there are many DAOs in each application, each DAO have many methods, and all these methods have similar code - open database connection, execute query, set parameters, iterate through ResultSets, set data for value objects... These kinds of code are written over and over again, for each method in each DAO, only slightly different from each other. Confucius provides a generic DAO class for all these.
2. To extract non-generic, business/application specific information into XML. SQL queries, business validations, business logic, workflow logic are all extracted into XML configuration files. In other words, use declaration instead of programmatic approach to build your middle tier.
3. To minimize the effort and greatly reduce the time to deliver simple projects. If desired, applications can be built without a single line of Java code. XML will be used to configure generic DAOs, BOs and Facade Service Objects to build the application. For more complex applications, you can build the Facade Service layer programmatically, while use declarative approach to build DAO and BO layers. Default transaction handling is provided for non-distributed transactions.
Some other features of Confucius
1. 0% server side coding required for simple applications, ideal for small applications that requires a middle tier for database retrieval and updating
2. Minimizes middle tier development time
Easy to use, easy to maintain (especially if u are familiar with Avalon Framework, or other Avalon based Framework)
3. Components are exchangeable, extendable and scalable. For example, it will be much easier to convert from all direct SQL based DAOs to Stored Procedure based DAOs by using Confucius Framework
4. Extensive use of J2EE design patterns
5. Based on Avalon framework
6. Transaction enabled
7. Contract between client and server are clear without documentation, they are specified in the XML file
1. J2EE developers who are looking a Struts like Framework for the middle tier based on J2EE design patterns
2. Developers who prefer generic, reusable, extendable, scalable component based coding style
3. Developers who don't like their SQL scripts or other similar logic hard coded into their Java Classes
4. Developers who are troubled by the repeated code exist in most applications: repeated code of DAO operations - open/close Database connections, loop through ResultSets, put data in Value Objects, etc.
1. Middle tier applications that uses DAO, BO and/or Facade Service layers
2. Ideal for small applications that requires a middle tier for database retrieval and updating, who doesnt want to spend too much effort on the middle tier, but still want quality code that follows the best practices use of design patterns, loose coupling, separation of concerns, etc.
Confucius has been submitted as an open source project on sourceforge.net. It can be downloaded at http://sourceforge.net/projects/confucius/
- Confusius by Henrique Steckelberg on February 06 2004 15:05 EST
- Questions by Renat Zubairov on February 07 2004 12:51 EST
- good thinking for the project name... by wx lin on February 09 2004 00:02 EST
- Questions by aftab hussain on April 14 2004 06:17 EDT
(Warning: joke inside!)
Mark this as noisy, but I couldn't resist... Guess there are so many frameworks out there it's getting harder to name them properly these days! :)
Now seriously: any chance of seeing an IDE module for this framework? I'd love to be able to create those XML configuration files inside an editor, press "the-running-man" ;) button, and have a simple system ready to run!
Sounds like a good idea! The editor idea probably should be added to the to-do list once other more basic functions are in place. Thanks for the comment. About the name, you are not the only one to make a comment about it, someone else asked me why is it named that way, I guess you are right, running out of names since there are too many Frameworks! :)
I found this when I went to look for the meaning of Confucius ..
Thanks for clarify the meaning of Confucius. He is the most important philosopher in Chinese history (actually Eastern Asia). His teaching, Confucianism, is followed by Chinese, Korean, Vietnamese, and Japanese for a couple thousands of years, until current day. That is one of the reason I picked his name as the Framework's name since he is so famous.
I have some questions concerning usage and benefits of the framework. Let me start from main features:
1. DAO ... iterate through ResultSets... Connections... etc - could you explain me the difference between "generic" DAO and ORM tool?
2. To extract non-generic, business/application specific information into XML....... declaration instead of programmatic approach etc. How standart is XML description language?
3. The same feature as number 2. The same question.
Good questions. Let me try to answer them:
1. ORM Tools maps relational database to Objects, usually by generating many Classes. It is a good approach in many situations. But sometimes it is hard to do this mapping, especially for readonly data that joins mulitple tables. Also, sometimes too many Objects could be generated to satify all the requirements. A slight change of the requirements also require the code change and regeneration of Classes. Confucius uses a Map like Class to hold data, only this generic Class is needed. SQLs are defined in XML. Thus a change in requirments you only need to change the SQL definition. Basically, Confucius make it simpler in my mind. Of course, ORM and EJB are very useful in many situations, Confucius provides an alternative to ORM and EJB, not a replacement.
2. You are right, XML itself is not a standard. But by extracting all these logic make the maintainence much easier - for example, when the requirments are changed sometimes you can just change the XML definition to satisify the requirement change. Just like in Struts, XML are used to configure a major portion of the application: exception handling, application flow, even ActionForm definition.
and I believe your Database accessing Object Program can will be Lao Tzu
I think Confucius could be a possible candidate for our project. I would like to ask you some questions to help me with my evaluation.
1. Can only configure a single data source such as JDBC, I want to select from a list of different data source types at runtime.
We have a parser that reads in data from a file, also need to support JDBC and hibernate data sources. I know the DAO
pattern provides support to create different types of data sources via a factory. Not clear how I can achieve this in Confucius.
2. Why is Confucius based on the Excalibur container? My understanding is Avalon provides a framework api for containers. On
the apache site they recommend to use Merlin implementation for the container NOT Excalibur.
3. How easy will it be to partition confucius into distributed tiers for lets say service and domain layers?