This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Difference between Component and Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Difference between Component and Class" Watch "Difference between Component and Class" New topic
Author

Difference between Component and Class

Required Field
Ranch Hand

Joined: Jan 03, 2006
Posts: 39
Originally posted by Sanjay Bahal:
Any good UML book should tell you about component diagrams.
UML User Guide by Grady Booch et. al has a chapter on Component diagrams.
The key is basicaly undersatnding what is component and how is different from a class.
HTH
Sanjay


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!
[ July 16, 2008: Message edited by: Required Field ]

Sun Certified Enterprise Architect
Ricardo Ferreira
Ranch Hand

Joined: Feb 13, 2006
Posts: 156
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,


Ricardo Ferreira,<br /> <br />Sun Certified Enterprise Architect<br />IBM Certified SOA Solution Designer<br />IBM Certified RUP v7.0 Solution Designer<br />IBM Certified Specialist for RUP v2003
Required Field
Ranch Hand

Joined: Jan 03, 2006
Posts: 39
Thanks Ricardo... that made things a lot clearer!

Originally posted by Ricardo Ferreira:


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,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between Component and Class
 
Similar Threads
Class versus Component diagram
Component Diagrams
when to draw component diagrams (according to Cade's book)
What's the purpose of Component Diagram
Class vs Component diagrams: Level of detail & scope