Page 1 of 2

is there is any difference between component and module

Posted: Tue Dec 19, 2006 7:24 am
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.

Posted: Tue Dec 19, 2006 7:35 am
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.

Posted: Tue Dec 19, 2006 8:19 am
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.

Posted: Tue Dec 19, 2006 11:09 am
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)

Posted: Tue Dec 19, 2006 11:25 am
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

Posted: Tue Dec 19, 2006 11:40 am
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 ;).

Posted: Tue Dec 19, 2006 1:31 pm
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.

Posted: Tue Dec 19, 2006 3:46 pm
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.

Posted: Tue Dec 19, 2006 3:47 pm
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?

Posted: Tue Dec 19, 2006 4:01 pm
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.

Posted: Tue Dec 19, 2006 4:03 pm
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.

Posted: Tue Dec 19, 2006 9:48 pm
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.

Posted: Wed Dec 20, 2006 12:29 am
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.

Posted: Wed Dec 20, 2006 4:22 am
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.

Posted: Wed Dec 20, 2006 6:29 am
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.