Object Oriented Programming in Java _lecture 1
-
Upload
mahmoud-alfarra -
Category
Education
-
view
488 -
download
0
Transcript of Object Oriented Programming in Java _lecture 1
Object Oriented Programming
Chapter 1: Introduction to OOP
Prepared by: Mahmoud Rafeek Alfarra
2016
Salamo 3likom!
I am Mahmoud R. AlfarraI 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 concepts1
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?
ChairsTables 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
withDraw
Deposit
Transfer
AccountNo
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
PracticesGroup 1Compare between the main concepts of OOP.
Group 2Detect 5 objects from our classroom
Group 3Diffrenciate between abstraction and encabsulation.
Group 4Diffrenciate between procedural and Object-Oriented Programming
Group 5Give us 3 examples for inheritance from your life.
Group 6Summerize the first lecture using 1 complext chart.
THANKS!
Any questions?You can find me at:
Fb/mahmoudRAlfarraStaff.cst.ps/mfarraYoutube.com/mralfarra1@mralfarra