• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is a component?

 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a hot debate going on my company about what is a component?

According to traditional definition component is a collection of classes, can exist stand alone and it has its own life cycle.

According to Sun, Servlet, JSP, EJBS are component. They are not fitting to the traditional component definition, and it confuses me?
 
arulk pillai
Author
Ranch Hand
Posts: 3388
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no clear cut definition and always debatable. The way I see it..

Q. So what is the difference between a component and a service?

A component is an application level software unit like JSF component, EJB, Applet etc. All the J2EE components depend on the container for the system level support like transactions, security, pooling, life cycle management, threading etc. A service is a component that can be used remotely through a remote interface either synchronously or asynchronously (e.g. Web service, messaging system, sockets, RPC etc). A service is a step up from �distributed objects�. A service is a function that has a clearly defined service contract (e.g. interface, XML contract) to their consumers or clients, self contained and does not depend on the context or state of other services.
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The definition very specific to java, it still doesn't explain the traditional definition of components(which is normally collection of classes).

I am not sure what path I will take when I will write component of my system. Does my .war file(according to traditional definition) is a component or servlet(according to java) is a component.
 
Abhinav Srivastava
Ranch Hand
Posts: 354
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a component is a replaceable unit.
 
Ricardo Ferreira
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Essentially, a component could be defined as a replaceable unit that provides adhoc connections by well defined interfaces. But, besides that, a component has a special talent to be reusable by any context, instead that environemnt that it was originally created.

For example, a class could have interfaces and by those interfaces, could be replaceable, since changing its implemention would not create any impact in the consumer artifact, since the interfaces are immutable. But are this class really reusable? The experience says that: No, classes are created to solve any particular problem.

A component, instead, is a kind of classes that could live and be executed at at execution environment that supports the 3'C concept:

- Container
- Conector
- Component

A shorter example of a truly component could be the CORBA objects. Since they have formal interfaces and are executed in a common environment (the container) it is really reusable. I can create a CORBA object in C++ and use that object at a Delphi program running the CORBA execution environment.

Another example of an component is the EJB's. They are essentially classes, that are used by formal interfaces. The diference is the container and the conectors that provide the capatibility of be executed at any particular EJB container that are aligned with the EJB specification. Servlets are, by this point of view, another example of truly components.

Based on that concept, Sun sees J2EE artifatcs as components, because the 3'C architecture provide that capatibility.

Regards,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic