SlideShare a Scribd company logo
Java & JEE Training
Session 7 – Object Oriented Analysis and Design with
Java
Page 1Classification: Restricted
Agenda
• Object Oriented Programming Concepts
• Introduction to OO Analysis and Design
Java & JEE Training
Object Oriented Programming
Page 3Classification: Restricted
Object Oriented Programming
• Why OO programming?
• What is OOAD? Why?
Page 4Classification: Restricted
Why Object Oriented?
Page 5Classification: Restricted
5
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 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
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?
Harry’s mental image Model with Procedural language
Page 8Classification: 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 9Classification: 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 10Classification: Restricted
Object Oriented Programming
• Consists of classes and object.
• Object communicates with each other by passing messages
What is an
object????
Page 11Classification: Restricted
Object States
An Object has State and Behavior
Page 12Classification: 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 13Classification: Restricted
Class
• Class is Blue Print
• Logical structure
• Set of instructions given to JVM , how to create instance ( object ) out of
it.
Page 14Classification: 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 15Classification: 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 16Classification: 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 17Classification: 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 18Classification: Restricted
18
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 19Classification: 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 20Classification: Restricted
What is Object-Orientation
- Polymorphism
Objects of different classes respond to the same message differently.
Page 21Classification: Restricted
Advantages of Object Oriented Approach
• Realistic Modelling
Page 22Classification: Restricted
Advantages of Object Oriented Programing
• Realistic Modelling
Bike
String color;
String model;
Integer speed;
Accelerate()
Decelerate()
Break()
Page 23Classification: Restricted
Advantages of Object Oriented Approach
• Code Reusability
Contacts1: Tom
Name: Tom
Number : 456-
789-7895
Email
:tom@gmail.com
createContact
updateContact
deleteContact
Page 24Classification: Restricted
Advantages of Object Oriented Programing
• Flexibility to change:
WordAppV1 WordAppV2
Page 25Classification: Restricted
Advantages of Object Oriented
• Modularity
Java & JEE Training
Object Oriented Analysis and Design
Page 27Classification: Restricted
Difference between Analysis and Design…
• A basic system (or subsystem)
SystemInput Output
Page 28Classification: Restricted
Difference between Analysis and Design…
• Analysis
• Design
SystemInput ????
????Input Output
Page 29Classification: Restricted
29
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 30Classification: Restricted
30
Traceability => Maintainability
Artificial problem
Accidental design
Page 31Classification: 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 33Classification: 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 34Classification: 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 35Classification: 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 36Classification: 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 37Classification: Restricted
Thank You!

More Related Content

What's hot (20)

OOPS Characteristics
OOPS CharacteristicsOOPS Characteristics
OOPS Characteristics
baabtra.com - No. 1 supplier of quality freshers
 
Object oriented programming With C#
Object oriented programming With C#Object oriented programming With C#
Object oriented programming With C#
Youssef Mohammed Abohaty
 
Object oriented programming concepts
Object oriented programming conceptsObject oriented programming concepts
Object oriented programming concepts
rahuld115
 
Chapter2 array of objects
Chapter2 array of objectsChapter2 array of objects
Chapter2 array of objects
Mahmoud Alfarra
 
04. Review OOP with Java
04. Review OOP with Java04. Review OOP with Java
04. Review OOP with Java
Oum Saokosal
 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT
Ajay Chimmani
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
Moutaz Haddara
 
Characteristics of oop
Characteristics of oopCharacteristics of oop
Characteristics of oop
Rasim Izhar Ali
 
Classes And Objects
Classes And ObjectsClasses And Objects
Classes And Objects
rahulsahay19
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
emailharmeet
 
Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programming
Abzetdin Adamov
 
Oops concept on c#
Oops concept on c#Oops concept on c#
Oops concept on c#
baabtra.com - No. 1 supplier of quality freshers
 
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
Mahmoud Alfarra
 
Java Programming - Polymorphism
Java Programming - PolymorphismJava Programming - Polymorphism
Java Programming - Polymorphism
Oum Saokosal
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Sandeep Karthikeyan
 
Session 13 - Exception handling - continued
Session 13 - Exception handling - continuedSession 13 - Exception handling - continued
Session 13 - Exception handling - continued
PawanMM
 
Ruby OOP: Objects over Classes
Ruby OOP: Objects over ClassesRuby OOP: Objects over Classes
Ruby OOP: Objects over Classes
Aman King
 
Object oriented programming concept- Saurabh Upadhyay
Object oriented programming concept- Saurabh UpadhyayObject oriented programming concept- Saurabh Upadhyay
Object oriented programming concept- Saurabh Upadhyay
Saurabh Upadhyay
 
Inner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVAInner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVA
Tech_MX
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
emailharmeet
 
Object oriented programming concepts
Object oriented programming conceptsObject oriented programming concepts
Object oriented programming concepts
rahuld115
 
Chapter2 array of objects
Chapter2 array of objectsChapter2 array of objects
Chapter2 array of objects
Mahmoud Alfarra
 
04. Review OOP with Java
04. Review OOP with Java04. Review OOP with Java
04. Review OOP with Java
Oum Saokosal
 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT
Ajay Chimmani
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
Moutaz Haddara
 
Classes And Objects
Classes And ObjectsClasses And Objects
Classes And Objects
rahulsahay19
 
Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programming
Abzetdin Adamov
 
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
Mahmoud Alfarra
 
Java Programming - Polymorphism
Java Programming - PolymorphismJava Programming - Polymorphism
Java Programming - Polymorphism
Oum Saokosal
 
Session 13 - Exception handling - continued
Session 13 - Exception handling - continuedSession 13 - Exception handling - continued
Session 13 - Exception handling - continued
PawanMM
 
Ruby OOP: Objects over Classes
Ruby OOP: Objects over ClassesRuby OOP: Objects over Classes
Ruby OOP: Objects over Classes
Aman King
 
Object oriented programming concept- Saurabh Upadhyay
Object oriented programming concept- Saurabh UpadhyayObject oriented programming concept- Saurabh Upadhyay
Object oriented programming concept- Saurabh Upadhyay
Saurabh Upadhyay
 
Inner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVAInner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVA
Tech_MX
 

Similar to Session 07 - Intro to Object Oriented Programming with Java (20)

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
 
Core Java for Selenium
Core Java for SeleniumCore Java for Selenium
Core Java for Selenium
Rajathi-QA
 
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.pptJava Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
akashsachu221
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
Atikur Rahman
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
 
Object oriented vs. object based programming
Object oriented vs. object based  programmingObject oriented vs. object based  programming
Object oriented vs. object based programming
Mohammad Kamrul Hasan
 
C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
Information Technology Center
 
C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
Information Technology Center
 
Overview of Object Oriented Programming using C++
Overview of Object Oriented Programming using C++Overview of Object Oriented Programming using C++
Overview of Object Oriented Programming using C++
jayanthi699330
 
PPT_Object Oriented Programming .pptx
PPT_Object Oriented Programming     .pptxPPT_Object Oriented Programming     .pptx
PPT_Object Oriented Programming .pptx
MDFARHAN3070
 
PPT_Object Oriented Programming (2).pptx
PPT_Object Oriented Programming (2).pptxPPT_Object Oriented Programming (2).pptx
PPT_Object Oriented Programming (2).pptx
faizus786
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
RatnaJava
 
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
TabassumMaktum
 
javaopps concepts
javaopps conceptsjavaopps concepts
javaopps concepts
Nikhil Agrawal
 
OOP.pptx
OOP.pptxOOP.pptx
OOP.pptx
ashmitsen2005
 
power poitnt of oops
power poitnt of oopspower poitnt of oops
power poitnt of oops
Dhiraj Kumar
 
Object -oriented analysis and design.ppt
Object -oriented analysis and design.pptObject -oriented analysis and design.ppt
Object -oriented analysis and design.ppt
pierrerj05
 
Chapter 1- Introduction.ppt
Chapter 1- Introduction.pptChapter 1- Introduction.ppt
Chapter 1- Introduction.ppt
TigistTilahun1
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
ACCESS Health Digital
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
AnsgarMary
 
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
 
Core Java for Selenium
Core Java for SeleniumCore Java for Selenium
Core Java for Selenium
Rajathi-QA
 
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.pptJava Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
akashsachu221
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
Atikur Rahman
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
 
Object oriented vs. object based programming
Object oriented vs. object based  programmingObject oriented vs. object based  programming
Object oriented vs. object based programming
Mohammad Kamrul Hasan
 
Overview of Object Oriented Programming using C++
Overview of Object Oriented Programming using C++Overview of Object Oriented Programming using C++
Overview of Object Oriented Programming using C++
jayanthi699330
 
PPT_Object Oriented Programming .pptx
PPT_Object Oriented Programming     .pptxPPT_Object Oriented Programming     .pptx
PPT_Object Oriented Programming .pptx
MDFARHAN3070
 
PPT_Object Oriented Programming (2).pptx
PPT_Object Oriented Programming (2).pptxPPT_Object Oriented Programming (2).pptx
PPT_Object Oriented Programming (2).pptx
faizus786
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
RatnaJava
 
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
TabassumMaktum
 
power poitnt of oops
power poitnt of oopspower poitnt of oops
power poitnt of oops
Dhiraj Kumar
 
Object -oriented analysis and design.ppt
Object -oriented analysis and design.pptObject -oriented analysis and design.ppt
Object -oriented analysis and design.ppt
pierrerj05
 
Chapter 1- Introduction.ppt
Chapter 1- Introduction.pptChapter 1- Introduction.ppt
Chapter 1- Introduction.ppt
TigistTilahun1
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
AnsgarMary
 
Ad

More from PawanMM (20)

Session 48 - JS, JSON and AJAX
Session 48 - JS, JSON and AJAXSession 48 - JS, JSON and AJAX
Session 48 - JS, JSON and AJAX
PawanMM
 
Session 46 - Spring - Part 4 - Spring MVC
Session 46 - Spring - Part 4 - Spring MVCSession 46 - Spring - Part 4 - Spring MVC
Session 46 - Spring - Part 4 - Spring MVC
PawanMM
 
Session 45 - Spring - Part 3 - AOP
Session 45 - Spring - Part 3 - AOPSession 45 - Spring - Part 3 - AOP
Session 45 - Spring - Part 3 - AOP
PawanMM
 
Session 44 - Spring - Part 2 - Autowiring, Annotations, Java based Configuration
Session 44 - Spring - Part 2 - Autowiring, Annotations, Java based ConfigurationSession 44 - Spring - Part 2 - Autowiring, Annotations, Java based Configuration
Session 44 - Spring - Part 2 - Autowiring, Annotations, Java based Configuration
PawanMM
 
Session 43 - Spring - Part 1 - IoC DI Beans
Session 43 - Spring - Part 1 - IoC DI BeansSession 43 - Spring - Part 1 - IoC DI Beans
Session 43 - Spring - Part 1 - IoC DI Beans
PawanMM
 
Session 42 - Struts 2 Hibernate Integration
Session 42 - Struts 2 Hibernate IntegrationSession 42 - Struts 2 Hibernate Integration
Session 42 - Struts 2 Hibernate Integration
PawanMM
 
Session 41 - Struts 2 Introduction
Session 41 - Struts 2 IntroductionSession 41 - Struts 2 Introduction
Session 41 - Struts 2 Introduction
PawanMM
 
Session 40 - Hibernate - Part 2
Session 40 - Hibernate - Part 2Session 40 - Hibernate - Part 2
Session 40 - Hibernate - Part 2
PawanMM
 
Session 39 - Hibernate - Part 1
Session 39 - Hibernate - Part 1Session 39 - Hibernate - Part 1
Session 39 - Hibernate - Part 1
PawanMM
 
Session 38 - Core Java (New Features) - Part 1
Session 38 - Core Java (New Features) - Part 1Session 38 - Core Java (New Features) - Part 1
Session 38 - Core Java (New Features) - Part 1
PawanMM
 
Session 37 - JSP - Part 2 (final)
Session 37 - JSP - Part 2 (final)Session 37 - JSP - Part 2 (final)
Session 37 - JSP - Part 2 (final)
PawanMM
 
Session 36 - JSP - Part 1
Session 36 - JSP - Part 1Session 36 - JSP - Part 1
Session 36 - JSP - Part 1
PawanMM
 
Session 35 - Design Patterns
Session 35 - Design PatternsSession 35 - Design Patterns
Session 35 - Design Patterns
PawanMM
 
Session 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsSession 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design Patterns
PawanMM
 
Session 33 - Session Management using other Techniques
Session 33 - Session Management using other TechniquesSession 33 - Session Management using other Techniques
Session 33 - Session Management using other Techniques
PawanMM
 
Session 32 - Session Management using Cookies
Session 32 - Session Management using CookiesSession 32 - Session Management using Cookies
Session 32 - Session Management using Cookies
PawanMM
 
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web AppsSession 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
PawanMM
 
Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6
PawanMM
 
Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5
PawanMM
 
Session 28 - Servlets - Part 4
Session 28 - Servlets - Part 4Session 28 - Servlets - Part 4
Session 28 - Servlets - Part 4
PawanMM
 
Session 48 - JS, JSON and AJAX
Session 48 - JS, JSON and AJAXSession 48 - JS, JSON and AJAX
Session 48 - JS, JSON and AJAX
PawanMM
 
Session 46 - Spring - Part 4 - Spring MVC
Session 46 - Spring - Part 4 - Spring MVCSession 46 - Spring - Part 4 - Spring MVC
Session 46 - Spring - Part 4 - Spring MVC
PawanMM
 
Session 45 - Spring - Part 3 - AOP
Session 45 - Spring - Part 3 - AOPSession 45 - Spring - Part 3 - AOP
Session 45 - Spring - Part 3 - AOP
PawanMM
 
Session 44 - Spring - Part 2 - Autowiring, Annotations, Java based Configuration
Session 44 - Spring - Part 2 - Autowiring, Annotations, Java based ConfigurationSession 44 - Spring - Part 2 - Autowiring, Annotations, Java based Configuration
Session 44 - Spring - Part 2 - Autowiring, Annotations, Java based Configuration
PawanMM
 
Session 43 - Spring - Part 1 - IoC DI Beans
Session 43 - Spring - Part 1 - IoC DI BeansSession 43 - Spring - Part 1 - IoC DI Beans
Session 43 - Spring - Part 1 - IoC DI Beans
PawanMM
 
Session 42 - Struts 2 Hibernate Integration
Session 42 - Struts 2 Hibernate IntegrationSession 42 - Struts 2 Hibernate Integration
Session 42 - Struts 2 Hibernate Integration
PawanMM
 
Session 41 - Struts 2 Introduction
Session 41 - Struts 2 IntroductionSession 41 - Struts 2 Introduction
Session 41 - Struts 2 Introduction
PawanMM
 
Session 40 - Hibernate - Part 2
Session 40 - Hibernate - Part 2Session 40 - Hibernate - Part 2
Session 40 - Hibernate - Part 2
PawanMM
 
Session 39 - Hibernate - Part 1
Session 39 - Hibernate - Part 1Session 39 - Hibernate - Part 1
Session 39 - Hibernate - Part 1
PawanMM
 
Session 38 - Core Java (New Features) - Part 1
Session 38 - Core Java (New Features) - Part 1Session 38 - Core Java (New Features) - Part 1
Session 38 - Core Java (New Features) - Part 1
PawanMM
 
Session 37 - JSP - Part 2 (final)
Session 37 - JSP - Part 2 (final)Session 37 - JSP - Part 2 (final)
Session 37 - JSP - Part 2 (final)
PawanMM
 
Session 36 - JSP - Part 1
Session 36 - JSP - Part 1Session 36 - JSP - Part 1
Session 36 - JSP - Part 1
PawanMM
 
Session 35 - Design Patterns
Session 35 - Design PatternsSession 35 - Design Patterns
Session 35 - Design Patterns
PawanMM
 
Session 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsSession 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design Patterns
PawanMM
 
Session 33 - Session Management using other Techniques
Session 33 - Session Management using other TechniquesSession 33 - Session Management using other Techniques
Session 33 - Session Management using other Techniques
PawanMM
 
Session 32 - Session Management using Cookies
Session 32 - Session Management using CookiesSession 32 - Session Management using Cookies
Session 32 - Session Management using Cookies
PawanMM
 
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web AppsSession 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
PawanMM
 
Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6
PawanMM
 
Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5
PawanMM
 
Session 28 - Servlets - Part 4
Session 28 - Servlets - Part 4Session 28 - Servlets - Part 4
Session 28 - Servlets - Part 4
PawanMM
 
Ad

Recently uploaded (20)

Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Cisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdfCisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdf
superdpz
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
Edge AI and Vision Alliance
 
TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025
Suyash Joshi
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Cisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdfCisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdf
superdpz
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
Edge AI and Vision Alliance
 
TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025
Suyash Joshi
 

Session 07 - Intro to Object Oriented Programming with Java

  • 1. Java & JEE Training Session 7 – Object Oriented Analysis and Design with Java
  • 2. Page 1Classification: Restricted Agenda • Object Oriented Programming Concepts • Introduction to OO Analysis and Design
  • 3. Java & JEE Training Object Oriented Programming
  • 4. Page 3Classification: Restricted Object Oriented Programming • Why OO programming? • What is OOAD? Why?
  • 6. Page 5Classification: Restricted 5 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 …   
  • 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
  • 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? Harry’s mental image Model with Procedural language
  • 9. Page 8Classification: 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
  • 10. Page 9Classification: 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.
  • 11. Page 10Classification: Restricted Object Oriented Programming • Consists of classes and object. • Object communicates with each other by passing messages What is an object????
  • 12. Page 11Classification: Restricted Object States An Object has State and Behavior
  • 13. Page 12Classification: 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()
  • 14. Page 13Classification: Restricted Class • Class is Blue Print • Logical structure • Set of instructions given to JVM , how to create instance ( object ) out of it.
  • 15. Page 14Classification: 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
  • 16. Page 15Classification: 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
  • 17. Page 16Classification: Restricted Contacts Name: Number email createContact updateContact deleteContact Contacts1: Tom Name: Tom Number : 456-789- 7895 Email :[email protected] createContact updateContact Contacts2: Jack Name: Jack Number 789-896- 8965 Email: [email protected] createContact updateContact
  • 18. Page 17Classification: 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.
  • 19. Page 18Classification: Restricted 18 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
  • 20. Page 19Classification: 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
  • 21. Page 20Classification: Restricted What is Object-Orientation - Polymorphism Objects of different classes respond to the same message differently.
  • 22. Page 21Classification: Restricted Advantages of Object Oriented Approach • Realistic Modelling
  • 23. Page 22Classification: Restricted Advantages of Object Oriented Programing • Realistic Modelling Bike String color; String model; Integer speed; Accelerate() Decelerate() Break()
  • 24. Page 23Classification: Restricted Advantages of Object Oriented Approach • Code Reusability Contacts1: Tom Name: Tom Number : 456- 789-7895 Email :[email protected] createContact updateContact deleteContact
  • 25. Page 24Classification: Restricted Advantages of Object Oriented Programing • Flexibility to change: WordAppV1 WordAppV2
  • 26. Page 25Classification: Restricted Advantages of Object Oriented • Modularity
  • 27. Java & JEE Training Object Oriented Analysis and Design
  • 28. Page 27Classification: Restricted Difference between Analysis and Design… • A basic system (or subsystem) SystemInput Output
  • 29. Page 28Classification: Restricted Difference between Analysis and Design… • Analysis • Design SystemInput ???? ????Input Output
  • 30. Page 29Classification: Restricted 29 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!
  • 31. Page 30Classification: Restricted 30 Traceability => Maintainability Artificial problem Accidental design
  • 32. Page 31Classification: Restricted More later… • More practical examples of OOAD in later sessions… • Now let us start looking at Object Oriented Programming concepts using Java
  • 33. Java & JEE Training Object Oriented Programming with Java - Basic Class Demo
  • 34. Page 33Classification: 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.
  • 35. Page 34Classification: 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); } }
  • 36. Page 35Classification: 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(); } }
  • 37. Page 36Classification: 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