SlideShare a Scribd company logo
1 of 30
© Oxford University Press 2013. All rights reserved.
Programming in Java, 2e
Sachin Malhotra
Saurabh Choudhary
© Oxford University Press 2013. All rights reserved.
Chapter 1
Introduction to OOP
© Oxford University Press 2013. All rights reserved.
Syllabus
© Oxford University Press 2013. All rights reserved.
Procedural Languages
• C, PASCAL, FORTRAN languages are all procedural
languages.
• A program is a list of instructions.
• Complexity increases as the length of a program
increases .
• Divide a large program into different functions or
modules
• Problems with Procedural languages
– functions have unrestricted access to global data
– that they provide poor mapping to real world.
– Procedural languages are not extensible.
© Oxford University Press 2013. All rights reserved.
Introduction to OOP
• A programming paradigm
• deals with concepts of object to build
programs and software applications
• Modeled around real world
• The world we live in is full of objects.
• Every object has a well defined identity,
attributes and behavior.
• Objects exhibit the same behavior in
programming.
© Oxford University Press 2013. All rights reserved.
OOP Principles
• Classes
• Objects
• Abstraction
• Encapsulation
• Inheritance
• Polymorphism
© Oxford University Press 2013. All rights reserved.
Class
• blueprint for an object, a plan, or template
• Description of a number of similar objects is
also called class.
• A class is also defined as a new data type; a
user defined type.
• Defining a class doesn’t create an object.
• Classes are logical in nature.
• For e.g. Furniture do not have any existence
but tables and chairs do exist.
© Oxford University Press 2013. All rights reserved.
Object
• Defined as instance of a class. for e.g. table, chair are
all instances of the class Furniture.
• Objects have unique identity, state and behavior
• State is defined by the attributes of the object.
• Different objects have different attributes (
characteristics)
– For e.g. the attributes of student are name, roll number etc
• Behavior actually determines the way an object
interacts with other objects.
– Synonym to functions
© Oxford University Press 2013. All rights reserved.
Example
© Oxford University Press 2013. All rights reserved.
Abstraction
• In real life, Humans manage complexity by
abstracting details away.
• In programming, we manage complexity by
concentrating only on the essential
characteristics and suppressing
implementation details.
• For e.g. Car.
© Oxford University Press 2013. All rights reserved.
Inheritance
• Way to adopt characteristics of a class into another
class.
• have two types of classes one is base class and other
is subclass.
• A parent-child relationship among classes in
inheritance.
• A subclass inherits all the properties of base class. In
addition to this it can add its own features
(properties and behavior).
• For e.g. we can categorize vehicle into car, bus,
scooter, ships, planes etc.
© Oxford University Press 2013. All rights reserved.
Inheritance
© Oxford University Press 2013. All rights reserved.
Encapsulation
• Binding of data and procedure
• Restrict any one to directly alter our data.
• Also known as Data hiding.
© Oxford University Press 2013. All rights reserved.
Encapsulation
© Oxford University Press 2013. All rights reserved.
Polymorphism
• Polymorphism means many forms.
• Same thing being used in different forms. For e.g.
certain bacteria that exhibit more than one
morphological form.
• Operating overloading is not supported by java
• addition operator (+) is an exception can be used for
addition of two integers as well as concatenation of
two strings.
• Compile-time and Run-time polymorphism
© Oxford University Press 2013. All rights reserved.
Your Turn
• What is a class?
• What is an object?
• What are the various Object Oriented
Principles?
Comparison of OO and Procedural Languages
Procedural language Object Oriented language
Separate data from function that operate
on them
Encapsulate data and methods in a class
Not suitable for defining abstract types Suitable for defining abstract types
Debugging is difficult Debugging is easier
Difficult to implement change Easier to manage and implement change
Not suitable for larger
applications/programs
Suitable for larger programs and
applications
Analysis and design not so easy Analysis and Design Made Easier
Faster Slower
Less flexible Highly flexible
Data and procedure based Object oriented
Less reusable More reusable
Only data and procedures are there Inheritance, encapsulation and
polymorphism are key features
Use top down approach Use bottom up approach
Only a function call to another Object communication is there
C, Basic, FORTRAN JAVA,C++, VB.NET, C#.NET
© Oxford University Press 2013. All rights reserved.
UML
• a standard language for OOAD
• graphical notation for all entities (class, object
e.t.c)
• helps in visualising the system
• reducing complexity and improving software
quality.
© Oxford University Press 2013. All rights reserved.
UML Notation For class
Employee
name
address
designation
salary
addEmployee
deleteEmployee
searchEmployee
Class
Attributes
Behavior
© Oxford University Press 2013. All rights reserved.
UML Notation for Object
Object
Attributes
:Employee
name=peter
address=NY
designation=manager
salary=10000
addEmployee
deleteEmployee
searchEmployee
© Oxford University Press 2013. All rights reserved.
Multiplicity
• An instance of a class can be related to any
number of instances of other class known as
multiplicity of the relation.
– One-to-one
– One-to-many
– Many-to-many
© Oxford University Press 2013. All rights reserved.
One-to-One relation
© Oxford University Press 2013. All rights reserved.
One to Many
© Oxford University Press 2013. All rights reserved.
Many-to-many
© Oxford University Press 2013. All rights reserved.
Notation for Inheritance
• Triangle and square are two type of shape.
• They inherit Shape class.
© Oxford University Press 2013. All rights reserved.
UML Diagram depicting polymorphism
© Oxford University Press 2013. All rights reserved.
Aggregation
© Oxford University Press 2013. All rights reserved.
Composition
© Oxford University Press 2013. All rights reserved.
Application for OOP
• Real Time systems
• Artificial Intelligence
• Expert Systems
• Neural Networks
• Database Management
• Mobile Applications
© Oxford University Press 2013. All rights reserved.
Summary
• OOP revolves around object and classes.
• A class is defined as group of objects with similar attributes
and behavior.
• OOP principles are Inheritance, Abstraction, Encapsulation
and Polymorphism.
• For building large projects a technique known as OOAD is
used.
• OOA deals with what the system should do and OOD deals
with how the system achieves what has been specified by OO
Analysis.
• OOAD is realized with the help of a language known as UML.
• UML stands for Unified modeling language is a standard
language used for visualizing the software.

More Related Content

What's hot

Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Javawiradikusuma
 
1. Overview of Java
1. Overview of Java1. Overview of Java
1. Overview of JavaNilesh Dalvi
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programmingSachin Sharma
 
6. Exception Handling
6. Exception Handling6. Exception Handling
6. Exception HandlingNilesh Dalvi
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and InterfaceHaris Bin Zahid
 
5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and Intefaces5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and IntefacesNilesh Dalvi
 
Methods and constructors
Methods and constructorsMethods and constructors
Methods and constructorsRavi_Kant_Sahu
 
Intro to Object Oriented Programming with Java
Intro to Object Oriented Programming with Java Intro to Object Oriented Programming with Java
Intro to Object Oriented Programming with Java Hitesh-Java
 
Java object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - BrainsmartlabsJava object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - Brainsmartlabsbrainsmartlabsedu
 

What's hot (18)

Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Java
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
1. Overview of Java
1. Overview of Java1. Overview of Java
1. Overview of Java
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
 
6. Exception Handling
6. Exception Handling6. Exception Handling
6. Exception Handling
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 
5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and Intefaces5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and Intefaces
 
Methods and constructors
Methods and constructorsMethods and constructors
Methods and constructors
 
Intro to Object Oriented Programming with Java
Intro to Object Oriented Programming with Java Intro to Object Oriented Programming with Java
Intro to Object Oriented Programming with Java
 
OOP Java
OOP JavaOOP Java
OOP Java
 
Java object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - BrainsmartlabsJava object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - Brainsmartlabs
 
Internationalization
InternationalizationInternationalization
Internationalization
 
01 introduction to oop and java
01 introduction to oop and java01 introduction to oop and java
01 introduction to oop and java
 
Packages
PackagesPackages
Packages
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
 
Basic IO
Basic IOBasic IO
Basic IO
 

Similar to introduction to oops presentation

Similar to introduction to oops presentation (20)

SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
 
L1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdfL1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdf
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
DISE - OOAD Using UML
DISE - OOAD Using UMLDISE - OOAD Using UML
DISE - OOAD Using UML
 
Introduction
IntroductionIntroduction
Introduction
 
PERICLES workshop (London 15 October 2015) - Introduction
PERICLES workshop (London 15 October 2015) - IntroductionPERICLES workshop (London 15 October 2015) - Introduction
PERICLES workshop (London 15 October 2015) - Introduction
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptx
 
Object model
Object modelObject model
Object model
 
Object model
Object modelObject model
Object model
 
Object model
Object modelObject model
Object model
 
Object model
Object modelObject model
Object model
 
Object model
Object modelObject model
Object model
 
Object model
Object modelObject model
Object model
 
Object model
Object modelObject model
Object model
 
Intro to oop.pptx
Intro to oop.pptxIntro to oop.pptx
Intro to oop.pptx
 
O6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdfO6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdf
 
Unit 2.pptx
Unit 2.pptxUnit 2.pptx
Unit 2.pptx
 
Unit 2.pptx
Unit 2.pptxUnit 2.pptx
Unit 2.pptx
 

More from HarshithaAllu

Environmenal protection
Environmenal protectionEnvironmenal protection
Environmenal protectionHarshithaAllu
 
Social project work-political parties
Social project work-political partiesSocial project work-political parties
Social project work-political partiesHarshithaAllu
 
ROLE OF PRINT MEDIA IN FREEDOM STRUGGLE
ROLE OF PRINT MEDIA IN FREEDOM STRUGGLEROLE OF PRINT MEDIA IN FREEDOM STRUGGLE
ROLE OF PRINT MEDIA IN FREEDOM STRUGGLEHarshithaAllu
 
java programming - applets
java programming - appletsjava programming - applets
java programming - appletsHarshithaAllu
 
PRAGRAMMING IN JAVA (BEGINNER)
PRAGRAMMING IN JAVA (BEGINNER)PRAGRAMMING IN JAVA (BEGINNER)
PRAGRAMMING IN JAVA (BEGINNER)HarshithaAllu
 
Hyper text transport protocol
Hyper text transport protocolHyper text transport protocol
Hyper text transport protocolHarshithaAllu
 
PRESSENTATION SKILLS
PRESSENTATION SKILLSPRESSENTATION SKILLS
PRESSENTATION SKILLSHarshithaAllu
 
IR remote sensing technology
IR remote sensing technologyIR remote sensing technology
IR remote sensing technologyHarshithaAllu
 
Closed loop (automated) insulin delivery
Closed loop (automated) insulin delivery Closed loop (automated) insulin delivery
Closed loop (automated) insulin delivery HarshithaAllu
 

More from HarshithaAllu (11)

Environmenal protection
Environmenal protectionEnvironmenal protection
Environmenal protection
 
Social project work-political parties
Social project work-political partiesSocial project work-political parties
Social project work-political parties
 
ROLE OF PRINT MEDIA IN FREEDOM STRUGGLE
ROLE OF PRINT MEDIA IN FREEDOM STRUGGLEROLE OF PRINT MEDIA IN FREEDOM STRUGGLE
ROLE OF PRINT MEDIA IN FREEDOM STRUGGLE
 
Operating system
Operating systemOperating system
Operating system
 
java programming - applets
java programming - appletsjava programming - applets
java programming - applets
 
PRAGRAMMING IN JAVA (BEGINNER)
PRAGRAMMING IN JAVA (BEGINNER)PRAGRAMMING IN JAVA (BEGINNER)
PRAGRAMMING IN JAVA (BEGINNER)
 
Structure of neuron
Structure of neuronStructure of neuron
Structure of neuron
 
Hyper text transport protocol
Hyper text transport protocolHyper text transport protocol
Hyper text transport protocol
 
PRESSENTATION SKILLS
PRESSENTATION SKILLSPRESSENTATION SKILLS
PRESSENTATION SKILLS
 
IR remote sensing technology
IR remote sensing technologyIR remote sensing technology
IR remote sensing technology
 
Closed loop (automated) insulin delivery
Closed loop (automated) insulin delivery Closed loop (automated) insulin delivery
Closed loop (automated) insulin delivery
 

Recently uploaded

buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 

Recently uploaded (20)

buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 

introduction to oops presentation

  • 1. © Oxford University Press 2013. All rights reserved. Programming in Java, 2e Sachin Malhotra Saurabh Choudhary
  • 2. © Oxford University Press 2013. All rights reserved. Chapter 1 Introduction to OOP
  • 3. © Oxford University Press 2013. All rights reserved. Syllabus
  • 4. © Oxford University Press 2013. All rights reserved. Procedural Languages • C, PASCAL, FORTRAN languages are all procedural languages. • A program is a list of instructions. • Complexity increases as the length of a program increases . • Divide a large program into different functions or modules • Problems with Procedural languages – functions have unrestricted access to global data – that they provide poor mapping to real world. – Procedural languages are not extensible.
  • 5. © Oxford University Press 2013. All rights reserved. Introduction to OOP • A programming paradigm • deals with concepts of object to build programs and software applications • Modeled around real world • The world we live in is full of objects. • Every object has a well defined identity, attributes and behavior. • Objects exhibit the same behavior in programming.
  • 6. © Oxford University Press 2013. All rights reserved. OOP Principles • Classes • Objects • Abstraction • Encapsulation • Inheritance • Polymorphism
  • 7. © Oxford University Press 2013. All rights reserved. Class • blueprint for an object, a plan, or template • Description of a number of similar objects is also called class. • A class is also defined as a new data type; a user defined type. • Defining a class doesn’t create an object. • Classes are logical in nature. • For e.g. Furniture do not have any existence but tables and chairs do exist.
  • 8. © Oxford University Press 2013. All rights reserved. Object • Defined as instance of a class. for e.g. table, chair are all instances of the class Furniture. • Objects have unique identity, state and behavior • State is defined by the attributes of the object. • Different objects have different attributes ( characteristics) – For e.g. the attributes of student are name, roll number etc • Behavior actually determines the way an object interacts with other objects. – Synonym to functions
  • 9. © Oxford University Press 2013. All rights reserved. Example
  • 10. © Oxford University Press 2013. All rights reserved. Abstraction • In real life, Humans manage complexity by abstracting details away. • In programming, we manage complexity by concentrating only on the essential characteristics and suppressing implementation details. • For e.g. Car.
  • 11. © Oxford University Press 2013. All rights reserved. Inheritance • Way to adopt characteristics of a class into another class. • have two types of classes one is base class and other is subclass. • A parent-child relationship among classes in inheritance. • A subclass inherits all the properties of base class. In addition to this it can add its own features (properties and behavior). • For e.g. we can categorize vehicle into car, bus, scooter, ships, planes etc.
  • 12. © Oxford University Press 2013. All rights reserved. Inheritance
  • 13. © Oxford University Press 2013. All rights reserved. Encapsulation • Binding of data and procedure • Restrict any one to directly alter our data. • Also known as Data hiding.
  • 14. © Oxford University Press 2013. All rights reserved. Encapsulation
  • 15. © Oxford University Press 2013. All rights reserved. Polymorphism • Polymorphism means many forms. • Same thing being used in different forms. For e.g. certain bacteria that exhibit more than one morphological form. • Operating overloading is not supported by java • addition operator (+) is an exception can be used for addition of two integers as well as concatenation of two strings. • Compile-time and Run-time polymorphism
  • 16. © Oxford University Press 2013. All rights reserved. Your Turn • What is a class? • What is an object? • What are the various Object Oriented Principles?
  • 17. Comparison of OO and Procedural Languages Procedural language Object Oriented language Separate data from function that operate on them Encapsulate data and methods in a class Not suitable for defining abstract types Suitable for defining abstract types Debugging is difficult Debugging is easier Difficult to implement change Easier to manage and implement change Not suitable for larger applications/programs Suitable for larger programs and applications Analysis and design not so easy Analysis and Design Made Easier Faster Slower Less flexible Highly flexible Data and procedure based Object oriented Less reusable More reusable Only data and procedures are there Inheritance, encapsulation and polymorphism are key features Use top down approach Use bottom up approach Only a function call to another Object communication is there C, Basic, FORTRAN JAVA,C++, VB.NET, C#.NET
  • 18. © Oxford University Press 2013. All rights reserved. UML • a standard language for OOAD • graphical notation for all entities (class, object e.t.c) • helps in visualising the system • reducing complexity and improving software quality.
  • 19. © Oxford University Press 2013. All rights reserved. UML Notation For class Employee name address designation salary addEmployee deleteEmployee searchEmployee Class Attributes Behavior
  • 20. © Oxford University Press 2013. All rights reserved. UML Notation for Object Object Attributes :Employee name=peter address=NY designation=manager salary=10000 addEmployee deleteEmployee searchEmployee
  • 21. © Oxford University Press 2013. All rights reserved. Multiplicity • An instance of a class can be related to any number of instances of other class known as multiplicity of the relation. – One-to-one – One-to-many – Many-to-many
  • 22. © Oxford University Press 2013. All rights reserved. One-to-One relation
  • 23. © Oxford University Press 2013. All rights reserved. One to Many
  • 24. © Oxford University Press 2013. All rights reserved. Many-to-many
  • 25. © Oxford University Press 2013. All rights reserved. Notation for Inheritance • Triangle and square are two type of shape. • They inherit Shape class.
  • 26. © Oxford University Press 2013. All rights reserved. UML Diagram depicting polymorphism
  • 27. © Oxford University Press 2013. All rights reserved. Aggregation
  • 28. © Oxford University Press 2013. All rights reserved. Composition
  • 29. © Oxford University Press 2013. All rights reserved. Application for OOP • Real Time systems • Artificial Intelligence • Expert Systems • Neural Networks • Database Management • Mobile Applications
  • 30. © Oxford University Press 2013. All rights reserved. Summary • OOP revolves around object and classes. • A class is defined as group of objects with similar attributes and behavior. • OOP principles are Inheritance, Abstraction, Encapsulation and Polymorphism. • For building large projects a technique known as OOAD is used. • OOA deals with what the system should do and OOD deals with how the system achieves what has been specified by OO Analysis. • OOAD is realized with the help of a language known as UML. • UML stands for Unified modeling language is a standard language used for visualizing the software.