Originally posted by Akshay Shrivastava:
Can anyone please explain to me the difference between a Component and a Class ?
If EJBs are Components and are to be shown on the component diagram, then what do I show in the class diagram?
Also, is it necessary to draw out the internal structure of each EJB in a diagram? So for e.g. if I have a CustomerEJB (entity bean), then is it sufficient to just show it as a component on the component diagram [with a stereotype of <<entity>> ] OR do I have to also break down its internal structure [CustomerRemote, CustomerHome, CustomerBeanImpl, ejb-jar.xml etc]?
Isn't the internal structure of an EJB implicit here? I mean if I am designing a J2EE solution somethings are just plain implicit and should be assumed to be 'understood' by the readers/audience. That way I can effectively reduce clutter on my diagrams... Right/Wrong?
Thanks all!
[ February 20, 2006: Message edited by: Akshay Shrivastava ]
Hi Akshay,
The main diference between classes and components, are the system independence for them. A class is builded to perform a specific task in an application. Represent a entity, perform a service as an query or updating a database ... something like that.
But, you try reuse this class, in another application,
you should try some problems adapting your class for the destinarion enviroment. This is because your class has been designed to a specific system.
An component, are a kind of set of classes, that has a common interface, and the most importante feature: This classes, realize this interfaces. This approach can make your component more reusable, having context independence.
When you were a child, did you play with PLAYMOBIL ?
PlayMobil has a very good game. You could buy the Pirate PlayMobil, and use their pieces with Racer PlayMobil. This is because the pieces, had a common interface. And, they are pluggable. So, if you can reuse some class, in diferent situations, context's and/or systems, this class without doubt, is a component.
An complex system the work with components, can be updated justing replacing some components for anothers, without cause any impact.
Resuming: A class is just a piece of code to perform a specific key of the application. The component are the same, but, because yhour interfaces, they could be reused.
Best Regards,