文档介绍:Chapter 1 Introduction
Introduction to Object Oriented
Introduction to UML
Software Process and OOA& account, check account and Loan account.
For each account, customer can deposit, withdraw or transfer.
How to write this program with C ?
Procedural Programming - Example
A procedural programming language usually consists of :
A collection of variables, each of which at any stage contains a certain value (a number, a character, a string of characters, etc)
A collection of statements that change the values of these variables.
The building-block of this type program is the procedure or function.
Programs = Algorithm + Data Structure
Struct account {
char name;
int accountId;
float balance;
float interestYTD;
char accountType;
};
Data Structure:
Bank Account
Procedure 1: Deposit() {...}
Procedure 1: Withdraw() {...}
Procedure 1: Transfer() {...}
Procedural Programming - Disadvantages
Procedures and data are clearly separated.
Transformation of concepts between analysis & implementation.
Procedures are often hard to reuse.
Programs are often hard to extend and maintain.
Data
Procedure
Hudson river
NJ
NY
a gap
Analysis
Design
Hudson river
NJ
NY
a gap
Object-Oriented Programming: OOP
A design and programming technique
Some terminology:
object - usually a person, place or thing (a noun)
method - an action performed by an object (a verb)
type or class - a category of similar objects (such as automobiles)
Objects have both data and methods
Objects of the same class have the same data elements and methods
Objects send and receive messages to invoke actions
Object-Oriented Programming - Example
Writing a program to handle bank accounts
Customer can open different type of accounts, such as cash account, check account and Loan account.
For each account, customer can deposit, withdraw or transfer.
How to write this program with C++ or Java ?
Object-Oriented Programming - Example
Object-Ori