Page 1 of 1

What is a Package?

Posted: Fri Aug 04, 2006 10:10 pm
by Ollie Saunders
I never really completely understood what a package is.

Are they just a class-hierarchy that solves a specific problem?
What is the difference between a package and a specific framework?
Are there naming conventions for packages?
When and where do you use @package phpdoc?
PEAR uses packages, is a PEAR package any different from a normal package?
Is a package exclusive to PHP?
Does a package only feature source code?

As you can see I'm rather confused.

Posted: Fri Aug 04, 2006 10:19 pm
by Ambush Commander
According to Wikipedia, a package is either a software installation executable (not applicable) or a Java construct that simulates namespaces and groups similar/related classes together.

To me:

properties/methods < classes < packages

Classes can be tightly coupled together, but a package is a fairly opaque supersystem of these classes.
Are they just a class-hierarchy that solves a specific problem?
Yes.
What is the difference between a package and a specific framework?
A framework defines the architecture of a system. A package just sort of hangs out and says, "Hey, use me!"
Are there naming conventions for packages?
PHP doesn't have real namespaces, so I assume Packagename_Classes, although it may be fuzzy.
When and where do you use @package phpdoc?
Never used it.
PEAR uses packages, is a PEAR package any different from a normal package?
Not really, except that it's really, really, really easy to install, and has well defined dependencies to other packages.
Is a package exclusive to PHP?
Of course not!
Does a package only feature source code?
Nope. As PEAR demonstrates, it can contain documentation too! :-P

One final note: don't get too hung up on terms. They can mean many different things. Convention is more important.

Posted: Fri Aug 04, 2006 10:25 pm
by Christopher
I think the traditional meaning of a package is some software accompanied with a title, version number, license and possibly some vendor information. It does not need to be classes, but in some languages with actual Package object (e.g. Java) is ususally means a set of classes. I am sure that PEAR adds it own spin to the meaning. Also Linux package managers like RPM and APT add build and dependency information into the package.