Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
115 views

Lesson 01

The document discusses key concepts in object-oriented programming including classes, objects, methods, inheritance, and the software development lifecycle. It defines classes as templates that dictate what objects can do. Objects are instances of classes that contain data and methods. Methods allow objects to perform tasks in response to messages. Instance methods pertain to individual objects, while class methods pertain to all objects of a class. The software lifecycle includes analysis, design, coding, testing, and operation phases.

Uploaded by

Sly Fox
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views

Lesson 01

The document discusses key concepts in object-oriented programming including classes, objects, methods, inheritance, and the software development lifecycle. It defines classes as templates that dictate what objects can do. Objects are instances of classes that contain data and methods. Methods allow objects to perform tasks in response to messages. Instance methods pertain to individual objects, while class methods pertain to all objects of a class. The software lifecycle includes analysis, design, coding, testing, and operation phases.

Uploaded by

Sly Fox
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Object-Oriented

Programming and
Software Development
Classes and Objects

 An object is a thing, both tangible and intangible, that we can


imagine.
 An object is comprised of data and operations that manipulate
these data.
 A class is a kind of mold or template that dictates what objects
can and cannot do.
 An object is called an instance of a class.
 An object is an instance of exactly one class.
 An instance of a class ‘belongs’ to the class.
REMEMBER!!!
A class must be defined before you can
create an instance (object) of the
class.
Quick Review

 1. Draw an object diagram for a Person class and two Person


objects, Ms. Latte and Mr. Espresso.
 2. What must be defined before you can create an object?
Messages and Methods

 To instruct a class or an object to perform a task, we send a


message to it.
For example, we send a message deposit to an Account object to
deposit $100.
 For a class or an object to process the message it receives, it must
possess a matching method, which is a sequence of instructions
that a class or an object follows to perform a task.
 A method defined for a class is called a class method.
 A method defined for an object is an instance method.
Example of an Instance Method
Example of Class Method
So we define:

An instance method for a task that pertains to an


individual instance.

A class method for a task that pertains to all instances.


Quick Review

 1. Draw an object diagram of an Account object with instance


methods deposit and withdraw.
 2. Is the getObstacleDistance method an instance or a class
method?
Class and Instance Data Values

Instance data value


A class data value is used to represent
information shared by all instances or
to represent collective information
about the instances.
 Data values are also called data members because they belong
to a class or instance of the class.
 A data value that can change is called a variable, and
 One that cannot change is a constant.
Quick Review

 1. What is the difference between a constant and a variable?


 2. Draw an object diagram of a Person object with the three
instance variables name, age, and gender.
Inheritance

 inheritance design two or more entities that are different but share
many common features.
 We call the common class the Superclass,
 all classes that inherit from it subclasses.
 We also call the superclass an ancestor and the subclass a
descendant.
Quick Review

 1. If Class A inherits from Class B, which is a superclass? Which is a


subclass?
 2. Draw a diagram that shows Class A is inheriting from Class B.
 3. What are the other names for superclass and subclass?
 4. If we have Animal, Insect, and Mammal classes, which one will
be a superclass?
Software Engineering
and Software Life Cycle

 The sequence of stages from conception to operation


of a program is called the Software life cycle, and
 Software engineering is the application of a systematic
and disciplined approach to the development, testing,
and maintenance of a program.
Five major phases in the software life cycle:

 Analysis phase, we perform a feasibility study.


 Design phase, we turn a requirements specification into a detailed design of
the program.
 Coding phase, we implement the design into an actual program.
 Testing phase. In this phase, we run the program, using different sets of data
to verify that the program runs according to the specification. (Unit testing
and Integration testing) “ Debugging”.
 Operation phase, in which the program will be put into actual use. After the
testing is successfully concluded.
“The most important and time-consuming activity during the operation phase is
software maintenance.”
Quick Review

 1. Name the stages of the software life cycle.


 2. How does the quality of design affect the software
maintenance cost?
 3. What is debugging?

You might also like