
classes as modules. please explain?
i found this on
“Object-Oriented Software Construction” by Bertrand Meyer.
Classes as modules
Object orientation is primarily an architectural technique: its major effect is on the modular structure of software systems.The key role here is again played by classes. A class describes not just a type of
objects but also a modular unit. In a pure object-oriented approach:
In particular, there is no notion of main program, and subprograms do not exist as independent modular units. (They may only appear as part of classes.) There is also no need for the “packages” of languages such as Ada, although we may find it convenient for management purposes to group classes into administrative units, called clusters.
I don’t understand it THAT much. I want it to be crystal clear. Can anyone please explain?
Thank you!
How to explain it in a better way? I could try with an example of a car.
Modulization (modular):
Pretend you want to make a computerised car. Now, a car has:
- wheels
- doors
- seats
- engine
- gearbox
etc
So, instead of just making a car class, you may want to make different modules representing the different aspects of a car. So you would make modules that are:
- wheels
- doors
- seats
- engine
- gearbox
etc
Then the car class would probably have these modules inside it to make a complete car.
Packages:
Normally you use a package to contain modules or classes that are relevant to one another in some way.
So you may want to make a package that contains the classes and modules that relate to a car.
Then you may make something like a house, with doors, windows, rooms, etc. You would have all of these classes in a package that relate to a house.
With these packages, you could differentiate (tell the difference) between the car doors and the house doors.
3D Plant design – walkaround done by Kraftanlagen Heidelberg GmbH with Plant-4D, www.cea-int.com
