Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 4 - Elizabeth Solomon
What is Sketchpad?
Sketchpad is an object oriented graphic editor developed by Ivan Sutherland at MIT in 1963.
This program had master drawings and instance drawings. The instance objects were just like the master object and any changes made to the master object replicated in the instance objects. This was the beginning of inheritance although the theory of inheritance had not been formed then.
What is Simula?
Simula is a programming language designed to make simulations easier to implement. It was developed in Norway in the 1960's. Similar to the sketch pad domain, simula allowed one to define an activity from which a number of processes can be created. Simula allows users to create objects that model the world.
Even more substantial was the ability of these activity classes to have their own data and services and restrict access to its data by giving permission to access it or not. This is what we call encapsulation in today's object oriented world.
What do they have to do with C++?
They both have something to do with C++ in that C++ is an object oriented language in which different objects in the domain are represented with classes. Each of these classes have their own data and services with which they interact with other objects. C++ has private, protected, public access types which restrict access from other classes. Hence it decides what kind of data it will make readily available to other classes and vice versa.(Encapsulation). C++ also applies inheritance by using the superclass subclass phenomenon which acts similarly to the master and instance objects phenomenon in sketchpad.
Imagine that I have a Student object in a Classroom object, something like this.
c := Classroom new name: 'CS2390'.
s := Student new name: 'Fred'; section: 'a'; number: '123456789'.
c addStudent: s.
s := Student new name: 'Wilma'; section: 'b'; number: '3456789012'.
c addStudent: s.
s := Student new name: 'Barney'; section: 'a'; number: '012345678'.
"...More code here..."
a. (7 points) What would you say is the relationship between Student objects and the Classroom object is? Why?
The Classroom object has a number of Student objects or none at all.
Therefore Classroom has a relationship with Student.
This is because you can add a number of students to a classroom. So for every classroom there are as many students as slots are available and students willing to take that class.
b. (10 points) What attributes and services do you think that the Student and Classroom objects have, based on what you see in the above code?
Link to this Page