is there is any difference between component and module

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

is there is any difference between component and module

Post by raghavan20 »

i thought so far component and module are the same but i see sites like joomla which have separate download sections for components and modules but i cannot find the difference between the two.

can anyone help me understand these?

Thanks.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Generally they are the same to most people that I've talked to. If memory serves, Joomla has them segregated to help define what a particular plug-in is capable of or rather what it's meant to interact with.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I would consider a component as a single unit of code (i.e. a class) which provides functionality internally. A module would possibly be made up of such units to provide functionality to the end-user (whoever that may be).

For example, you might provide a PDF component which doesn't provide the user with anything directly, it just creates PDF documents. You could then use that component to make a PDF Reporting module which does actually provide the end-user with the tools *they* need to create a report themselves. That's probably a pretty poor example :oops:

That's just my take on it anyway; I'm sure it's quite a subjective topic.
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

d11wtq wrote:I would consider a component as a single unit of code (i.e. a class) which provides functionality internally. A module would possibly be made up of such units to provide functionality to the end-user (whoever that may be).

For example, you might provide a PDF component which doesn't provide the user with anything directly, it just creates PDF documents. You could then use that component to make a PDF Reporting module which does actually provide the end-user with the tools *they* need to create a report themselves. That's probably a pretty poor example :oops:

That's just my take on it anyway; I'm sure it's quite a subjective topic.
what do you call your swiftmailer as module or component? 8)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

raghavan20 wrote:what do you call your swiftmailer as module or component? 8)
Neither. It's a library.
Swiftmailer.org wrote:Swift is a fully OOP Library for sending e-mails from PHP websites and applications. It does not rely on PHP's native mail() function which is known for using high server resources when sending multiple emails. Instead, Swift communicates directly with an SMTP server or a MTA binary to send mail quickly and efficiently.
Image
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Component is a loose term, it merely refers to any part of a system which can be separated from the whole. In that respect, the engine is a component of a car, just as a spark plug is a component of the engine. I guess the most likely interpretation is just what was said above - a component is a singular entity such as a class, or even a family of classes dedicated to a specific task.

A module on the other hand seems more a "group" term which can be viewed as more of an extra addon to a pre-existing system than a necessary part of the core.

It's more likely that component will refer to a necessary piece of a system - something it requires to function, than a module which is more likely to be used for optional extras, i.e. the car cannot function without the engine, and the engine cannot function without spark plugs... But everything can work whether you have stereo system hookable to an iPod or not - that part is purely optional, it just adds value.

Of course, since it's all interpretative, you could throw everything I said out the nearest window and still be right ;).
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

I think a module is simply a separate bunch of code that has an interface -- whether that is a class or a library or what ever -- they are all modules. A component is a specific kind of module that meets certain rules, of which I think specific OO qualities like independence, opacity and composablity are probably the most important.
(#10850)
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

feyd wrote:
raghavan20 wrote:what do you call your swiftmailer as module or component? 8)
Neither. It's a library.
Swiftmailer.org wrote:Swift is a fully OOP Library for sending e-mails from PHP websites and applications. It does not rely on PHP's native mail() function which is known for using high server resources when sending multiple emails. Instead, Swift communicates directly with an SMTP server or a MTA binary to send mail quickly and efficiently.
Image
feyd you are confusing me more. library also helps to do achieve some objective. but most of the times, libraries can solve more than one objective but PHPMailer or Swift Mailer is concentrating on sending mails out and that is one objective which is a more a component.

component provides interfaces to get services and libraries do have interfaces may be not so good as components.
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

arborint wrote:I think a module is simply a separate bunch of code that has an interface -- whether that is a class or a library or what ever -- they are all modules. A component is a specific kind of module that meets certain rules, of which I think specific OO qualities like independence, opacity and composablity are probably the most important.
hello aborint, what exactly do you mean by interface here?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

To summarise what's been said so far:

A component is any "unit" of code which you can pull out of an application
A module is a complete set of components which provides an interface to performing some operation
And ermm, Swift is library (but how do we define a library)

So we'll refine a bit :)

Component -- pretty loose term very subjective. A bit of code.
Module -- specific to an application. It's unlikely you'll take a module from one app and use it as-is in another app. Often with a front-end.
Library -- A set of tools which provide a clean interface to performing specific, often complex tasks. Not specific to an application, and probably without any front end since it's targeted at developers. Quite a low-level tool.

EDIT | By interface, we just mean any way to "interact" with the code. Most people would think of a user-interface, but a class also has an interface which is used by the developer. i.e. The API for it.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

raghavan20 wrote:hello aborint, what exactly do you mean by interface here?
I use it in the most essential sense -- that the functions, classes, vars and constants that need to be accessed to use the code within the module are a defined thing. Whenever you separate out some code and say, "I'm only going to access it this way" then you have a module. A module also hopefully has clear dependencies.

I think the term component implies the next step past library. A library is a module but its interface is usually unique to itself. The idea of a component is that you build many libraries that share some common interface concepts. That theoretically enhances their usefulness because you can create things like adapters more easily for them.
(#10850)
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

Well you're all discussing two of three architectural building blocks. What about the connectors? Personally, I think of components as fuzzy design elements and modules as the implementation ... well at least in terms of software architecture.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

It is interesting that the most think that component is a loose and fuzzy term. I guess when I think of components I think of things like COM and CORBA that take modules/libraries to the next level by defining interfaces that allow interoperability even across language boundaries.
(#10850)
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

have you guys seen this article from o'reilly.

This is a requirement for a Java component.
a component must satisfy the following requirements:

* A component must have a service interface (API) so that other components can interact with it.
* A component should have a proper life cycle mechanism (start, stop, initialize, etc.).
* A component should be configurable.
* Only one instance of the component should run in the enterprise.
* Changes in the configuration should be dynamic (on the fly).
* A component should have a proper third-party integration mechanism.
* A component should have a proper error-handling mechanism.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Is this a brain teaser topic? :)
component noun any of the parts or elements that make up a machine, engine, instrument, etc. adj functioning as one of the parts of something; constituent. componential adj.
ETYMOLOGY: 17c: from Latin componere to assemble into a whole.
Outside that you're into murky water where anyone can ascribe it any "parts of" idea.
Post Reply