Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is component oriented programming in Java?

I need to learn about component oriented programming in Java, i believe that this is related to EJB's but i am not sure about that... Is this true ?

Please could you give me some links related to component oriented programming in Java to have a start point about it ?

Thanks !

like image 804
Mirel Avatar asked Feb 09 '11 16:02

Mirel


People also ask

What is component-oriented programming?

Component-oriented programming promotes black-box reuse instead, which allows you to use an existing component without caring about its internals, as long as the component complies with some predefined set of operations or interfaces.

What is component-oriented design?

Simply put, Component Based Design is a process built on dividing a user interface into a collection of manageable (and most importantly, reusable) parts that then are used to create an end result (page or app screen).

What is component-based programming paradigm?

Component-based programming is about how to create application programs from prefabricated components with new software that provides both glue between the components, and new functionality.

What is COP programming?

The C Object Processor (COP) was a superset of the C programming language. It was used in the Vbase object-oriented database management system developed by Ontologic, Inc.


2 Answers

Component oriented programming is a method of decomposing a problem into major sections ("components") each which has a particular role or domain of responsibility in solving the problem.

Businesses are somewhat component oriented as the consist of departments "accounting", "purchasing", "sales", which have full domain over certain tasks which the business needs to provide.

The differences between object-orientation and component orientation are ones of scale and re-usability. Object oriented thinking tends to focus on the tight integration of small objects, where objects are reused across an entire software offering. Component oriented thinking tends to focus on silos of responsibility which operate mostly independently and may or may not share common objects with other components.

JDBC database drivers are a good example of Component oriented thinking (implemented in an object oriented world). You don't care which database driver you code against, or the details of the database communications, as your component (The JDBC driver) handles all of that internally.

The different types of EJBs are also components. For each problem you wish to solve, you should be selecting the J2EE component that provides the correct general approach, and then extend it to provide the necessary details of the solution.

For example, if you wished to display a java generated web page, you would use a J2EE HttpServlet component, which would ensure it would fit into a J2EE Servlet Container that would handle all the plumbing of receiving HTTP requests, decomposing them into Java Objects and method calls, directing them to the correct container, gathering the output from the correct handler via the container, composing the output into HTTP responses, etc.

like image 150
Edwin Buck Avatar answered Oct 31 '22 07:10

Edwin Buck


Let's use electronics as an example: all electronic devices are composed of components (transistors, resistors, diodes, capacitors, ...) A component is just a part of something bigger. A component can be of poor quality and of high quality. High quality components have features like:

  • well-specified interfaces (e.g. wires on transistor), and behavior (transistor current/voltage characteristics)

  • encapsulation (you don't have to understand how trasistor was built to use it)

  • well documented (you can find transistor's docs on vendor's webpage)

  • reusable (you can use the transistor to build many interesting devices)

  • replaceable (you can replace transistor made by one company with similar from other)

In software world a component can be almost everything: a class, JavaBean, Enterprise Java Bean, applet, portlet, JAR, web server, application server, database server, web service, ...

More on this here: http://en.wikipedia.org/wiki/Component-based_software_engineering

like image 31
iirekm Avatar answered Oct 31 '22 06:10

iirekm