63 lines
1.7 KiB
Markdown
63 lines
1.7 KiB
Markdown
|
|
---
|
||
|
|
layout: default
|
||
|
|
title: Objects
|
||
|
|
---
|
||
|
|
|
||
|
|
|
||
|
|
# Objects
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|
[Linnæan Taxonomy](https://en.wikipedia.org/wiki/Linnaean_taxonomy)
|
||
|
|
|
||
|
|
### Object Oriented Programming I: Class and Objects
|
||
|
|
|
||
|
|
#### A. [OO-NotePad](img/OO-NotePad.pdf)
|
||
|
|
|
||
|
|
Using the _OO-NotePad_ sheet, observe four (4) objects in your surrounding and formally describe them usign the following descriptors:
|
||
|
|
|
||
|
|
1. Name of the object
|
||
|
|
2. Visual diagram / representation
|
||
|
|
3. List of Attributes
|
||
|
|
+ Static -- an attribute that does not change (much) over time
|
||
|
|
+ Dynamic -- an attribute that changes aspect over time
|
||
|
|
|
||
|
|
|
||
|
|
Questions:
|
||
|
|
|
||
|
|
1. Is there an atribute that is common to all (or some) of your objects?
|
||
|
|
2. Do you see any familiarity between your objects?
|
||
|
|
3. Is there any hierarchical realtionship(s) that could be devise between your objects?
|
||
|
|
|
||
|
|
#### B. OO Modeling
|
||
|
|
|
||
|
|
Following your OO obervations, formalise your (paper) descriptions using the **U**nified **M**odeling **L**anguage (UML)
|
||
|
|
|
||
|
|
- [online UML editor](http://www.gliffy.com/uses/uml-software/) (note: please take screen shots of your UML design)
|
||
|
|
|
||
|
|
Questions:
|
||
|
|
|
||
|
|
1. Do you think the UML translates well your observation?
|
||
|
|
2. Do you understand the difference between UML's attribute and method?
|
||
|
|
3. Is your UML diagram readable?
|
||
|
|
|
||
|
|
|
||
|
|
#### C. OO Programming
|
||
|
|
|
||
|
|
Now that you have created a simple UML diagram of your objects, translate this diagram into code using a _class_.
|
||
|
|
|
||
|
|
class Name {
|
||
|
|
...
|
||
|
|
};
|
||
|
|
|
||
|
|
Questions:
|
||
|
|
|
||
|
|
1. How does your class relate to your UML diagram?
|
||
|
|
2. How does your class relate to your paper observation?
|
||
|
|
3. Was it easy to translate your UML diagram into code? What was ambiguous? What was not?
|
||
|
|
3. Is your class readable?
|
||
|
|
|
||
|
|
### Object Oriented Programming II: Polymorphism and Inheritance
|
||
|
|
|
||
|
|
|