Lessons8-10

# Lessons8-10 - CSE115 Course Notes Lesson 8 Objects The conceptual model consists of objects which represent the items youve identified as being

This preview shows pages 1–3. Sign up to view the full content.

CSE115 Course Notes ©2009 C. Alphonce and A. Decker Page 20 Lesson 8: Objects The conceptual model consists of objects which represent the items you’ve identified as being part of the problem domain, these objects’ properties and capabilities, and their relationships with other objects in the domain. Here we briefly introduce these terms. Our understanding of them will deepen as we proceed through the book. Objects Each of the things identified as being part of the problem domain must somehow be represented in our computer program. Because we are learning object oriented programming, each element from the problem domain will be represented by an object. Exactly how to express this representation in our executable models is something we will learn later on. For now, we need to remember that each element of the problem domain is represented by an object. Properties and Capabilities Each object in our computer program consists of properties and capabilities. Properties are things that objects have, whereas capabilities are things that objects can do. A property of an object is a feature that describes the object. For example, your weight is one of your properties. A property value is the value of a property. For example, your weight property might have the value 150 lbs. Of course, property values can change. When you were born your weight might have been about 8 lbs. The state of an object is the set of all its properties and their values at a given point in time. The set of properties of an object is fixed, but as we have just seen, its property values can change. Thus, the state of an object changes whenever the value of one of its properties changes. Example 3 Suppose a room has as a property the color of its walls. If on Tuesday the room has green walls which are on Wednesday painted yellow, then the state of the object on Tuesday is {wall color = green} and on Thursday it is {wall color = yellow}. Example 4 Suppose a taxi cab has among of its properties the driver who drives the cab, and the people/customers who ride in the cab. At the beginning of the day, Moe the cab driver gets into his cab ready to drive people around town. At this point the state of the taxi cab is {driver = Moe, customers = none}. On the corner of 5th and Main Street, he spots his friend Binky hailing for a cab. After Moe picks up Binky the state of the taxi cab is {driver = Moe, customers = Binky}. Now suppose that after Moe drops Binky off, he picks up Fred and Barney who are going to the park for the afternoon. At this point the state of the taxi cab will be {driver = Moe, customers = Fred, Barney}.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CSE115 Course Notes ©2009 C. Alphonce and A. Decker Page 21 Capabilities are the actions that an object is capable of performing. One way to discover the capabilities of an object is to think of the capabilities that it can perform for other objects when asked. We call capabilities which can be performed for other objects services. Example 5
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/13/2011 for the course CSE 115 taught by Professor Decker during the Fall '08 term at SUNY Buffalo.

### Page1 / 8

Lessons8-10 - CSE115 Course Notes Lesson 8 Objects The conceptual model consists of objects which represent the items youve identified as being

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online