Skip to main content
ICT
Lesson A1 - Introduction to Object Oriented Programming (OOP)
 
Main Previous Next
Title Page >  
Summary >  
Lesson A1 >  
Lesson A2 >  
Lesson A3 >  
Lesson A4 >  
Lesson A5 >  
Lesson A6 >  
Lesson A7 >  
Lesson A8 >  
Lesson A9 >  
Lesson A10 >  
Lesson A11 >  
Lesson A12 >  
Lesson A13 >  
Lesson A14 >  
Lesson A15 >  
Lesson A16 >  
Lesson A17 >  
Lesson A18 >  
Lesson A19 >  
Lesson A20 >  
Lesson A21 >  
Lesson A22 >  
Lesson AB23 >  
Lesson AB24 >  
Lesson AB25 >  
Lesson AB26 >  
Lesson AB27 >  
Lesson AB28 >  
Lesson AB29 >  
Lesson AB30 >  
Lesson AB31 >  
Lesson AB32 >  
Lesson AB33 >  
Vocabulary >  
 

A. Classes and Objects page 3 of 8

  1. Object-oriented programming (OOP) attempts to make programs more closely model the way people think about and deal with the world. In OOP, a program consists of a collection of interacting objects. To write such a program you need to describe different types of objects: what they know, how they are created, and how they interact with other objects. Each object in a program represents an item that has a job to do.

  2. The world in which we live is filled with objects. For example, an object we are all familiar with is a drawing tool such as a pencil or pen. A drawing tool is an object, which can be described in terms of its attributes and behaviors. Attributes are aspects of an object that describe it, while behaviors are things that the object can do. The attributes of a pencil are its drawing color, width of the line it draws, its location on the drawing surface, etc. Anything that describes an object is called an attribute. Its behaviors consist of drawing a circle, drawing a line in a forward or backward direction, changing its drawing direction, etc. Anything that an object does is called a behavior. Another aspect of an object has to do with creation, which determines the initial state of an object.

  3. In order to use an object within a program, we need to provide a definition for the object. This definition is called a class. The class describes how the object behaves, what kind of information it contains, and how to create objects of that type. A class can be thought of as a mold, template, or blueprint that the computer uses to create objects.

  4. When building a house, a construction crew uses a blueprint to define the aspects of the house. The blueprint gives the specifications on how many bedrooms there are, how to position the electrical wiring, the size of the garage, etc. However, even two houses built from the same blueprint may have different paint colors and will have different physical locations. Clients who are buying a house may make slight modifications to these blueprints. For example, they may want a bigger garage or a smaller porch. We can see the houses built from the blueprint as objects since they are all similar in structure, but each house has its own unique attributes. In the world of programming, we can view the blueprint just like a class, i.e. a tool for creating our objects.

 

Main Previous Next
Contact
 © ICT 2006, All Rights Reserved.