SlideShare a Scribd company logo
1 of 37
Core Java Training
Object Oriented Programming
Page 1Classification: Restricted
Agenda
• Object Oriented Programming Concepts
• Introduction to OO Analysis and Design
Page 2Classification: Restricted
Object Oriented Programming
• Why OO programming?
• What is OOAD? Why?
Page 3Classification: Restricted
Why Object Oriented?
Page 4Classification: Restricted
4
What kind of language can alleviate difficulties with
communication & complexity hopefully well?
Why Object-Oriented?
“The "software crises" came about when people realized the major
problems in software development were … caused by communication
difficulties and the management of complexity” [Budd]
The Whorfian Hypothesis:
Human beings … are very much at the mercy of the particular language
which has become the medium of expression for their society … the 'real
world' is … built upon the language habits …



Page 5Classification: Restricted
Why Object-Oriented?
For conceptual.. Modelling reasons…
What kind of language can be used to create this concept diagram, or Harry’s
mental image?
Harry’s mental image
Page 6Classification: Restricted
Why Object-Oriented?
For conceptual.. Modelling reasons…
What kind of language can be used to create this concept diagram, or Harry’s
mental image?
Harry’s mental image Model with Procedural language
Page 7Classification: Restricted
Why Object-Oriented?
For conceptual.. Modelling reasons…
What kind of language can be used to create this concept diagram, or Harry’s
mental image?
Water
Rivers Oceans
Fish
Penguins
Crocodiles
Fresh water
Salt water
have
have
have
live in
have
have
Harry’s mental image Model with Object Oriented
Page 8Classification: Restricted
Why Object-Oriented?
Why Model?
• To understand why a software system is needed, what it should do, and
how it should do it.
• To communicate our understanding of why, what and how.
• To detect commonalities and differences in your perception, my
perception, his perception and her perception of reality.
• To detect misunderstandings and miscommunications.
Page 9Classification: Restricted
Object Oriented Programming
• Consists of classes and object.
• Object communicates with each other by passing messages
What is an
object????
Page 10Classification: Restricted
Object States
An Object has State and Behavior
Page 11Classification: Restricted
Objects
• Objects have state and behavior
State: What an object knows about itself
Behavior :What an object can do.
Object
Name
State =
charecter
stics
Behaviou
r:
Dog
State:
Name
Breed
Height
Weight
Behavi
our:
eat()
run()
walk()
Page 12Classification: Restricted
Class
• Class is Blue Print
• Logical structure
• Set of instructions given to JVM , how to create instance ( object ) out of
it.
Page 13Classification: Restricted
Class
• Class consists of
• Member variables and member methods.
• State/ characteristics is represented via member variables
• Member methods defines the responsibility of the class
• Data within object represents its state.
• State - Member Variables
• To:
• Text:
• Behavior – Member functions
• sendSms
• Forward
• delete
Page 14Classification: Restricted
Messages
To
Text
sendSms
Forward
cancel
Messages1: Tom
To : 123-456-
7896
Text : Hi Tom,
sendSms
Forward
cancel
Messages2: Jack
To : 478-963-
7896
Text : Hi Jack
sendSms
Save
Delete
Class
Object Tom
Object Jack
Page 15Classification: Restricted
Contacts
Name:
Number
email
createContact
updateContact
deleteContact
Contacts1: Tom
Name: Tom
Number : 456-789-
7895
Email
:tom@gmail.com
createContact
updateContact
Contacts2: Jack
Name: Jack
Number 789-896-
8965
Email:
jack@gmail.com
createContact
updateContact
Page 16Classification: Restricted
Features of OOP: 4 pillars
• Inheritance: When one object acquires all the properties and behaviours of
parent object i.e. known as inheritance. It provides code reusability.
• Polymorphism: When one task is performed by different ways i.e. known as
polymorphism. For example: to convince the customer differently, to draw
something, shape or rectangle etc. In Java, we use method overloading and
method overriding to achieve polymorphism.
• Abstraction: Hiding internal details and showing functionality. In Java, we
use abstract class and interface to achieve abstraction.
• Encapsulation: Binding (or wrapping) code and data together into a single
unit is known as encapsulation. For example: capsule, it is wrapped with
different medicines. A Java class is the example of encapsulation. Java
bean is the fully encapsulated class because all the data members are
private here.
Page 17Classification: Restricted
17
Encapsulation
a.k.a. information hiding
Objects encapsulate:
property
behavior as a collection of methods invoked by messages
…state as a collection of instance variables
Abstraction
Focus on the essential
Omits tremendous amount of details
…Focus on what an object “is and does”
What is Object-Orientation
- Abstraction and Encapsulation
Page 18Classification: Restricted
What is Object-Orientation
- Subclass vs. Superclass / Inheritance
• Specialization: The act of defining one class as a refinement of another.
• Subclass: A class defined in terms of a specialization of a superclass using
inheritance.
• Superclass: A class serving as a base for inheritance in a class hierarchy
• Inheritance: Automatic duplication of superclass attribute and behavior definitions
in subclass.
multiple inheritance?
Person
name
SSN
Student
std-id
level
Employee
emp-id
age
Page 19Classification: Restricted
What is Object-Orientation
- Polymorphism
Objects of different classes respond to the same message differently.
Page 20Classification: Restricted
Advantages of Object Oriented Approach
• Realistic Modelling
Page 21Classification: Restricted
Advantages of Object Oriented Programing
• Realistic Modelling
Bike
String color;
String model;
Integer speed;
Accelerate()
Decelerate()
Break()
Page 22Classification: Restricted
Advantages of Object Oriented Approach
• Code Reusability
Contacts1: Tom
Name: Tom
Number : 456-
789-7895
Email
:tom@gmail.com
createContact
updateContact
deleteContact
Page 23Classification: Restricted
Advantages of Object Oriented Programing
• Flexibility to change:
WordAppV1 WordAppV2
Page 24Classification: Restricted
Advantages of Object Oriented
• Modularity
Java & JEE Training
Object Oriented Analysis and Design
Page 26Classification: Restricted
Difference between Analysis and Design…
• A basic system (or subsystem)
SystemInput Output
Page 27Classification: Restricted
Difference between Analysis and Design…
• Analysis
• Design
SystemInput ????
????Input Output
Page 28Classification: Restricted
28
What is OOAD?
• Analysis — understanding, finding and describing concepts in the problem
domain.
• Design — understanding and defining software solution/objects that
represent the analysis concepts and will eventually be implemented in
code.
• OOAD — Analysis is object-oriented and design is object-oriented. A
software development approach that emphasizes a logical solution based
on objects.
Maintainability through Traceability!
Page 29Classification: Restricted
29
Traceability => Maintainability
Artificial problem
Accidental design
Page 30Classification: Restricted
More later…
• More practical examples of OOAD in later sessions…
• Now let us start looking at Object Oriented Programming concepts using
Java
Java & JEE Training
Object Oriented Programming with Java
- Basic Class Demo
Page 32Classification: Restricted
Naming Conventions
Name Convention
class name should start with uppercase letter and be a noun e.g.
String, Color, Button, System, Thread etc.
interface name should start with uppercase letter and be an adjective
e.g. Runnable, Remote, ActionListener etc.
method name should start with lowercase letter and be a verb e.g.
actionPerformed(), main(), print(), println() etc.
variable name should start with lowercase letter e.g. firstName,
orderNumber etc.
package name should be in lowercase letter e.g. java, lang, sql, util
etc.
constants name should be in uppercase letter. e.g. RED, YELLOW,
MAX_PRIORITY etc.
Page 33Classification: Restricted
Object and Class in Java - Demo
A basic example of a class:
class Student1{
int id;//data member (also instance variable)
String name;//data member(also instance variable)
public static void main(String args[]){
Student1 s1=new Student1();//creating an object of Student
System.out.println(s1.id);
System.out.println(s1.name);
}
}
Page 34Classification: Restricted
Another Example of Objects and Classes in Java
class Student2{
int rollno;
String name;
void insertRecord(int r, String n){ //method
rollno=r;
name=n;
}
void displayInformation(){System.out.println(rollno+" "+name);}//method
public static void main(String args[]){
Student2 s1=new Student2();
Student2 s2=new Student2();
s1.insertRecord(111,"Karan");
s2.insertRecord(222,"Aryan");
s1.displayInformation();
s2.displayInformation();
}
}
Page 35Classification: Restricted
Topics to be covered in next session
• Deep dive into coding OOP with Java… with practical examples.
• How to create a class
• How to create objects
• How to create instance variables
• How to create class variables
• Constructors
Page 36Classification: Restricted
Thank You!

More Related Content

What's hot

Java object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - BrainsmartlabsJava object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - Brainsmartlabsbrainsmartlabsedu
 
OOPs with Java - Packaging and Access Modifiers
OOPs with Java - Packaging and Access Modifiers OOPs with Java - Packaging and Access Modifiers
OOPs with Java - Packaging and Access Modifiers Hitesh-Java
 
Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Javawiradikusuma
 
java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming NeedsRaja Sekhar
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentalsAnsgarMary
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with JavaJussi Pohjolainen
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).pptAlok Kumar
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP conceptsAhmed Farag
 
OOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingOOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingPurvik Rana
 

What's hot (15)

OOPs in Java
OOPs in JavaOOPs in Java
OOPs in Java
 
Java object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - BrainsmartlabsJava object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - Brainsmartlabs
 
OOPs with Java - Packaging and Access Modifiers
OOPs with Java - Packaging and Access Modifiers OOPs with Java - Packaging and Access Modifiers
OOPs with Java - Packaging and Access Modifiers
 
Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Java
 
Oop java
Oop javaOop java
Oop java
 
java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming Needs
 
OOP in Java
OOP in JavaOOP in Java
OOP in Java
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
 
Oops concept on c#
Oops concept on c#Oops concept on c#
Oops concept on c#
 
OOPS in Java
OOPS in JavaOOPS in Java
OOPS in Java
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
OOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingOOPs Concepts - Android Programming
OOPs Concepts - Android Programming
 

Similar to Intro to Object Oriented Programming with Java

Session 07 - Intro to Object Oriented Programming with Java
Session 07 - Intro to Object Oriented Programming with JavaSession 07 - Intro to Object Oriented Programming with Java
Session 07 - Intro to Object Oriented Programming with JavaPawanMM
 
Core Java for Selenium
Core Java for SeleniumCore Java for Selenium
Core Java for SeleniumRajathi-QA
 
Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programmingAbzetdin Adamov
 
Introduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologiesIntroduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologiesTabassumMaktum
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxAtikur Rahman
 
Object oriented vs. object based programming
Object oriented vs. object based  programmingObject oriented vs. object based  programming
Object oriented vs. object based programmingMohammad Kamrul Hasan
 
OO Development 4 - Object Concepts
OO Development 4 - Object ConceptsOO Development 4 - Object Concepts
OO Development 4 - Object ConceptsRandy Connolly
 
Java OOPs Concepts.docx
Java OOPs Concepts.docxJava OOPs Concepts.docx
Java OOPs Concepts.docxFredWauyo
 
power poitnt of oops
power poitnt of oopspower poitnt of oops
power poitnt of oopsDhiraj Kumar
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented ProgrammingRatnaJava
 
Object And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesObject And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesJessica Deakin
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingMoutaz Haddara
 

Similar to Intro to Object Oriented Programming with Java (20)

Session 07 - Intro to Object Oriented Programming with Java
Session 07 - Intro to Object Oriented Programming with JavaSession 07 - Intro to Object Oriented Programming with Java
Session 07 - Intro to Object Oriented Programming with Java
 
Characteristics of oop
Characteristics of oopCharacteristics of oop
Characteristics of oop
 
C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
 
C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
 
Core Java for Selenium
Core Java for SeleniumCore Java for Selenium
Core Java for Selenium
 
Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programming
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Introduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologiesIntroduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologies
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
 
Object oriented vs. object based programming
Object oriented vs. object based  programmingObject oriented vs. object based  programming
Object oriented vs. object based programming
 
javaopps concepts
javaopps conceptsjavaopps concepts
javaopps concepts
 
OO Development 4 - Object Concepts
OO Development 4 - Object ConceptsOO Development 4 - Object Concepts
OO Development 4 - Object Concepts
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
 
Java OOPs Concepts.docx
Java OOPs Concepts.docxJava OOPs Concepts.docx
Java OOPs Concepts.docx
 
OOP intro.ppt
OOP intro.pptOOP intro.ppt
OOP intro.ppt
 
power poitnt of oops
power poitnt of oopspower poitnt of oops
power poitnt of oops
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Oops
OopsOops
Oops
 
Object And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesObject And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) Languages
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 

More from Hitesh-Java

Spring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVCSpring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVCHitesh-Java
 
Spring - Part 3 - AOP
Spring - Part 3 - AOPSpring - Part 3 - AOP
Spring - Part 3 - AOPHitesh-Java
 
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slidesSpring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slidesHitesh-Java
 
Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Hitesh-Java
 
JSP - Part 2 (Final)
JSP - Part 2 (Final) JSP - Part 2 (Final)
JSP - Part 2 (Final) Hitesh-Java
 
Struts 2 - Hibernate Integration
Struts 2 - Hibernate Integration Struts 2 - Hibernate Integration
Struts 2 - Hibernate Integration Hitesh-Java
 
Struts 2 - Introduction
Struts 2 - Introduction Struts 2 - Introduction
Struts 2 - Introduction Hitesh-Java
 
Hibernate - Part 2
Hibernate - Part 2 Hibernate - Part 2
Hibernate - Part 2 Hitesh-Java
 
Hibernate - Part 1
Hibernate - Part 1Hibernate - Part 1
Hibernate - Part 1Hitesh-Java
 
Java IO, Serialization
Java IO, Serialization Java IO, Serialization
Java IO, Serialization Hitesh-Java
 
Collections - Maps
Collections - Maps Collections - Maps
Collections - Maps Hitesh-Java
 
Review Session - Part -2
Review Session - Part -2Review Session - Part -2
Review Session - Part -2Hitesh-Java
 
Collections - Lists, Sets
Collections - Lists, Sets Collections - Lists, Sets
Collections - Lists, Sets Hitesh-Java
 
Collections - Sorting, Comparing Basics
Collections - Sorting, Comparing Basics Collections - Sorting, Comparing Basics
Collections - Sorting, Comparing Basics Hitesh-Java
 
Collections - Array List
Collections - Array List Collections - Array List
Collections - Array List Hitesh-Java
 

More from Hitesh-Java (20)

Spring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVCSpring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVC
 
Spring - Part 3 - AOP
Spring - Part 3 - AOPSpring - Part 3 - AOP
Spring - Part 3 - AOP
 
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slidesSpring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
 
Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans
 
JSP - Part 2 (Final)
JSP - Part 2 (Final) JSP - Part 2 (Final)
JSP - Part 2 (Final)
 
JSP - Part 1
JSP - Part 1JSP - Part 1
JSP - Part 1
 
Struts 2 - Hibernate Integration
Struts 2 - Hibernate Integration Struts 2 - Hibernate Integration
Struts 2 - Hibernate Integration
 
Struts 2 - Introduction
Struts 2 - Introduction Struts 2 - Introduction
Struts 2 - Introduction
 
Hibernate - Part 2
Hibernate - Part 2 Hibernate - Part 2
Hibernate - Part 2
 
Hibernate - Part 1
Hibernate - Part 1Hibernate - Part 1
Hibernate - Part 1
 
JDBC Part - 2
JDBC Part - 2JDBC Part - 2
JDBC Part - 2
 
JDBC
JDBCJDBC
JDBC
 
Java IO, Serialization
Java IO, Serialization Java IO, Serialization
Java IO, Serialization
 
Inner Classes
Inner Classes Inner Classes
Inner Classes
 
Collections - Maps
Collections - Maps Collections - Maps
Collections - Maps
 
Review Session - Part -2
Review Session - Part -2Review Session - Part -2
Review Session - Part -2
 
Collections - Lists, Sets
Collections - Lists, Sets Collections - Lists, Sets
Collections - Lists, Sets
 
Collections - Sorting, Comparing Basics
Collections - Sorting, Comparing Basics Collections - Sorting, Comparing Basics
Collections - Sorting, Comparing Basics
 
Collections - Array List
Collections - Array List Collections - Array List
Collections - Array List
 
Object Class
Object Class Object Class
Object Class
 

Recently uploaded

New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Recently uploaded (20)

New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Intro to Object Oriented Programming with Java

  • 1. Core Java Training Object Oriented Programming
  • 2. Page 1Classification: Restricted Agenda • Object Oriented Programming Concepts • Introduction to OO Analysis and Design
  • 3. Page 2Classification: Restricted Object Oriented Programming • Why OO programming? • What is OOAD? Why?
  • 5. Page 4Classification: Restricted 4 What kind of language can alleviate difficulties with communication & complexity hopefully well? Why Object-Oriented? “The "software crises" came about when people realized the major problems in software development were … caused by communication difficulties and the management of complexity” [Budd] The Whorfian Hypothesis: Human beings … are very much at the mercy of the particular language which has become the medium of expression for their society … the 'real world' is … built upon the language habits …   
  • 6. Page 5Classification: Restricted Why Object-Oriented? For conceptual.. Modelling reasons… What kind of language can be used to create this concept diagram, or Harry’s mental image? Harry’s mental image
  • 7. Page 6Classification: Restricted Why Object-Oriented? For conceptual.. Modelling reasons… What kind of language can be used to create this concept diagram, or Harry’s mental image? Harry’s mental image Model with Procedural language
  • 8. Page 7Classification: Restricted Why Object-Oriented? For conceptual.. Modelling reasons… What kind of language can be used to create this concept diagram, or Harry’s mental image? Water Rivers Oceans Fish Penguins Crocodiles Fresh water Salt water have have have live in have have Harry’s mental image Model with Object Oriented
  • 9. Page 8Classification: Restricted Why Object-Oriented? Why Model? • To understand why a software system is needed, what it should do, and how it should do it. • To communicate our understanding of why, what and how. • To detect commonalities and differences in your perception, my perception, his perception and her perception of reality. • To detect misunderstandings and miscommunications.
  • 10. Page 9Classification: Restricted Object Oriented Programming • Consists of classes and object. • Object communicates with each other by passing messages What is an object????
  • 11. Page 10Classification: Restricted Object States An Object has State and Behavior
  • 12. Page 11Classification: Restricted Objects • Objects have state and behavior State: What an object knows about itself Behavior :What an object can do. Object Name State = charecter stics Behaviou r: Dog State: Name Breed Height Weight Behavi our: eat() run() walk()
  • 13. Page 12Classification: Restricted Class • Class is Blue Print • Logical structure • Set of instructions given to JVM , how to create instance ( object ) out of it.
  • 14. Page 13Classification: Restricted Class • Class consists of • Member variables and member methods. • State/ characteristics is represented via member variables • Member methods defines the responsibility of the class • Data within object represents its state. • State - Member Variables • To: • Text: • Behavior – Member functions • sendSms • Forward • delete
  • 15. Page 14Classification: Restricted Messages To Text sendSms Forward cancel Messages1: Tom To : 123-456- 7896 Text : Hi Tom, sendSms Forward cancel Messages2: Jack To : 478-963- 7896 Text : Hi Jack sendSms Save Delete Class Object Tom Object Jack
  • 16. Page 15Classification: Restricted Contacts Name: Number email createContact updateContact deleteContact Contacts1: Tom Name: Tom Number : 456-789- 7895 Email :tom@gmail.com createContact updateContact Contacts2: Jack Name: Jack Number 789-896- 8965 Email: jack@gmail.com createContact updateContact
  • 17. Page 16Classification: Restricted Features of OOP: 4 pillars • Inheritance: When one object acquires all the properties and behaviours of parent object i.e. known as inheritance. It provides code reusability. • Polymorphism: When one task is performed by different ways i.e. known as polymorphism. For example: to convince the customer differently, to draw something, shape or rectangle etc. In Java, we use method overloading and method overriding to achieve polymorphism. • Abstraction: Hiding internal details and showing functionality. In Java, we use abstract class and interface to achieve abstraction. • Encapsulation: Binding (or wrapping) code and data together into a single unit is known as encapsulation. For example: capsule, it is wrapped with different medicines. A Java class is the example of encapsulation. Java bean is the fully encapsulated class because all the data members are private here.
  • 18. Page 17Classification: Restricted 17 Encapsulation a.k.a. information hiding Objects encapsulate: property behavior as a collection of methods invoked by messages …state as a collection of instance variables Abstraction Focus on the essential Omits tremendous amount of details …Focus on what an object “is and does” What is Object-Orientation - Abstraction and Encapsulation
  • 19. Page 18Classification: Restricted What is Object-Orientation - Subclass vs. Superclass / Inheritance • Specialization: The act of defining one class as a refinement of another. • Subclass: A class defined in terms of a specialization of a superclass using inheritance. • Superclass: A class serving as a base for inheritance in a class hierarchy • Inheritance: Automatic duplication of superclass attribute and behavior definitions in subclass. multiple inheritance? Person name SSN Student std-id level Employee emp-id age
  • 20. Page 19Classification: Restricted What is Object-Orientation - Polymorphism Objects of different classes respond to the same message differently.
  • 21. Page 20Classification: Restricted Advantages of Object Oriented Approach • Realistic Modelling
  • 22. Page 21Classification: Restricted Advantages of Object Oriented Programing • Realistic Modelling Bike String color; String model; Integer speed; Accelerate() Decelerate() Break()
  • 23. Page 22Classification: Restricted Advantages of Object Oriented Approach • Code Reusability Contacts1: Tom Name: Tom Number : 456- 789-7895 Email :tom@gmail.com createContact updateContact deleteContact
  • 24. Page 23Classification: Restricted Advantages of Object Oriented Programing • Flexibility to change: WordAppV1 WordAppV2
  • 25. Page 24Classification: Restricted Advantages of Object Oriented • Modularity
  • 26. Java & JEE Training Object Oriented Analysis and Design
  • 27. Page 26Classification: Restricted Difference between Analysis and Design… • A basic system (or subsystem) SystemInput Output
  • 28. Page 27Classification: Restricted Difference between Analysis and Design… • Analysis • Design SystemInput ???? ????Input Output
  • 29. Page 28Classification: Restricted 28 What is OOAD? • Analysis — understanding, finding and describing concepts in the problem domain. • Design — understanding and defining software solution/objects that represent the analysis concepts and will eventually be implemented in code. • OOAD — Analysis is object-oriented and design is object-oriented. A software development approach that emphasizes a logical solution based on objects. Maintainability through Traceability!
  • 30. Page 29Classification: Restricted 29 Traceability => Maintainability Artificial problem Accidental design
  • 31. Page 30Classification: Restricted More later… • More practical examples of OOAD in later sessions… • Now let us start looking at Object Oriented Programming concepts using Java
  • 32. Java & JEE Training Object Oriented Programming with Java - Basic Class Demo
  • 33. Page 32Classification: Restricted Naming Conventions Name Convention class name should start with uppercase letter and be a noun e.g. String, Color, Button, System, Thread etc. interface name should start with uppercase letter and be an adjective e.g. Runnable, Remote, ActionListener etc. method name should start with lowercase letter and be a verb e.g. actionPerformed(), main(), print(), println() etc. variable name should start with lowercase letter e.g. firstName, orderNumber etc. package name should be in lowercase letter e.g. java, lang, sql, util etc. constants name should be in uppercase letter. e.g. RED, YELLOW, MAX_PRIORITY etc.
  • 34. Page 33Classification: Restricted Object and Class in Java - Demo A basic example of a class: class Student1{ int id;//data member (also instance variable) String name;//data member(also instance variable) public static void main(String args[]){ Student1 s1=new Student1();//creating an object of Student System.out.println(s1.id); System.out.println(s1.name); } }
  • 35. Page 34Classification: Restricted Another Example of Objects and Classes in Java class Student2{ int rollno; String name; void insertRecord(int r, String n){ //method rollno=r; name=n; } void displayInformation(){System.out.println(rollno+" "+name);}//method public static void main(String args[]){ Student2 s1=new Student2(); Student2 s2=new Student2(); s1.insertRecord(111,"Karan"); s2.insertRecord(222,"Aryan"); s1.displayInformation(); s2.displayInformation(); } }
  • 36. Page 35Classification: Restricted Topics to be covered in next session • Deep dive into coding OOP with Java… with practical examples. • How to create a class • How to create objects • How to create instance variables • How to create class variables • Constructors