1.)
Computer Central Processor Memory Display Colour ( ) Sound ( )
Is a Part of Spectrum Computers - No Monitors
Spectrum 16
Spectrum 48
Commodore Computers
Is a Part of -Special Tape Deck -Floppy Disk Drive
Amstrad Computers
C64
CPC 6128
Spectrum (128) SX164
Spectrum (+3)
CPC 464 Deck
C128
Spectrum (+)
Spectrum (+2)
- Monitor
2.) The diagram above presents a means for representing data and static relationships between the various classes. In my design, I have adopted a top down approach in representing the various classes, associated attributes and relationships. We have three classes of computers, ranging from Spectrum, Commodore and Amstrad with some basic attributes of commonality, by this I mean that irrespective of the model, they all have central processors, memory, the capability to display colour and generate sound. All these attributes have been defined in the super-class labeled computer, so that it makes it easier for each model of the different computers to reference this attributes instead of defining them separately for each sub-class. I have also tried to draw attention to certain attributes that are peculiar to a sub-class of computers and as such cannot be defined in the super-class (computers). An example of this is the fact that all models of the sub-class spectrum computers do not have monitors. For clarity purpose, we have defined certain attributes as being part of certain super-classes, primarily because these attributes are external and also deemed essential in purpose to the super-class. An example of this is the monitor which is part of Amstrad computers. My design also takes cognizance of the fact that each model of a particular class of computer is defined as being a kind of that super-class. For example, the spectrum 16 is a kind of the super-class of spectrum computers. The attributes of a class and their values define the state of each object that is created from the class. 3.) The diagram below, attempts to give a graphical and in-depth representation of some the relationships and attributes of the objects in question. It is pertinent to mention here that all the models of computers are objects in that they are all instances of the of the class diagram, with more insight into the peculiarities of their individual and collective attributes. Basically the diagram gives more detail of the class diagram above. My design has taken cognizance of the fact that each object has attributes that are peculiar, while some attributes are more of general nature and so can be referenced from the super-class instead of defining a separate instance. Each object also has behaviors that specify what the can do.
Computer Central Processor Memory Colour Display ( ) Sound ( )
Commodore 6502 Processor 5.25” Floppy
Z80 Processor
Spectrum No Monitor
Amstrad
Spectrum 16KRam Spectrum 48KRam
128k Ram Spectrum (+)
Spectrum (128)
Spectrum (+2) Integrated Cassette
Tape Deck Spectrum (+3) Integrated Floppy Drive
Is a Part of - Special Amstrad Monitor
C 128 128 Ram
CPC 464 Integrated Cassette Tape Deck 64k Ram
CPC 6128 Integrated 3” Floppy Disk Drive 128K Ram
Is a Part of Special Tape Deck Commodore Floppy Disk Drive
64K Ram
C 64
SX 164 -Display Screen Floppy Disk Drive
4.) The Concept of Inheritance Inheritance is used to define general class attributes. For all three types of computers they have general features, which are central processing units, memory, ability to display colour and generate sound. These are general set of attributes, and as such can be defined in the super-class of computers instead of defining it individually for the sub-classes. Generally classes are arranged hierarchically with the super-class on top of the sub-classes; sub-classes inherit appropriate attributes and methods from the super-classes above them. That is each sub-class contains attributes and method from its parent super-class. Inheritance makes it simpler to define classes instead of repeating attributes for each computer separately. Some of the advantages that can be derived from inheritance as regards the diagram above include; • • •
Less Redundancy Speed of creation of new classes Standards and consistency across development efforts.