EJB design: bmp or cmp or jdo??
i would like to ask some questions on the popularity of methodolgy of j2ee design:
1. in a real life enterprise application, which entity object would have a high popularity? bmp or cmp or jdo??
i hv read many books on j2ee and most books suggest to use cmp, but i have once ask a system manager and he said in fact developers would use bmp instead because they would like to have full control in the entity object. so, which one has a higher percentage using in enterprise application?? and how about jdo??
2. in design an enterprise application, most of developers would use some design pattern, such as command pattern, session facade. books on design pattern have describe a lot design pattern but i don't think they all will be applied in the system development? can anyone tell me which design pattern(s) are widely used?
3. for small-to-medium enterprise application, which application server and database are widely used?
4. again, for large enterprise application, which server and database are widely used?
5. for user login design, would developers use LDAP to record user detail or store the user information directly in database??
6. what login security technology would system developer use in authenication?? JAAS or another??
it would be thankful if anyone could give me some replies or experiences in the questions about.
- bmp or cmp or jdo?? by Matthew Wilson on May 20 2004 08:55 EDT
- thx by jason hui on May 20 2004 13:46 EDT
- J2EE experiences... by Mike B on May 27 2004 15:01 EDT
In a real life enterprise application, which entity object would have a high popularity? bmp or cmp or jdo??Up till one year ago I used bmp the most (I wanted the controll). Now I am using Hibernate (a jdo like product), and I will never go back to bmp or cmp.
Can anyone tell me which design pattern(s) are widely used?On a scale of 1 - 10 where 1 is never and 10 is always. I have done mostly large scale J2EE projects. This is of cours just my usage of patterns. You might want to take a look at the patterns thread:)
Abstract Factory (10)
Factories are a very basic idea and several patterns relate to them. A factory is any class/method whose responsibility is to create objects.
Go4 description: Separate the construction of a complex object from its representation so that the same construction process can create different representations.
Factory Method (10)
Go4 description: Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
Go4 description: Specify the kinds of objects to create using a prototypic instance and create new objects by copying this prototype.
Go4 description: Ensure a class has only one instance and provide a global point of access to it.
Go4 description: Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
Go4 description: Decouple an abstraction from its implementation so that the two can vary independently.
Go4 description: Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
Go4 description: Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
Go4 description: Provide a unified interface to a set of interfaces in a subsystem. Façade defines a higher-level interface that makes the subsystem easier to use.
Go4 description: Use sharing to support large numbers of fine-grained objects efficiently.
Go4 description: Provide a surrogate or placeholder for another object to control access to it.
Chain of Responsibility (5)
Go4 description: Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle a request. Chain the receiving objects and pass the request along the chain until an object handles it.
Go4 description: Encapsulate a request on an object, thereby letting one parameterise clients with different requests, queue or log requests, and support undoable operations.
Go4 description: Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
Go4 description: Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
Go4 description: Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets one vary their interaction independently.
Go4 description: Without violating encapsulation, capture and externalise an object's internal state so that the object can be restored to this state later.
Go4 description: Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Go4 description: Allow an object to alter its behaviour when its internal state changes. The object will appear to change its class.
Go4 description: Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Template Method (2)
Go4 description: Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.
Go4 description: Represent an operation to be performed on the elements of an object structure. Visitor allows one to define a new operation without changing the classes of the elements on which it operates.
See: http://www.cs.jhu.edu/~scott/oos/lectures/designPatterns.html for details on the GO4 patterns.
For small-to-medium enterprise application, which application server and database are widely used?I use jboss/mysql for for small J2EE apps that need a ejb/jms container.
I use tomcat for for small J2EE apps that need just a web container.
again, for large enterprise application, which server and database are widely used??Weblogic/Oracle.
For user login design, would developers use LDAP to record user detail or storeThat depends... If you have no requirements for LDAP, and you already have a relational database, use that. Of courds you can use JASS to abstract this:)
the user information directly in database??
I agree with Matthew on light-weight persistent frameworks. I have not used entity beans outside of a prototype or training environment.
Can anyone tell me which design pattern(s) are widely used?I mostly agree with his list of patterns. The following are definitely used all of the time, and every developer should be familiar with them.
Abstract Factory (10)
Factory Method (10)
I almost never use Bridge, though, and I frequently use the "Adapter" pattern. It depends on the kind of work you do. I spend a lot of time working on other peoples systems, and I often have to coerce the existing API into working in new ways. In that case, the Adapter pattern is a must, to "fake" one class with another new class created by me.
I also use "Chain of Responsibility" a lot, mostly with Servlet filters.
first, thx for matthew's experience sharing. these are invaluable advices to me.
after reading the replies, i hv a new question to ask.
1. matthew had said he used bmp rather than cmp. i understand bmp can hv full control, but why people, especially book authors, recommend cmp to be use?? i m quite confusing at this point. does the real application really different from what the books said? is bmp more popular than cmp???
2. matthew had said he has now working with hiberate, so, is it more and more people have already altered their development style from bmp to hiberate (or jdo) which is what we so call POJO?? does the situation happens in large scale application development?? or just in small scale??
If you want to be able to try out some different persistence technologies side by side you could use FireStorm/DAO to generate your DAO code from your database schema and choose between JDBC, EJB, JDO implementation.
First of all, thanks Paul for mentioning the adapter pattern, I meant to type a 10 there :)
1. matthew had said he used bmp rather than cmp. i understand bmp can hv full control, but why people, especially book authors, recommend cmp to be use?? i m quite confusing at this point. does the real application really different from what the books said? is bmp more popular than cmp???I have a few reasons why I use bmp
1) I have had a bad experiences using cmp ever since the spec came out. But have I have not tried using it in the past 1 1/2 (I have given up). EBJ vendors may have improved performance... But its too late for me.
2) I want my design to be OO, that is dificult with cmp.
2. matthew had said he has now working with hiberate, so, is it more and more people have already altered their development style from bmp to hiberate (or jdo) which is what we so call POJO?? does the situation happens in large scale application development?? or just in small scale??thx.I think it is happening in the small scale a lot, and it is starting to be seen in the large scale a little more. I currently use session beans or a pojo facade with hibernate as my persistence layer.
Can give you my general experiences on J2EE projects...
1. in a real life enterprise application, which entity object would have a high popularity? bmp or cmp or jdo??On my last project we used EJB Session Facade to a POJO / DAO layer. Like Matt I like a OO approach that you can't get with EJB.
2. in design an enterprise application, most of developers would use some design pattern, such as command pattern, session facade. books on design pattern have describe a lot design pattern but i don't think they all will be applied in the system development? can anyone tell me which design pattern(s) are widely used?Matt and Paul list many OO design patterns that are excellent.
Some commonly used "J2EE patterns" to consider are:
1. MVC - pattern used to separate the presentation (view) from work flow(controller) and
business logic/data (model)
2. Session Facade - in J2EE use a Session Bean to talk to Entity Beans or generally provide a coarse grained interface to act on more fine-grained set of objects.
3. Business Delegate - used to encapsulate access of distributed objects
4. Value Object/Data Transfer Object (DTO) - used to transfer data attributes in a single serializable class
5. Service Locator - used to encapsulate lookup of distributed objects
6. Data Access Object (DAO) - used to encapsulate access to data
Check out Sun site for catalog
...which application server and database are widely used?...I have been on many projects and used multiple J2EE application servers from Tomcat, JBoss, WebSphere, WebLogic, O9iAS, and EAServer... these have generally been dictated by the client. Especially true on medium to large projects.
For small stuff the open source makes a lot of sense - the small company I used to work for wrote its Time Tracking system using Tomcat, JBoss, and MySQL for example.
I have seen Oracle DBMS used on the vast majority of projects I have been on.
Hope that helps.