I devlopp web applications with Zend Framework.
For now, I have a huge library, wich contains each an every things, used by a couple of web applications. I am thinking of reorganising it, using the concept of “Module”.
But I am not sure about the difference between Module and Package.
What I understand is :
- a Module contains a part of a web application (pages, models…)
- a Package is a group of class in the library
Am I seeing it right ? And how to know where should go my classes (model of a module, or library) ?
Because for example, I have some classes to do the translations. I have “model” classes, to represent a language, a text and its traductions… And I have kind of an “API” class that is just here to translate a string into a language. I would say that I need a module for the model classes and the web interface to edit the traductions, and the API class would go in the library ? Is that right ? Isn’t that weird to have 2 kind of classes, one for the module and one for the library.
I guess that’s an open question about API, librairie and application architecture.
Modules, in the ZF sense, group concrete, often standalone, application parts:
A package on the other hand is a set of classes in a code library that conceptually belong together. For instance, ActionHelpers and ControllerPlugins conceptually belong to the
Zend_Controllerpackage. All available Validator classes belong to the packageZend_Validate.When using PHPDocumentor you can annotate your code to belong to packages. If you look at ZF’s API Docs, you will see this grouping in effect. Try to find the
Zend_Validate_Alphaclass.See