Professional Documents
Culture Documents
Session 2 PDF
Session 2 PDF
Contents
Methodology(Philosophy)
Programming Techniques
Object-Oriented Languages
Object and Large Systems
Thinking Methodology
Induction (Abstract)
From specialization to generalization
From different dogs to create the word dog
Dog
Thinking Methodology
Deduction(infer)
From generalization to specialization
From the word dog you have learnt to know
an animal is or not a dog.
DOG
Design Methodologies
Functional decomposition (Top-Down)
The whole system is characterized by a single
function, and then the function is decomposed into
a set of functions in a process of stepwise refinement.
Functional decomposition
The System Studying
Main Program
Data
Module1 Module2
+ +
Data Data
Data11 Data Data2
Statement sequence(s1,s2,,sn)
Branch(if-then-else)
Problem Model
Two of the most important types of abstraction are
the following:
Division into parts: Has-A abstraction
Division into specialization: Is-A abstraction
Has-A Abstraction
Division into parts takes a complex system, and divides into
component parts, which can then be considered in
isolation. Characterized by sentences that have the words
has-a
A car has-a engine, and has-a transmission
A bicycle has-a wheel
A window has-a menu bar
Allows us to drop down a level of complexity when we
consider the component in isolation.
Is-a Abstraction
Is-a abstraction takes a complex system, and views it as an
instance of a more general abstraction. Characterized by
sentences that have the words ``is-a''
A car is a wheeled vehicle, which is-a means of
transportation
A bicycle is-a wheeled vehicle
A pack horse is-a means of transportation
Allows us to categorize artifacts and information and make
it applicable to many different situations.
Model
A model is an abstraction or conceptual object used in
the creation of a predictive formula or a solution.
A model defines an abstract view to the problem and
focuses only on problem related stuff and that you try
to define properties:
the data which are affected;
the operations which are identified;
ADT is a kind of Model.
Abstract data types(ADT)
Abstract data types are a partial solution to models
ADT defines the interface to a data abstraction without
specifying implementation detail.
Properties of ADT
With abstraction, you create (1) a well-defined entity
which can be properly handled.
These entities define (2) the data structure of a set of
items.
For example, each administered employee has a name, date of birth
and social number....
Properties of ADT(Contd)
The data structure can only be (3) accessed with
defined operations.
This set of operations is called interface and is
exported by the entity.
An entity with the properties just described is
called an abstract data type (ADT).
ADT Abstract
Data Type
Object2
Data
Data2 + Procedures
Data12
Object3
Data3 + Procedures3
Object4
Data4 + Procedures4
Object-Oriented Programming
In object-oriented programming , instead of
calling a procedure which we must provide with
the correct handle, we would directly send a
message to the object in questions.
Roughly speaking, each object implements its own
module.
Object-Oriented Programming
Each object is responsible to initialize and destroy itself
correctly.
Consequently, there is no longer the need to explicitly
call a creation or termination procedure.
Kays Description of OOP
Everything is an object
Objects perform computation by making requests of each
other through the passing of messages
Every object has it's own memory, which consists of other
objects.
Every object is an instance of a class. A class groups similar
objects.
The class is the repository for behavior associated with an
object
Classes are organized into singly-rooted tree structure,
called an inheritance hierarchy.
ADT and Object-Orientation
ADTs allows the creation of instances with well-
defined properties and behavior.
In object-orientation, ADTs are referred to as classes.
Therefore, a class defines properties of objects which
are the instances in an object-oriented environment.
ADT and Object-Orientation(2)
ADTs define functionality by putting main emphasis on
the involved data, their structure, operations as well as
axioms and preconditions.
Object-oriented programming is ``programming with
ADTs'': combining functionality of different ADTs to solve
a problem.
Therefore instances (objects) of ADTs (classes) are
dynamically created, destroyed and used.
A Formula
Object-Orientation = Object (Abstraction) + Class (ADT &
Classification) + Inheritance (Reusing) + Dynamic Binding
(Polymorphism, Flexibility)
Inheritance(Hierarchy)
Expresses commonality among objects
Allows code reusability
Highlights Generalization/Specialization
relationships
We will learn more in the following lectures.
Polymorphism
The ability of objects to respond differently to the
same message or function call.
We will discuss more in the following lectures.
Object-Orientation Evolution
Modules
Information hiding
Data encapsulation
Abstract data types
Classes and Objects
Points to Remember
Encapsulation(Data & Operations)--- A technique
for Information Hiding-----the users of the objects
could not see the details of the data and operations
of the objects.
Data Abstraction ---- the procedure to find a class
from objects.
Abstract Data Type---- Class.
Object-Oriented Languages
An object-based programming language is one which easily supports
object-orientation.
Smalltalk: 1972-1980, Alan Kay
C++: 1986, Bjarne Stroustrup
Java: 1992 (Smalltalk + C++), James Gosling
C#:
Developed at Microsoft by Anders Hejlsberg et al, 2000
Event driven, object oriented, visual programming language (C++ and
Java)
Others:
Effile, Objective-C, Ada, ...
Programming in the Small vs Programming
in the Large
Programming in the Small:
One programmer, understands everything from top to bottom.
Major problem is the development of algorithms.
Programming in the Large:
System is developed by large team of programmers
Major problems are management of details and communication
between programmers and between their respective software
subsystems.
Objects and Large Software Systems
Object view
Makes systems more intuitively understandable
Unifies design and programming method
Initial program thoughts are informal objects-and-interactions
descriptions, even when using a non-OO language.
Divides code into logical chunks individuals of a team can be
experts in, and outsiders can understand via interfaces
Allows "off the shelf" code libraries to be reused
Supports code evolution: internals can always be re-written as
long as interface stays the same
Objects and Large Software Systems
So, in large software system, we need more CONCEPTS and
STRUCTURES of object-orientation than PROGRAMMING
SKILLS
Those are OOA(Object-Oriented Analysis) and OOD(Object-
Oriented Design), that will be discussed more deeply in Software
engineering or Software designing methodology.
Summary
Methodology (Philosophy)
Programming Techniques
Object-Oriented Languages
Object and Large Systems