KEMBAR78
Object Oriented Programming in Java _lecture 1 | PPTX
Object Oriented Programming
Chapter 1: Introduction to OOP
Prepared by: Mahmoud Rafeek Alfarra
2016
Salamo 3likom!
I am Mahmoud R. Alfarra
I am here because I love to give knowledge.
Note: I have prepared this material Based on (Liang: “Introduction to Programming using Java”, 10’th edition, 2015)
Outlines
◉ What is Object-Oriented Programming ?
◉ Procedural vs. Object-Oriented Programming
◉ OO Programming Concepts
◉ Concept of Objects and classes
◉ UML Class Diagram
◉ Visibility Modifiers and Accessor Methods
◉ Full Example
‫قال‬ ، ‫عنه‬ ‫اهلل‬ ‫رضي‬ ‫اخلطاب‬ ‫بن‬ ‫عمر‬ ‫عن‬:‫مسعت‬
‫يقول‬ ‫وسلم‬ ‫عليه‬ ‫اهلل‬ ‫صلى‬ ‫اهلل‬ ‫رسول‬:
(،‫نوى‬ ‫ما‬ ‫امريء‬ ‫لكل‬ ‫وإمنا‬ ، ‫ّات‬‫ي‬‫بالن‬ ‫األعمال‬ ‫إمنا‬
‫إىل‬ ‫فهجرته‬ ، ‫ورسوله‬ ‫اهلل‬ ‫إىل‬ ‫هجرته‬ ‫كانت‬ ‫فمن‬
‫أو‬ ، ‫يصيبها‬ ‫لدنيا‬ ‫هجرته‬ ‫كانت‬ ‫ومن‬ ، ‫ورسوله‬ ‫اهلل‬
‫إليه‬ ‫هاجر‬ ‫ما‬ ‫إىل‬ ‫فهجرته‬ ، ‫ينكحها‬ ‫امرأة‬)
‫صحيحهما‬ ‫يف‬ ‫ومسلم‬ ‫البخاري‬ ‫رواه‬
‫وال‬ ‫ستقيم‬ ‫ت‬ ‫وال‬ ‫لو‬ ‫حت‬ ‫ال‬ ‫ياة‬ ‫احل‬
‫عاىل‬ ‫ت‬ ‫اهلل‬ ‫عة‬ ‫بطا‬ ‫إال‬ ‫سهل‬ ‫ت‬
‫ليت‬ ‫ا‬ ‫خالق‬ ‫واأل‬ ‫باآلداب‬ ‫تأدب‬ ‫وال‬
‫شريعته‬ ‫يف‬ ‫لنا‬ ‫وردت‬.
،،، ‫صح‬ ‫عيشها‬
Lecture
Let’s start with the first set of concepts
1
Our Life is a set of
Objects
o To have a fine definition of OOP, Please note what you
are showing in your class room now?
What is OOP?
Chairs
Tables
Teacher
PCs
.
.
# of legs
Type of material
Color
.
.
.
o Object-oriented programming (OOP) involves programming using
objects.
o An object represents an entity in the real world that can be
distinctly identified.
o For example, a student, a desk, a circle, a button, and even a loan
can all be viewed as objects.
o An object has a unique identity, state, and behaviors.
What is OOP?
o The unit in procedural programming
is function.
o Procedural programming
concentrates on creating functions.
o Procedural programming separates
the data of the program from the
operations that manipulate the
data.
Procedural vs. Object-Oriented Programming
o The unit in object-oriented
programming is class.
o Object-oriented programming
starts from isolating the classes,
and then look for the methods
inside them.
o Object-oriented programming
focus on both of them.
Concepts of Object-Oriented Programming
o Abstraction is simplifying complex reality by modeling classes
appropriate to the problem.
o Abstraction is mechanism to show only relevant data to the user.
o i.e: The client cares about what functionality a car offers, not
about how that functionality is implemented.
Abstraction
o Encapsulation allows the programmer to group data and the
methods that operate on them together in one place, and to hide
details from the user.
Encapsulation
AccountValue
Name Address
Change Address
withDraw any value
o Encapsulation protects the integrity of an object's data.
o Protects an object from unwanted access by clients.
 A bank app forbids a client to change an Account's balance.
o Allows you to change the class implementation.
o Allows you to constrain objects' state
Benefits of encapsulation
Abstraction Vs encapsulation
o Inheritance: The ability of a new class to be created from an
existing class by extending it.
Inheritance
Student
Colleague
BCs Diploma
School
Primary Secondary
o Polymorphism enables us to "program in the general" rather than
"program in the specific.
Polymorphism
Practices
Group 1
Compare between
the main concepts of
OOP.
Group 2
Detect 5 objects from
our classroom
Group 3
Diffrenciate between
abstraction and
encabsulation.
Group 4
Diffrenciate between
procedural and Object-
Oriented Programming
Group 5
Give us 3 examples for
inheritance from your
life.
Group 6
Summerize the first
lecture using 1
complext chart.
THANKS!
Any questions?
You can find me at:
Fb/mahmoudRAlfarra
Staff.cst.ps/mfarra
Youtube.com/mralfarra1
@mralfarra

Object Oriented Programming in Java _lecture 1

  • 1.
    Object Oriented Programming Chapter1: Introduction to OOP Prepared by: Mahmoud Rafeek Alfarra 2016
  • 2.
    Salamo 3likom! I amMahmoud R. Alfarra I am here because I love to give knowledge. Note: I have prepared this material Based on (Liang: “Introduction to Programming using Java”, 10’th edition, 2015)
  • 3.
    Outlines ◉ What isObject-Oriented Programming ? ◉ Procedural vs. Object-Oriented Programming ◉ OO Programming Concepts ◉ Concept of Objects and classes ◉ UML Class Diagram ◉ Visibility Modifiers and Accessor Methods ◉ Full Example
  • 4.
    ‫قال‬ ، ‫عنه‬‫اهلل‬ ‫رضي‬ ‫اخلطاب‬ ‫بن‬ ‫عمر‬ ‫عن‬:‫مسعت‬ ‫يقول‬ ‫وسلم‬ ‫عليه‬ ‫اهلل‬ ‫صلى‬ ‫اهلل‬ ‫رسول‬: (،‫نوى‬ ‫ما‬ ‫امريء‬ ‫لكل‬ ‫وإمنا‬ ، ‫ّات‬‫ي‬‫بالن‬ ‫األعمال‬ ‫إمنا‬ ‫إىل‬ ‫فهجرته‬ ، ‫ورسوله‬ ‫اهلل‬ ‫إىل‬ ‫هجرته‬ ‫كانت‬ ‫فمن‬ ‫أو‬ ، ‫يصيبها‬ ‫لدنيا‬ ‫هجرته‬ ‫كانت‬ ‫ومن‬ ، ‫ورسوله‬ ‫اهلل‬ ‫إليه‬ ‫هاجر‬ ‫ما‬ ‫إىل‬ ‫فهجرته‬ ، ‫ينكحها‬ ‫امرأة‬) ‫صحيحهما‬ ‫يف‬ ‫ومسلم‬ ‫البخاري‬ ‫رواه‬ ‫وال‬ ‫ستقيم‬ ‫ت‬ ‫وال‬ ‫لو‬ ‫حت‬ ‫ال‬ ‫ياة‬ ‫احل‬ ‫عاىل‬ ‫ت‬ ‫اهلل‬ ‫عة‬ ‫بطا‬ ‫إال‬ ‫سهل‬ ‫ت‬ ‫ليت‬ ‫ا‬ ‫خالق‬ ‫واأل‬ ‫باآلداب‬ ‫تأدب‬ ‫وال‬ ‫شريعته‬ ‫يف‬ ‫لنا‬ ‫وردت‬. ،،، ‫صح‬ ‫عيشها‬
  • 5.
    Lecture Let’s start withthe first set of concepts 1
  • 6.
    Our Life isa set of Objects
  • 7.
    o To havea fine definition of OOP, Please note what you are showing in your class room now? What is OOP? Chairs Tables Teacher PCs . . # of legs Type of material Color . . .
  • 8.
    o Object-oriented programming(OOP) involves programming using objects. o An object represents an entity in the real world that can be distinctly identified. o For example, a student, a desk, a circle, a button, and even a loan can all be viewed as objects. o An object has a unique identity, state, and behaviors. What is OOP?
  • 9.
    o The unitin procedural programming is function. o Procedural programming concentrates on creating functions. o Procedural programming separates the data of the program from the operations that manipulate the data. Procedural vs. Object-Oriented Programming o The unit in object-oriented programming is class. o Object-oriented programming starts from isolating the classes, and then look for the methods inside them. o Object-oriented programming focus on both of them.
  • 10.
  • 11.
    o Abstraction issimplifying complex reality by modeling classes appropriate to the problem. o Abstraction is mechanism to show only relevant data to the user. o i.e: The client cares about what functionality a car offers, not about how that functionality is implemented. Abstraction
  • 12.
    o Encapsulation allowsthe programmer to group data and the methods that operate on them together in one place, and to hide details from the user. Encapsulation AccountValue Name Address Change Address withDraw any value
  • 13.
    o Encapsulation protectsthe integrity of an object's data. o Protects an object from unwanted access by clients.  A bank app forbids a client to change an Account's balance. o Allows you to change the class implementation. o Allows you to constrain objects' state Benefits of encapsulation
  • 14.
  • 15.
    o Inheritance: Theability of a new class to be created from an existing class by extending it. Inheritance Student Colleague BCs Diploma School Primary Secondary
  • 16.
    o Polymorphism enablesus to "program in the general" rather than "program in the specific. Polymorphism
  • 17.
    Practices Group 1 Compare between themain concepts of OOP. Group 2 Detect 5 objects from our classroom Group 3 Diffrenciate between abstraction and encabsulation. Group 4 Diffrenciate between procedural and Object- Oriented Programming Group 5 Give us 3 examples for inheritance from your life. Group 6 Summerize the first lecture using 1 complext chart.
  • 18.
    THANKS! Any questions? You canfind me at: Fb/mahmoudRAlfarra Staff.cst.ps/mfarra Youtube.com/mralfarra1 @mralfarra