Documente Academic
Documente Profesional
Documente Cultură
This course
acquaints you with the object oriented concepts, where it is used and compares the
structured and object oriented approaches to programming .
1
2
3
4
ER/CORP/CRS/LA06/003 5
ER/CORP/CRS/LA06/003 6
ER/CORP/CRS/LA06/003 7
ER/CORP/CRS/LA06/003 8
9
The Retail Application case study will be used in through out the course for
introducing various concepts related to programming.
ER/CORP/CRS/LA06/003 10
The picture shows an enterprise application consisting of various modules,
communicating with each other through interfaces
There are many modules. What are the challenges in the development of this
system?
Challenges
The class can have a discussion , the above gives some of the features and
challenges
11
12
Definitions of these terms
The team of developers may be spread across locations, the application may contain
thousands of modules , it becomes difficult to maintain unity amongst diversity and
also have integrity in the design of the system
Software crisis is said to exist when there is -
Over-budget
Rework
Project not meeting deadlines
Requirements of customer not met
13
Edsger Djikstra is a Dutch scientist who had conceived the Djikstras Algorithms for
graphs
In algorithmic design approach , modules are divided into sub-modules till a basic
unit is reached
In the Data-Driven Approach, a set of inputs are processed to give a set of outputs.
This is useful in information based systems like database systems
In the Object Oriented design approach , the focus is on the objects that compose
the problem domain , their behavior and communication between the objects
14
Refer to the case study used in the Introduction to Programming module. A part of
the functionality was developed to understand the basic programming concepts. Let
us consider the other functionalities of the case study to understand the structured
approach
Attributes may also be called as properties exhibited. Ex. A customer has a customer
Id. Customer Id is an attribute/property of the customer
15
The class can have a discussion on other objects that can be observed in a retail
store domain and identify the attributes and activities.
Ex. Item
Attributes- Item id, Item description, Price
Activities- Addition of items, Updation of Price etc
16
More details of the Methods discussed in Day2
17
18
Refer to the case study for the problem statement and
the appendix for more examples
19
The focus of this course would be predominantly on the foundation concepts,
Object Oriented Programming and the implementation using Java . However , the
other point items would be dealt with at an introductory level
20
21
22
The definitions may map to the following:
23
For your reference only:
Booch and Rum Baugh worked towards the Unified Modeling Language (UML) in
1994
UML only offers a model notation, not a methodology for how to do modeling.
Vendors modify their CASE tools to make them consistent with UML.
The details of all of these diagrams are out of scope of this course. The objective is
to be aware of the diagrams which constitute the object oriented design.
Use Case Diagram and the Class diagrams will be used in this course .
The mentioned diagrams belong to UML 2.0
Tools for drawing UML diagrams
25
26
27
28
29
30
31
32
33
The relationship symbols would be dealt with in future parts of the course
34
The class diagram for the complete retail store application is shown above. In Day
1, we have learnt the OOP concepts and represented using Customer class.
35
36
37
ER/CORP/CRS/LA06/003 38
39
40
The customer has the choice of payment through two modes viz. Cash and Credit
card. There are two types of payment. In Credit card, a processing fee is included
along with the name of the bank. In the cash option, there is no extra fee, but the
denominations are counted . Use the tree diagram slide after this
41
42
The activity of paying the bill is the same. But the formula for calculation of bill
differs as per the mode. So the same
43
44
Statistics show that 70% of the cost of the software development is in maintaining
and extending existing code (making changes). Hence Object Oriented approach
helps create reusable code/components which help in managing complexity and
maintenance of code .
45
Q1. Abstraction as some essential details which are needed for the operation of
ATM is known to the customer and the internal details are not known
Encapsulation- as the ATM machine encapsulates or hides the internal working
say how the cash gets stored and how the bank balance is known etc.
46
47
Class & Attributes:
As there are many customers visiting the store and all of them are having Customer
Id and Telephone Number, Customer can be considered as a Class and Customer
Id & Telephone Number defines the attributes of a customer
Behavior:
Behavior specify the methods that can be used to expose the state of an object to
external world. In this scenario, we can think about methods to set values to the
attributes (Customer Id & Telephone Number) and get the values of the state
48
+ and are the notations used for specifying the public and private access specifiers
respectively.
49
An awareness on Object Oriented analysis and design has been provided . In the
subsequent days of the course, object oriented programming would be focussed
upon.
50
Identify the identifiers used for the class diagram given in the case study
Ans: Customer
customerId & telephoneNo
setCustomerId
getCustomerId
setTelephoneNo
getTelephoneNo
For your reference only: Java reserved words
Java Keywords
abstract boolean Break byte case catch char class continue default do
double else extends final finally float for if implements import
instanceof int interface long native new package private protected
public return short static strictfp super switch synchronized this
throw throws transient try void Volatile while
Reserved keywords (not currently in use)
const goto
Reserved Literals
null true false
assert arrived with JDK 1.4. version
enum arrived with JDK 1.5. version
Const and goto are not currently used.
51
Instance variables will be discussed in detail later
52
ER/CORP/CRS/LA06/003 53
All numeric data types are signed
The size of data types remain the same on all platforms
All the whole numbers are considered to be int data type by default
All the decimal literals are considered to be of double data type by default.
For explicitly mentioning that the data type is float we need to add letter f/F at the
end of the literal
Eg:
float val=2.3f;
Internationalization refers to the fact that Java can be used to represent languages
where the number of characters are more. To accommodate the same, character
datatype occupies 2 bytes
54
Data Type Range
byte -128 to 127 (inclusive)
short -32,768 to 32,767 (inclusive)
int -2,147,483,648 to 2,147,483,647 (inclusive)
long -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
(inclusive)
char '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive)
55
Q1. Account Number, Type of account may be the attributes . GetAccountNumber,
OpenAccount, CloseAccount, DisplayBalance may be the activities on the
attributes. This approach is the OO approach where the focus is on the data and
the activities on the data
Q2. Actors- Customer, Bank Officer, UseCases Transfer funds, Check
Balance,Print statement, Key-in request, Change customer details,PrintReport
56
57
58
59