>1. Are people actually following this theory?

"The state of an object must always be consistent"
This an important Rule in OO.

But what does "consistent" means?

The EJB constructor is empty because the state of an EJB is initialized
in the ejbCreate method and by the container.

So, a non-initialized EJB is "Consistent" for the container,
but not for the client. A non-initialized EJB cannot be accessed by the
client.

The situation is the same for an Applet or a Servlet, for any kind of
component deployed in a container: the semantic of "Consistent State" is
dependent of the point of view:
  - A non-initialized component is consistent for a container. It's up to
    the container to initilize the object state.
  - A non-initializer component is not consistent for the client: the
    container must insure that no client will access a non-initialized
component

>2. Doesn't the JavaBeans (non-ejb) requirement for a zero arg
>construcotr
>kill this idea?
See 1. idem

>3. In EJB (where ejbCreate actually allows arguments) are
>people using this
>startegy?
See 1

>4. Say you have an ejb with 25 instance variables, 5 of which have
>reasonable default values, would you create an ejbCreate method with 20
>arguments?
No!

So fields can have default values.
Such as, the default engine type for a car may be "V6 engine".
You need to pass only the PK and the mandatory values. These fields are
usually marked as NOT NULL in the DB.

Another solution in the ejbCreate is to use a stateholder:

public interface CarHome {
        Car create(CarStateHolder state) throws ....;
}

The Stateholder object contains a serializable copy of the object state.

Hope this help
Tibo.

>
>Dave Ford
>Smart Soft - The Java Training Company
>http://www.SmartSoftTraining.com
>
>===============================================================
>============
>To unsubscribe, send email to [EMAIL PROTECTED] and
>include in the body
>of the message "signoff EJB-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to