際際滷

際際滷Share a Scribd company logo
Object Oriented
Programming
Lecture (1)
Dr. Abdelrahman Mohamed
El-Akhdar
Part (1): Objects:
 Objects and classes.
 Deriving and object-oriented design.
 Part (2): Functional oriented design:
 Data flow diagrams.
 Structure charts.
 Data dictionaries.
 Deriving structure charts.
 Design examples.
 Concurrent systems design.
 Part (3): User interface design:
 User interface design objectives.
 Interface metaphors.
Course Contents
Course description
Course name and code Credit
hours
Weekly credit hours
(WCH)
Semester
work
Final
exam
Total
Lectures Tutorial
Object oriented
programming (CS-315A)
3 3 2 60 90 150
 A Look at How We See the World.
 Objects.
 Abstract Objects and Instances.
 Classes and structures.
 Objects and classes.
 Methods.
Lecture Outlines
A Look at How We See the World
How do you see the world?
Molecular structures
Scientist
Artist
Programmer
Shapes and Colors
Data required to
emulates the real world
A Look at How We See the World
What is meant by stuff?
 Stuff is anything you have and anything you want.
 A house is stuff.
 Things you have in your house are stuff.
 Things you throw away are stuff.
 The things you want to buy.
 A house is made up of other stuff, such as windows and doors.
 The term stuff is less technical that you expect in a course on
object-oriented programming, but it does give you a reference
point to begin learning object-oriented programming.
 A Look at How We See the World.
 Objects.
 Abstract Objects and Instances.
 Classes and structures.
 Objects and classes.
 Methods.
Lecture Outlines
Objects
What is meant by Object?
 Stuff is an object.
 A house is an object.
 The things you have in your house are objects.
 Things your throw away are objects.
 Things you want to buy are objects.
 All of us, regardless of our background, view the world as
objects.
 An object is a person, place, thing, concept, or possibly event.
How to learn about Objects?
Each of us is considered an object in the world of object-oriented
programming. We call this object a person.
A person is described by using two groups of features:
Attributes
 First name
 Last name
 Height
 Weight
Behaviors
 Sits
 Stands
 Walks
 Runs
Objects
How to learn about Objects?
Another example of objects is an automobile, airplane, and even a
sales order form are objects. Attributes and behaviors of an
automobile and airplane can be described as follows:
Attributes
 Width
 Height.
 Weight.
 Wheels dimensions.
 Engine specs.
 many other attributes.
Behaviors
 Move in a direction.
 Stop.
 Steered to a different
direction.
 Can perform many other
actions.
Objects
 A Look at How We See the World.
 Objects.
 Abstract Objects and Instances.
 Classes and structures.
 Objects and classes.
 Methods.
Lecture Outlines
What are abstract objects and instances?
programmers view an object in two ways (abstract object-real object).
The term abstract object is a description of a real object minus details.
Real objects
 First Name.
 Last Name.
 Height.
 Weight.
Abstract Objects
 Bob.
 Smith.
 6 feet tall.
 160 pounds.
 Programmers create an abstract object and then use the abstract
object to create a real object. A real object is called an instance of
the abstract object. You can say that a real person is an instance of
the abstract person (cookie cutter is a good example).
Abstract Objects and Instances
Why we need to define Objects?
Focusing on objects makes it easy for us to understand complex things.
Objects enable us to look at details that are of interest to us and ignore
other details that we are not interested in.
 For example, a teacher is a person and has many of the attributes
and behaviors. you probably ignore many of the teachers attributes
and behaviors and focus on only those that relate to your education.
 Likewise, the teacher focuses on your attributes and behaviors that
indicate how well you are learning material in class.
 Both you and your teacher simplify your relationship by deciding
attributes and behaviors that are important to each of your
objectives and then use only those attributes and behaviors in your
relationship.
Abstract Objects and Instances
 A Look at How We See the World.
 Objects.
 Abstract Objects and Instances.
 Classes and structures.
 Objects and classes.
 Methods.
Lecture Outlines
What is the difference between Classes and Structures?
Class: it provides flexibility in combining data and methods and it
provides re-usability (inheritance)
Structure: It provides data grouping.
To understand the difference between classes and structures we
should know the difference between heap and stack memories.
Classes and structures
Class Structure
 All members are private by default  All members are public by default
 Allow to perform clean-up (garbage collector)
as it work on heap memory
 Structures cannot allow garbage collector so
no efficient memory management
 Size of empty class = 1 Byte  Size of empty structure = 0 Byte
 Classes fits for larger and complex objects  Structures are good for small and isolated
model objects.
What is the difference between Heap and Stack
memories?
Heap and Stack memories
Heap Stack
 Reference type: created on heap
memory
 Value type: Created on stack memory
 Memory is accessible by all functions  To create a new function we have to
create a new stack
 Used when we dont know the
amount of memory used
 Used when we know exactly the
amount of memory used
 Use pointers  Dont require pointers
 Variable allocation is low  Variable allocation is fast
 Dynamic memory location  Static memory location
 Unlimited size  Limited size
 Variables can be re-sized  Variables cannot be re-sized
 A Look at How We See the World.
 Objects.
 Abstract Objects and Instances.
 Classes and structures.
 Objects and classes.
 Methods.
Lecture Outlines
What is the relation between Objects and Classes in OOP?
Objects: a piece of code that represents real life entity (they are an instance of a
Class).
Class: it contains one or more objects.
 Class is a structure where we can define variables and methods to utilize
objects.
 Without Class, Objects doesnt exist.
 Without Objects we commonly use static function of Class.
A Person has saving bank account
Objects and Classes
Class student
{
ID no;
Name;
Grades;
GPA;
};
Collection of Objects
Object Class
What are the characteristics of a class?
 It is an extensible program-code-template for creating objects.
 A class provides initial values for state member variables and
implementation of behavior.
 In many languages, the class name is used as the name for the
class.
 When an object is created by a constructor of the class, the
resulting object is called an instance of the class, and the member
variables specific to the object are called instance variables, to
contrast with the class variables shared across the class.
Objects and Classes
 Classes are composed from structural and behavioral parts.
 Programming languages that include classes as a programming
construct offer support, for various class-related features, and the
syntax required to use these features varies greatly from one
programming language to another.
Objects and Classes
Example of a class
Objects and Classes
Another example of a class
Objects and Classes
A class definition in C++ code
Objects and Classes
Design and implementation of a class?
 A class is a template that defines attributes and methods of a real-
word object.
Defining a Class:
 A class definition defines attributes and methods that are members
of the class. A Class definition using C++ is as follows:
Keyword class
Class name
Class body
Objects and Classes
What is meant by attribute of a class?
An attribute of a class is a variable called an instance variable.
Declaring an Instance Variable:
A declaration statement in Java or C++ consists of the following three
parts:
1) Data type.
2) Instance variable name.
3) Semicolon.
Objects and Classes
Data Type:
 A data type is a keyword that tells the computer the kind of data
you want to store in a memory location.
 The data type implies to the computer how much memory to
reserve and how to handle the data stored once it is stored at that
memory location.
 it is very important that you have a strong understanding of what a
data type is and how to specify a data type when declaring a
variable.
Data Types
Data Type in C++:
Data Types
Data Type in Java:
Data Types
Examples of data Types:
 You tell the computer to reserve space for an integer by using the
data type int. The computer already knows how much memory to
reserve to store an integer.
 The data type also tells the computer the kind of data that will be
stored at the memory location. This is important because
computers manipulate data of some data types differently than
data of other data types. This is similar to the warehouse manager
who treats a case of fuel oil differently than a case of baseballs.
Data Types
Instance variable name:
 The name of an instance variable is given by the programmer.
 It should represent the nature of the data stored at the memory
location. The variable name is used throughout the program to
refer to the contents of the corresponding memory location.
 For example, studentNumber is a perfect name for a variable used
to store a student number because the name tells you the nature
of the data associated with the variable.
 The variable name is used throughout the program to refer to the
contents of the corresponding memory location.
Data Types
Instance variable name:
Data Types
Thank you
Instance variable name:
 An instance variable is a type of class attribute (or class property,
field, or data member). The same differences between instance
and class members applies to methods (functions). Therefore, a
class may have both instance method and class method.
Data Types

More Related Content

Similar to O6u CS-315A OOP Lecture (1).pdf (20)

Object -oriented analysis and design.ppt
Object -oriented analysis and design.pptObject -oriented analysis and design.ppt
Object -oriented analysis and design.ppt
pierrerj05
Object Modelling Technique " ooad "
Object Modelling Technique  " ooad "Object Modelling Technique  " ooad "
Object Modelling Technique " ooad "
AchrafJbr
It 405 materi 3 objek dan kelas
It 405 materi 3   objek dan kelasIt 405 materi 3   objek dan kelas
It 405 materi 3 objek dan kelas
Ayi Purbasari
Ooad unit 1 introduction
Ooad unit  1 introductionOoad unit  1 introduction
Ooad unit 1 introduction
Babeetha Muruganantham
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Harry Potter
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Hoang Nguyen
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Luis Goldster
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Tony Nguyen
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Young Alista
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Fraboni Ec
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
James Wong
Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Concept of Object-Oriented in C++
Concept of Object-Oriented in C++
Abdullah Jan
[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects
Muhammad Hammad Waseem
Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0
Ganapathi M
Ooad ch 1_2
Ooad ch 1_2Ooad ch 1_2
Ooad ch 1_2
anujabeatrice2
CPP Object Oriented Concepts(OOPS).pptx
CPP  Object Oriented Concepts(OOPS).pptxCPP  Object Oriented Concepts(OOPS).pptx
CPP Object Oriented Concepts(OOPS).pptx
adityakumardas16
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane2
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane1
introduction-to-dbms-unit-1.ppt
introduction-to-dbms-unit-1.pptintroduction-to-dbms-unit-1.ppt
introduction-to-dbms-unit-1.ppt
rekhasai2468
Handout on Object orienetd Analysis and Design
Handout on Object orienetd Analysis and DesignHandout on Object orienetd Analysis and Design
Handout on Object orienetd Analysis and Design
SAFAD ISMAIL
Object -oriented analysis and design.ppt
Object -oriented analysis and design.pptObject -oriented analysis and design.ppt
Object -oriented analysis and design.ppt
pierrerj05
Object Modelling Technique " ooad "
Object Modelling Technique  " ooad "Object Modelling Technique  " ooad "
Object Modelling Technique " ooad "
AchrafJbr
It 405 materi 3 objek dan kelas
It 405 materi 3   objek dan kelasIt 405 materi 3   objek dan kelas
It 405 materi 3 objek dan kelas
Ayi Purbasari
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Harry Potter
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Hoang Nguyen
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Luis Goldster
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Tony Nguyen
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Young Alista
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Fraboni Ec
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
James Wong
Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Concept of Object-Oriented in C++
Concept of Object-Oriented in C++
Abdullah Jan
Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0
Ganapathi M
CPP Object Oriented Concepts(OOPS).pptx
CPP  Object Oriented Concepts(OOPS).pptxCPP  Object Oriented Concepts(OOPS).pptx
CPP Object Oriented Concepts(OOPS).pptx
adityakumardas16
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane2
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane1
introduction-to-dbms-unit-1.ppt
introduction-to-dbms-unit-1.pptintroduction-to-dbms-unit-1.ppt
introduction-to-dbms-unit-1.ppt
rekhasai2468
Handout on Object orienetd Analysis and Design
Handout on Object orienetd Analysis and DesignHandout on Object orienetd Analysis and Design
Handout on Object orienetd Analysis and Design
SAFAD ISMAIL

Recently uploaded (20)

The Broccoli Dog's inner voice (look A)
The Broccoli Dog's inner voice  (look A)The Broccoli Dog's inner voice  (look A)
The Broccoli Dog's inner voice (look A)
merasan
Year 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptxYear 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptx
mansk2
EDL 290F Week 3 - Mountaintop Views (2025).pdf
EDL 290F Week 3  - Mountaintop Views (2025).pdfEDL 290F Week 3  - Mountaintop Views (2025).pdf
EDL 290F Week 3 - Mountaintop Views (2025).pdf
Liz Walsh-Trevino
The Constitution, Government and Law making bodies .
The Constitution, Government and Law making bodies .The Constitution, Government and Law making bodies .
The Constitution, Government and Law making bodies .
saanidhyapatel09
Database population in Odoo 18 - Odoo slides
Database population in Odoo 18 - Odoo slidesDatabase population in Odoo 18 - Odoo slides
Database population in Odoo 18 - Odoo slides
Celine George
Essentials of a Good PMO, presented by Aalok Sonawala
Essentials of a Good PMO, presented by Aalok SonawalaEssentials of a Good PMO, presented by Aalok Sonawala
Essentials of a Good PMO, presented by Aalok Sonawala
Association for Project Management
Research & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptxResearch & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptx
Dr. Sarita Anand
Rass MELAI : an Internet MELA Quiz Finals - El Dorado 2025
Rass MELAI : an Internet MELA Quiz Finals - El Dorado 2025Rass MELAI : an Internet MELA Quiz Finals - El Dorado 2025
Rass MELAI : an Internet MELA Quiz Finals - El Dorado 2025
Conquiztadors- the Quiz Society of Sri Venkateswara College
CBSE Arabic Grammar - Class 10 ppt.pptx
CBSE Arabic Grammar - Class 10   ppt.pptxCBSE Arabic Grammar - Class 10   ppt.pptx
CBSE Arabic Grammar - Class 10 ppt.pptx
suhail849886
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
Association for Project Management
English 4 Quarter 4 Week 4 Classroom Obs
English 4 Quarter 4 Week 4 Classroom ObsEnglish 4 Quarter 4 Week 4 Classroom Obs
English 4 Quarter 4 Week 4 Classroom Obs
NerissaMendez1
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷sReordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Celine George
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷sHow to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
Celine George
Lesson Plan M1 2024 Lesson Plan M1 2024 Lesson Plan M1 2024 Lesson Plan M1...
Lesson Plan M1 2024  Lesson Plan M1 2024  Lesson Plan M1 2024  Lesson Plan M1...Lesson Plan M1 2024  Lesson Plan M1 2024  Lesson Plan M1 2024  Lesson Plan M1...
Lesson Plan M1 2024 Lesson Plan M1 2024 Lesson Plan M1 2024 Lesson Plan M1...
pinkdvil200
How to attach file using upload button Odoo 18
How to attach file using upload button Odoo 18How to attach file using upload button Odoo 18
How to attach file using upload button Odoo 18
Celine George
Blind Spots in AI and Formulation Science Knowledge Pyramid (Updated Perspect...
Blind Spots in AI and Formulation Science Knowledge Pyramid (Updated Perspect...Blind Spots in AI and Formulation Science Knowledge Pyramid (Updated Perspect...
Blind Spots in AI and Formulation Science Knowledge Pyramid (Updated Perspect...
Ajaz Hussain
South Hornsey: The Lost Local Authority that Merged with Stoke Newington by T...
South Hornsey: The Lost Local Authority that Merged with Stoke Newington by T...South Hornsey: The Lost Local Authority that Merged with Stoke Newington by T...
South Hornsey: The Lost Local Authority that Merged with Stoke Newington by T...
History of Stoke Newington
TLE 7 - 3rd Topic - Hand Tools, Power Tools, Instruments, and Equipment Used ...
TLE 7 - 3rd Topic - Hand Tools, Power Tools, Instruments, and Equipment Used ...TLE 7 - 3rd Topic - Hand Tools, Power Tools, Instruments, and Equipment Used ...
TLE 7 - 3rd Topic - Hand Tools, Power Tools, Instruments, and Equipment Used ...
RizaBedayo
How to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 EmployeeHow to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 Employee
Celine George
APM People Interest Network Conference - Tim Lyons - The neurological levels ...
APM People Interest Network Conference - Tim Lyons - The neurological levels ...APM People Interest Network Conference - Tim Lyons - The neurological levels ...
APM People Interest Network Conference - Tim Lyons - The neurological levels ...
Association for Project Management
The Broccoli Dog's inner voice (look A)
The Broccoli Dog's inner voice  (look A)The Broccoli Dog's inner voice  (look A)
The Broccoli Dog's inner voice (look A)
merasan
Year 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptxYear 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptx
mansk2
EDL 290F Week 3 - Mountaintop Views (2025).pdf
EDL 290F Week 3  - Mountaintop Views (2025).pdfEDL 290F Week 3  - Mountaintop Views (2025).pdf
EDL 290F Week 3 - Mountaintop Views (2025).pdf
Liz Walsh-Trevino
The Constitution, Government and Law making bodies .
The Constitution, Government and Law making bodies .The Constitution, Government and Law making bodies .
The Constitution, Government and Law making bodies .
saanidhyapatel09
Database population in Odoo 18 - Odoo slides
Database population in Odoo 18 - Odoo slidesDatabase population in Odoo 18 - Odoo slides
Database population in Odoo 18 - Odoo slides
Celine George
Research & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptxResearch & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptx
Dr. Sarita Anand
CBSE Arabic Grammar - Class 10 ppt.pptx
CBSE Arabic Grammar - Class 10   ppt.pptxCBSE Arabic Grammar - Class 10   ppt.pptx
CBSE Arabic Grammar - Class 10 ppt.pptx
suhail849886
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
Association for Project Management
English 4 Quarter 4 Week 4 Classroom Obs
English 4 Quarter 4 Week 4 Classroom ObsEnglish 4 Quarter 4 Week 4 Classroom Obs
English 4 Quarter 4 Week 4 Classroom Obs
NerissaMendez1
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷sReordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Celine George
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷sHow to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
Celine George
Lesson Plan M1 2024 Lesson Plan M1 2024 Lesson Plan M1 2024 Lesson Plan M1...
Lesson Plan M1 2024  Lesson Plan M1 2024  Lesson Plan M1 2024  Lesson Plan M1...Lesson Plan M1 2024  Lesson Plan M1 2024  Lesson Plan M1 2024  Lesson Plan M1...
Lesson Plan M1 2024 Lesson Plan M1 2024 Lesson Plan M1 2024 Lesson Plan M1...
pinkdvil200
How to attach file using upload button Odoo 18
How to attach file using upload button Odoo 18How to attach file using upload button Odoo 18
How to attach file using upload button Odoo 18
Celine George
Blind Spots in AI and Formulation Science Knowledge Pyramid (Updated Perspect...
Blind Spots in AI and Formulation Science Knowledge Pyramid (Updated Perspect...Blind Spots in AI and Formulation Science Knowledge Pyramid (Updated Perspect...
Blind Spots in AI and Formulation Science Knowledge Pyramid (Updated Perspect...
Ajaz Hussain
South Hornsey: The Lost Local Authority that Merged with Stoke Newington by T...
South Hornsey: The Lost Local Authority that Merged with Stoke Newington by T...South Hornsey: The Lost Local Authority that Merged with Stoke Newington by T...
South Hornsey: The Lost Local Authority that Merged with Stoke Newington by T...
History of Stoke Newington
TLE 7 - 3rd Topic - Hand Tools, Power Tools, Instruments, and Equipment Used ...
TLE 7 - 3rd Topic - Hand Tools, Power Tools, Instruments, and Equipment Used ...TLE 7 - 3rd Topic - Hand Tools, Power Tools, Instruments, and Equipment Used ...
TLE 7 - 3rd Topic - Hand Tools, Power Tools, Instruments, and Equipment Used ...
RizaBedayo
How to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 EmployeeHow to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 Employee
Celine George
APM People Interest Network Conference - Tim Lyons - The neurological levels ...
APM People Interest Network Conference - Tim Lyons - The neurological levels ...APM People Interest Network Conference - Tim Lyons - The neurological levels ...
APM People Interest Network Conference - Tim Lyons - The neurological levels ...
Association for Project Management

O6u CS-315A OOP Lecture (1).pdf

  • 1. Object Oriented Programming Lecture (1) Dr. Abdelrahman Mohamed El-Akhdar
  • 2. Part (1): Objects: Objects and classes. Deriving and object-oriented design. Part (2): Functional oriented design: Data flow diagrams. Structure charts. Data dictionaries. Deriving structure charts. Design examples. Concurrent systems design. Part (3): User interface design: User interface design objectives. Interface metaphors. Course Contents
  • 3. Course description Course name and code Credit hours Weekly credit hours (WCH) Semester work Final exam Total Lectures Tutorial Object oriented programming (CS-315A) 3 3 2 60 90 150
  • 4. A Look at How We See the World. Objects. Abstract Objects and Instances. Classes and structures. Objects and classes. Methods. Lecture Outlines
  • 5. A Look at How We See the World How do you see the world? Molecular structures Scientist Artist Programmer Shapes and Colors Data required to emulates the real world
  • 6. A Look at How We See the World What is meant by stuff? Stuff is anything you have and anything you want. A house is stuff. Things you have in your house are stuff. Things you throw away are stuff. The things you want to buy. A house is made up of other stuff, such as windows and doors. The term stuff is less technical that you expect in a course on object-oriented programming, but it does give you a reference point to begin learning object-oriented programming.
  • 7. A Look at How We See the World. Objects. Abstract Objects and Instances. Classes and structures. Objects and classes. Methods. Lecture Outlines
  • 8. Objects What is meant by Object? Stuff is an object. A house is an object. The things you have in your house are objects. Things your throw away are objects. Things you want to buy are objects. All of us, regardless of our background, view the world as objects. An object is a person, place, thing, concept, or possibly event.
  • 9. How to learn about Objects? Each of us is considered an object in the world of object-oriented programming. We call this object a person. A person is described by using two groups of features: Attributes First name Last name Height Weight Behaviors Sits Stands Walks Runs Objects
  • 10. How to learn about Objects? Another example of objects is an automobile, airplane, and even a sales order form are objects. Attributes and behaviors of an automobile and airplane can be described as follows: Attributes Width Height. Weight. Wheels dimensions. Engine specs. many other attributes. Behaviors Move in a direction. Stop. Steered to a different direction. Can perform many other actions. Objects
  • 11. A Look at How We See the World. Objects. Abstract Objects and Instances. Classes and structures. Objects and classes. Methods. Lecture Outlines
  • 12. What are abstract objects and instances? programmers view an object in two ways (abstract object-real object). The term abstract object is a description of a real object minus details. Real objects First Name. Last Name. Height. Weight. Abstract Objects Bob. Smith. 6 feet tall. 160 pounds. Programmers create an abstract object and then use the abstract object to create a real object. A real object is called an instance of the abstract object. You can say that a real person is an instance of the abstract person (cookie cutter is a good example). Abstract Objects and Instances
  • 13. Why we need to define Objects? Focusing on objects makes it easy for us to understand complex things. Objects enable us to look at details that are of interest to us and ignore other details that we are not interested in. For example, a teacher is a person and has many of the attributes and behaviors. you probably ignore many of the teachers attributes and behaviors and focus on only those that relate to your education. Likewise, the teacher focuses on your attributes and behaviors that indicate how well you are learning material in class. Both you and your teacher simplify your relationship by deciding attributes and behaviors that are important to each of your objectives and then use only those attributes and behaviors in your relationship. Abstract Objects and Instances
  • 14. A Look at How We See the World. Objects. Abstract Objects and Instances. Classes and structures. Objects and classes. Methods. Lecture Outlines
  • 15. What is the difference between Classes and Structures? Class: it provides flexibility in combining data and methods and it provides re-usability (inheritance) Structure: It provides data grouping. To understand the difference between classes and structures we should know the difference between heap and stack memories. Classes and structures Class Structure All members are private by default All members are public by default Allow to perform clean-up (garbage collector) as it work on heap memory Structures cannot allow garbage collector so no efficient memory management Size of empty class = 1 Byte Size of empty structure = 0 Byte Classes fits for larger and complex objects Structures are good for small and isolated model objects.
  • 16. What is the difference between Heap and Stack memories? Heap and Stack memories Heap Stack Reference type: created on heap memory Value type: Created on stack memory Memory is accessible by all functions To create a new function we have to create a new stack Used when we dont know the amount of memory used Used when we know exactly the amount of memory used Use pointers Dont require pointers Variable allocation is low Variable allocation is fast Dynamic memory location Static memory location Unlimited size Limited size Variables can be re-sized Variables cannot be re-sized
  • 17. A Look at How We See the World. Objects. Abstract Objects and Instances. Classes and structures. Objects and classes. Methods. Lecture Outlines
  • 18. What is the relation between Objects and Classes in OOP? Objects: a piece of code that represents real life entity (they are an instance of a Class). Class: it contains one or more objects. Class is a structure where we can define variables and methods to utilize objects. Without Class, Objects doesnt exist. Without Objects we commonly use static function of Class. A Person has saving bank account Objects and Classes Class student { ID no; Name; Grades; GPA; }; Collection of Objects Object Class
  • 19. What are the characteristics of a class? It is an extensible program-code-template for creating objects. A class provides initial values for state member variables and implementation of behavior. In many languages, the class name is used as the name for the class. When an object is created by a constructor of the class, the resulting object is called an instance of the class, and the member variables specific to the object are called instance variables, to contrast with the class variables shared across the class. Objects and Classes
  • 20. Classes are composed from structural and behavioral parts. Programming languages that include classes as a programming construct offer support, for various class-related features, and the syntax required to use these features varies greatly from one programming language to another. Objects and Classes
  • 21. Example of a class Objects and Classes
  • 22. Another example of a class Objects and Classes
  • 23. A class definition in C++ code Objects and Classes
  • 24. Design and implementation of a class? A class is a template that defines attributes and methods of a real- word object. Defining a Class: A class definition defines attributes and methods that are members of the class. A Class definition using C++ is as follows: Keyword class Class name Class body Objects and Classes
  • 25. What is meant by attribute of a class? An attribute of a class is a variable called an instance variable. Declaring an Instance Variable: A declaration statement in Java or C++ consists of the following three parts: 1) Data type. 2) Instance variable name. 3) Semicolon. Objects and Classes
  • 26. Data Type: A data type is a keyword that tells the computer the kind of data you want to store in a memory location. The data type implies to the computer how much memory to reserve and how to handle the data stored once it is stored at that memory location. it is very important that you have a strong understanding of what a data type is and how to specify a data type when declaring a variable. Data Types
  • 27. Data Type in C++: Data Types
  • 28. Data Type in Java: Data Types
  • 29. Examples of data Types: You tell the computer to reserve space for an integer by using the data type int. The computer already knows how much memory to reserve to store an integer. The data type also tells the computer the kind of data that will be stored at the memory location. This is important because computers manipulate data of some data types differently than data of other data types. This is similar to the warehouse manager who treats a case of fuel oil differently than a case of baseballs. Data Types
  • 30. Instance variable name: The name of an instance variable is given by the programmer. It should represent the nature of the data stored at the memory location. The variable name is used throughout the program to refer to the contents of the corresponding memory location. For example, studentNumber is a perfect name for a variable used to store a student number because the name tells you the nature of the data associated with the variable. The variable name is used throughout the program to refer to the contents of the corresponding memory location. Data Types
  • 33. Instance variable name: An instance variable is a type of class attribute (or class property, field, or data member). The same differences between instance and class members applies to methods (functions). Therefore, a class may have both instance method and class method. Data Types