The same reasons that object oriented programming benefits general
programming also apply to science and engineering applications.
These benefits include
- Enhanced reusability of
the code.
- Modularity makes the code
structure easier to understand and maintain..
- Encapsulation helps to reduce
the breaking of other codes when a change is made.
- Inheritance allows for enhancements of the code (see Chapter
4) in systematic manner.
OOP also provides particular benefits to science and engineering
programming. Since we think of many aspects of natural phenomena
as interactions among constituent parts, it follows that code objects
interacting with each other will allow for a more intuitive approach
to simulating and analysing natural phenomena.
Perhaps this is especially applicable to physics, as we discuss
in the Chapter
3: Physics section, where theory reduces complex physical systems
to their essential parts, such as fundamental particles. These parts
naturally fall into object descriptions when simulating these systems
in software.
Not only physics, however, but science in general usually attempts
to disassemble complex systems into simpler and simpler components.
Objects in simulations can represent these components in an analogous
manner. You then group these simple objects into composite objects
to simulate more complex systems in which the components interact.
For example, one could easily imagine a set of classes providing
the properties and structures of a group of proteins. These could
be useful to both chemists and microbiologists, who could use them
in their own programs for different applications.
Engineers in a similar way can use objects to represent the different
components that make up a complex machine or a group of machines
like a power plant. Each object representing a component of an engine,
for example, could act and interact like the real part.
OOP also emphasizes reusability. If a class is well designed, then
it can function in many different programs. A class representing
a
Inheritance (see Chapter
4: Java: Inheritance) provides also a natural way to model a
modified component by replacing the class that represented the original
component with an extended class that inherits the features of the
old representation while adding new and modified features to represent
the new component.
Latest update: Dec.15.2003
|