Archive

Archive for August, 2008

Design approaches

August 25th, 2008 No comments

Here is another memento I wrote to remember the different approaches when writing EJB 3 or Web services.

TOP DOWN BOTTOM UP IN THE MIDDLE
EJB 3 Develop entity beans first then derive db schema Develop db schema first and drive upwards to create entity beans from your schema Create entity beans and db schema and map both respectively
Web Services contract first : in the top-down scenario, the developer first creates or is given the WSDL file for the service, and then must create a component to implement the operations. First you create a Java bean or EJB bean and then use the Web services wizard to create the WSDL file and Web service. In this case the starting point consists of both the WSDL file and the implementation component, and the developer must create additional support code that maps between the two.

http://en.wikipedia.org/wiki/Top-down

Categories: Architecture Tags:

Aggregation and composition in Java

August 23rd, 2008 No comments

I usually forget the differences between the composition and the aggregation relationships and mix them together, so here is a memento that i will share with everyone.

  • Composition : a filled diamond
  • Aggregation : an unfilled diamond

The relation between a car and a tyre is an aggregation because the tyre is still a tyre if it is not attached to a car. The tyre has a life of its own. It exists outside of a car and you can use it on another car.

The relation between a car and a carburetor is a composition because the carburetor has no use if it is out of a car.

Aggregation and composition in Java

Now more interesting is the implementation in Java of these 2 relationships :

Aggregation :

class Car {


}

class Tyre {

private  car = new Car();


}

Composition :

class Carburetor {


}

class Car{
Carburetor  carburetor = null ;
public void setCarburetor( Carburetor  carburetor )
{
this.carburetor = carburetor;
}


}

Categories: UML Tags: