Beruflich Dokumente
Kultur Dokumente
1
Course Objective
• Understand and apply the UML basics and in the analysis and design of
objected-oriented applications.
2
Course grading
• Course Grade are based on the following deliverables:
A. Mid-term exam 30%
B. Course work and participation 30%
• Course Work:
Lab grades
Lecture exercises and quizzes
Project
• Regularly check the course website (moodle page) for lectures and updates
3
Course Plan& outline
Subject
Introduction to OOP
4
Today’s Lecture
• Programming languages history
• Object-Oriented Approach
5
History of Programming Languages
• In the beginning: BASIC, FORTRON, COBOL
High-level computations and calculations.
No defined structure (mostly depending on GOTO, resulting in “Spaghetti Code”.
6
History of Programming Languages
• Better ways were needed to manage the increasing complexity OOP.
• Java was created by James Gosling and his team in 1991, but was first
named Oak then renamed to Java in 1995 with an official announcement of
the language.
Portable.
Platform independent.
7
History of Programming Languages
9
Procedural Languages
• For this reason, the function was adopted as a way to make programs more
comprehensible to their human creators.
10
Problems With Structured Programming
There are two related problems:
11
Problem 1: Unrestricted Access
• In a procedural program, one written in C for example, there are two kinds
of data.
• Local data is closely related to its function and is safe from modification by
other functions.
• When two or more functions must access the same data, then the data must
be made global, as our collection of inventory items is.
12
Problem 1: Unrestricted Access
• This large number of connections causes problems in several ways:
13
Problem 2: Real World Modeling
• The arrangement of separate data and functions does a poor job of modelling
things in the real world.
• Such objects aren’t like data and they aren’t like functions. Complex real-
world objects have both attributes and behavior.
14
Problem 2: Real World Modeling
Attributes
15
Problem 2: Real World Modeling
Behavior
16
Conclusion
18
Object Oriented Approach
20
Objects
• When you approach a programming problem in an object-oriented language,
you no longer ask how the problem will be divided into functions, but how it
will be divided into objects.
• This results from the close match between objects in the programming sense
and objects in the real world.
• The match between programming objects and real-world objects is the happy
result of combining data and functions: The resulting objects offer a
revolution in program design.
21
Classes
• In OOP we say that objects are instances of classes. you can define many
objects of the same class.
• It specifies what data and what functions will be included in objects of that
class.
• Defining the class doesn’t create any objects, just as the mere existence of
data type int doesn’t create any variables.
22
Objects vs. Classes
• In C++ the original class is called the base class; other classes can be defined
that share its characteristics, but add their own as well.
25
Reusability
• Once a class has been written, created, and debugged, it can be distributed
to other programmers for use in their own programs. This is called
reusability.
26
Creating New Data Types
• One of the benefits of objects is that they give the programmer a convenient
way to construct new data types.
27
Polymorphism And Overloading
• Using operators or functions in different ways, depending on what they are
operating on, is called polymorphism (one thing with several distinct forms).
When an existing operator, such as + or =, is given the capability to operate
• This can also be done to functions, where the same function would operate in
different ways, depending on input arguments passed to it.
28