Java Reference
In-Depth Information
How can I build a solution that can adapt to changes that have not yet been
anticipated? What does it mean to build a structure with flexibility in the right
places, without compromising reuse? A rigorous design can often be molded to
fit new conditions, without necessarily collapsing the original solution.
When you feel up to it, read the Design Patterns topic. It will provide unique as-
sistance in understanding complex problems and give you valuable insights into
building elegantly designed solutions.
Inheritance is another example of a design pattern. Inheritance allows you to
organize elementary functionality into your base classes. This functionality is then
extended in derived classes. However, all classes that inherit a super-type will sup-
port some form of the basic functionality . A consumer class can treat all objects of this
super-type as if they are the same. Important object-oriented design goals are met,
that is, the stable and generic portion of your solution is isolated (in the base class)
from the more dynamic and specific portion (in the derived class).
At the same time, these boundaries must be fluid. Derived classes may need to
enhance, or possibly supplant, functionality in the base classes, without compro-
mising the structural integrity of the system (i.e., without making things so com-
plicated that they become unmanageable). Since derived classes can override base
methods, derived classes can always extend existing method behaviors as needed.
I NHERITANCE , O BJECTS , AND COBOL
The simplest way to understand inheritance from a COBOL perspective is to imag-
ine that a subroutine's interface (that is, the items in its LINKAGE SECTION) can
be promoted into another subroutine's interface. Imagine that a subroutine (NEW-
SUB, for example) could pick one other subroutine (it must be a subroutine that
NEWSUB calls) and that that called subroutine's LINKAGE SECTION would auto-
matically become part of NEWSUB's LINKAGE SECTION. If NEWSUB did not
have a LINKAGE SECTION defined, then one would be automatically created for it.
NEWSUB COBOL
Here is a definition for a shell of a COBOL program named NEWSUB:
IDENTIFICATION DIVISION.
PROGRAM-ID. NEWSUB.
DATA DIVISION.
WORKING-STORAGE SECTION.
Search WWH ::




Custom Search