Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class vs component

 
Abhinav Srivastava
Ranch Hand
Posts: 354
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In many places I have seen JSPs and Servelts being presented as Components. Even EJBs qualify to be called components but they are usually represented as stereotypes not components.

How do components fit into Sequence diagrams, as traditionally we use objects in interaction diagrams. I know you can argue that a component may be an object in itself (for the purpose of clarity or otherwise), but then a component can also be represented as a class.

What advantage do Components have over Classes?
 
Marcus Jastrebowski
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From what I have seen so far in various literature, the term "component" does not have precise definition. Just as you mentioned, I have seen a jsp page referred to as a component; but I have also seen a collection of classes defined as a single component. The term 'component' can be pretty much anything, and therefore it conveys very little useful meaning. At least to me. Anybody, please correct me if I am wrong in this.

Also, you can read what wikipedia crowd have to say about it.

I particularly like this statement:
A component is an object written to a specification. It does not matter what the specification is...


[ February 23, 2008: Message edited by: Marcus Jastrebowski ]
 
Abhinav Srivastava
Ranch Hand
Posts: 354
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess a Class may not convey that the JSP actually is presenting both Static and Dynamic content, i.e. you have one user interface (html) and another uer-interface generator (class). In "Developing Enterprise Java Applications with J2EE� and UML (by Khawar Zaman Ahmed; Cary E. Umrysh)" this distinction is spelled out in class and sequence diagrams.
Not sure about servlets/ejbs..
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Component is a monster word. Almost everything can be a component.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A component is replaceable unit, a kinda plug-in.
 
Anderson Fonseca
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, a component can be since a smallest piece of code, where you can reuse in many situations, to a complete system.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ankur rathi:
A component is replaceable unit, a kinda plug-in.


This definition has a problem, what is a unit that *cannot* be replace?

By this definition, a component can almost be anything.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anderson Fonseca:
I think, a component can be since a smallest piece of code, where you can reuse in many situations, to a complete system.


JSPs can be a component, an enterprise bean can be a component, a module can be a component.

But I think a complete system is too large to be a component.
 
Abhinav Srivastava
Ranch Hand
Posts: 354
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
J2EE Components

J2EE applications are made up of components. A J2EE component is a self-contained functional software unit that is assembled into a J2EE application with its related classes and files and that communicates with other components. The J2EE specification defines the following J2EE components:

Application clients and applets are components that run on the client.
Java Servlet and JavaServer Pages (JSP) technology components are web components that run on the server.
Enterprise JavaBeans (EJB) components (enterprise beans) are business components that run on the server.

J2EE components are written in the Java programming language and are compiled in the same way as any program in the language. The difference between J2EE components and "standard" Java classes is that J2EE components are assembled into a J2EE application, are verified to be well formed and in compliance with the J2EE specification, and are deployed to production, where they are run and managed by the J2EE server.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic