SlideShare a Scribd company logo
What is Java?
Programming Language
Fast
Secure
Reliable
What is Java?
Programming Language
Fast
Secure
Reliable
Some Facts about JAVA:
Developed by JAMES GOSLING at SUN MICROSYSTEMS
Related to two languages C and C++
HOW ?
JAVA derives its Syntax from C and,
Many concepts based on OOPs were influenced by C++
Initially JAVA was named as “Oak” But was renamed by “JAVA” in 1995
3977 classes
The Way JavaWorks :
Objective :Write an Application and make it run on whether
devices your friends have.
The JAVA BUZZWORDS :
Simple
Secure
Portable
Dynamic
Distributed
Object-oriented
Robust(Consistent)
Multithreaded
Architecture neutral
High Performance
Major OOP Principles :
Abstraction
Encapsulation
Inheritance
Polymorphism
Abstraction:
 Manages Complexity(Generalization)
 Hierarchal Classification
 Makes Java more Understandable
Encapsulation:
Binds Code and data Together
Keeps it safe from outside interference and Misuse
It works through Classes. A
AB
C
CD
C is accessible with in this Block
Inheritance :
Process of acquiring the properties of another object
In absence of inheritance, each object needs to define all characteristics
Polymorphism :
An Ability of an object to acquire more than one form
For example:
public interface Vegetarian{ }
public class Animal{ }
public class Deer extends Animal implements Vegetarian{ }
A Deer IS-A Animal
A Deer IS-A Vegetarian
A Deer IS-A Deer
A Deer IS-A Object
Interface :
 It is an Collection of Abstract Methods
 It can contain any no. of methods
 How do it do this???
HOW ?
Lets Design Some
Patterns
General solution to programmers problems faced while designing software
Increase the Code Maintainability
GOF: Erich Gamma, Richard helm, Ralph Johnsons and John vlissides
Helps in Reusing the codes
Time saving and Cost reduction
Types Of Patterns
Creational Pattern:
Way to create Objects while hiding the Creational Logic
Structural Pattern:
Concerns class and object composition
Behavioral pattern:
Referred to communication between objects
J2EE:
Presentation tier.
Classification Of Patterns
Creational pattern:
1. Factory Pattern
2. Singleton Pattern
3. Abstract Factory Pattern
4. Builder Pattern
5. Prototype Pattern
Structural Patterns:
1. Adapter Pattern
2. Composite Pattern
3. Proxy Pattern
4. Flyweight Pattern
5. Façade Pattern
6. Bridge Pattern
7. Decorator Pattern
Behavioral Pattern:
1. Template Method Pattern
2. Mediator Pattern
3. Chain of Responsibility Pattern
4. Observer Pattern
5. Strategy Pattern
6. Command Pattern
7. State Pattern
8. Visitor Pattern
9. Iterator Pattern
10. Memento Pattern
Factory Pattern
Factory Pattern
Comes Under the creational Pattern
Create object without Exposing the Creational Logic
used to instantiate an object from one among a set of classes based on a logic
Assume that you have a set of classes which extends a common super
class or interface. Now you will create a concrete class with a method which
accepts one or more arguments.This method is our factory method.
Factory Pattern
Super Class
SubClass 3Sub Class 2Sub Class 1
Factory Super ClassLogic
Factory Pattern
Adapter Pattern
Allows you to use two Incompatible Interfaces to work together
Used when the client expects a(target) interface
Adapter Class allows the use of available Interface and the target
 interface
Any class can work together as long as the Adapter solves the issue
that All classes must implements every method defined by the
shared interface
Adapter Pattern
Client
Enemy Attacker
<Interface>
Fire weapon():void
Drive Forward():void
Assign driver():void
Enemy Robot Adapter
Fire weapon():void
Drive Forward():void
Assign driver():void
Enemy Robot
Smash with hands():void
walk Forward():void
React to human():void
Enemy Robot
Enemy Attacker
(Target)
Enemy Robot Adapter
(Adaptor)
Enemy Robot
(Adaptee)
Adapter Pattern
Observer Pattern
In observer design pattern multiple observer objects registers with
a subject for change notification.When the state of subject changes,
it notifies the observers. Objects that listen or watch for change are
called observers and the object that is being watched for is called
subject.
Pattern involved is also called as publish-subscribe pattern. Model
view controller (MVC) architecture’s core uses the observer design
pattern.
Observer Pattern
Subject provides interface for observers to register and unregister
themselves with the subject.
Subject knows who its subscribers are.
Multiple observers can subscribe for notifications.
Subject publishes the notifications.
Subject just sends the notification saying the state has changed. It does
not pass any state information.
Once the notification is received from subject, observers call the subject
and get data that is changed.
Observer Pattern
Consider an excel sheet, data is shown to the user in different
views. Generally data is shown in grid cells and as required
different graphs, charts can be created for same data. Underlying
data is same and when that data (subject) state changes all the
different view are updated.
 When multiple
objects depend on
state of one object
and all these multiple
objects should be in
sync with the state of
this one object then
observer design
pattern is the right
choice to apply.
When?
Observer Pattern
Let us take a blog and
subscriber example for
observer design pattern
sample implementation.
Assume that there is a blog
and users register to that
blog for update.When a new
article is posted in the blog,
it will send update to the
registered users saying a
new article is posted.Then
the user will access the blog
and read the new article
posted. In this example, blog
is the subject and user is the
observer.
Proxy Design Pattern
Proxy means ‘in place of’. In attendance roll call, we give proxy for
our friends in college right? ‘Representing’ or ‘in place of’ or ‘on
behalf of’ are literal meanings of proxy and that directly explains
proxy design pattern.
Proxy Design Pattern
Remote Proxy – Represents an object locally which belongs to a
different address space.Think of an ATM implementation, it will
hold proxy objects for bank information that exists in the remote
server.
Virtual Proxy – In place of a complex or heavy object use a
skeleton representation.
Protection Proxy –working on a MNC? If so, you might be well
aware of the proxy server that provides you internet. Saying more
than provides, the right word is censors internet.
Smart Reference – Just we keep a link/reference to the real object
a kind of pointer.
Proxy Design Pattern
Provide a class which will limit access to another class
You may do this for Security reasons, because an Object is intensive
to Create, or is accessed from a remote location.
Proxy Design Pattern
Client
GetATMState
<interface>
+getATMState(): ATMState
+getCashINMachine():int
ATM Proxy
+getATMState(): ATMState
+getCashINMachine():int
ATM Machine
+getATMState(): ATMState
+getCashINMachine():int
MVC Design Pattern
Completely Separates the Calculation and Interface from each other
Model: Data and Model Used to Work with it
View:The Interface
Controller: Coordinates interactions between the view and Model
My Favorite One!!
Rahul Malhotra
rahulbtibusiness@gmail.com
+91-74041-37709
www.facebook.com/btiworld14

More Related Content

What's hot

Java design patterns
Java design patternsJava design patterns
Java design patterns
Shawn Brito
 
Java Design Pattern Interview Questions
Java Design Pattern Interview QuestionsJava Design Pattern Interview Questions
Java Design Pattern Interview Questionsjbashask
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | Edureka
Edureka!
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
Anuja Arosha
 
Sda 8
Sda   8Sda   8
GOF Design pattern with java
GOF Design pattern with javaGOF Design pattern with java
GOF Design pattern with java
Rajiv Gupta
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
Satheesh Sukumaran
 
Design Patterns Presentation - Chetan Gole
Design Patterns Presentation -  Chetan GoleDesign Patterns Presentation -  Chetan Gole
Design Patterns Presentation - Chetan Gole
Chetan Gole
 
Design pattern
Design patternDesign pattern
Design pattern
Thibaut De Broca
 
Gof design pattern
Gof design patternGof design pattern
Gof design pattern
naveen kumar
 
Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns pptAman Jain
 
Jump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternJump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design Pattern
Nishith Shukla
 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design Patterns
Anton Keks
 
Design patterns
Design patternsDesign patterns
Design patterns
Elyes Mejri
 
Behavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka PradhanBehavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka Pradhan
Priyanka Pradhan
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1
Shahzad
 
Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns Illustrated
Herman Peeren
 
Design Patterns & JDK Examples
Design Patterns & JDK ExamplesDesign Patterns & JDK Examples
Design Patterns & JDK Examples
Ender Aydin Orak
 
Design Patterns
Design PatternsDesign Patterns
Design Patternssoms_1
 

What's hot (20)

Java design patterns
Java design patternsJava design patterns
Java design patterns
 
Java Design Pattern Interview Questions
Java Design Pattern Interview QuestionsJava Design Pattern Interview Questions
Java Design Pattern Interview Questions
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | Edureka
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Sda 8
Sda   8Sda   8
Sda 8
 
Design pattern-presentation
Design pattern-presentationDesign pattern-presentation
Design pattern-presentation
 
GOF Design pattern with java
GOF Design pattern with javaGOF Design pattern with java
GOF Design pattern with java
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Design Patterns Presentation - Chetan Gole
Design Patterns Presentation -  Chetan GoleDesign Patterns Presentation -  Chetan Gole
Design Patterns Presentation - Chetan Gole
 
Design pattern
Design patternDesign pattern
Design pattern
 
Gof design pattern
Gof design patternGof design pattern
Gof design pattern
 
Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns ppt
 
Jump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternJump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design Pattern
 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design Patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Behavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka PradhanBehavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka Pradhan
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1
 
Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns Illustrated
 
Design Patterns & JDK Examples
Design Patterns & JDK ExamplesDesign Patterns & JDK Examples
Design Patterns & JDK Examples
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 

Viewers also liked

Java Design Patterns: The State Pattern
Java Design Patterns: The State PatternJava Design Patterns: The State Pattern
Java Design Patterns: The State Pattern
Antony Quinn
 
Top 9 design pattern interview questions answers
Top 9 design pattern interview questions answersTop 9 design pattern interview questions answers
Top 9 design pattern interview questions answershudsons168
 
Java8 training - Class 1
Java8 training  - Class 1Java8 training  - Class 1
Java8 training - Class 1
Marut Singh
 
Java8 training - class 2
Java8 training - class 2Java8 training - class 2
Java8 training - class 2
Marut Singh
 
Java8 training - class 3
Java8 training - class 3Java8 training - class 3
Java8 training - class 3
Marut Singh
 
Java buzzwords
Java buzzwordsJava buzzwords
Java buzzwords
ramesh517
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
Hoang Nguyen
 
Building Applications with a Graph Database
Building Applications with a Graph DatabaseBuilding Applications with a Graph Database
Building Applications with a Graph Database
Tobias Lindaaker
 
What is concurrency
What is concurrencyWhat is concurrency
What is concurrency
lodhran-hayat
 
Design patterns through java
Design patterns through javaDesign patterns through java
Design patterns through java
Aditya Bhuyan
 
Java8
Java8Java8
Jumping-with-java8
Jumping-with-java8Jumping-with-java8
Jumping-with-java8
Dhaval Dalal
 
Iterator Pattern Baljeet Sandhu 20060621
Iterator Pattern Baljeet Sandhu 20060621Iterator Pattern Baljeet Sandhu 20060621
Iterator Pattern Baljeet Sandhu 20060621melbournepatterns
 
Eclipse e4 Overview
Eclipse e4 OverviewEclipse e4 Overview
Eclipse e4 Overview
Lars Vogel
 
Java Hands-On Workshop
Java Hands-On WorkshopJava Hands-On Workshop
Java Hands-On Workshop
Arpit Poladia
 
Apache camel
Apache camelApache camel
Apache camel
Marut Singh
 
Concurrency & Parallel Programming
Concurrency & Parallel ProgrammingConcurrency & Parallel Programming
Concurrency & Parallel Programming
Ramazan AYYILDIZ
 
Java day2016 "Reinventing design patterns with java 8"
Java day2016 "Reinventing design patterns with java 8"Java day2016 "Reinventing design patterns with java 8"
Java day2016 "Reinventing design patterns with java 8"
Alexander Pashynskiy
 
Getting Started with IntelliJ IDEA as an Eclipse User
Getting Started with IntelliJ IDEA as an Eclipse UserGetting Started with IntelliJ IDEA as an Eclipse User
Getting Started with IntelliJ IDEA as an Eclipse User
ZeroTurnaround
 
Why Transcriptome? Why RNA-Seq? ENCODE answers….
Why Transcriptome? Why RNA-Seq?  ENCODE answers….Why Transcriptome? Why RNA-Seq?  ENCODE answers….
Why Transcriptome? Why RNA-Seq? ENCODE answers….
Mohammad Hossein Banabazi
 

Viewers also liked (20)

Java Design Patterns: The State Pattern
Java Design Patterns: The State PatternJava Design Patterns: The State Pattern
Java Design Patterns: The State Pattern
 
Top 9 design pattern interview questions answers
Top 9 design pattern interview questions answersTop 9 design pattern interview questions answers
Top 9 design pattern interview questions answers
 
Java8 training - Class 1
Java8 training  - Class 1Java8 training  - Class 1
Java8 training - Class 1
 
Java8 training - class 2
Java8 training - class 2Java8 training - class 2
Java8 training - class 2
 
Java8 training - class 3
Java8 training - class 3Java8 training - class 3
Java8 training - class 3
 
Java buzzwords
Java buzzwordsJava buzzwords
Java buzzwords
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
 
Building Applications with a Graph Database
Building Applications with a Graph DatabaseBuilding Applications with a Graph Database
Building Applications with a Graph Database
 
What is concurrency
What is concurrencyWhat is concurrency
What is concurrency
 
Design patterns through java
Design patterns through javaDesign patterns through java
Design patterns through java
 
Java8
Java8Java8
Java8
 
Jumping-with-java8
Jumping-with-java8Jumping-with-java8
Jumping-with-java8
 
Iterator Pattern Baljeet Sandhu 20060621
Iterator Pattern Baljeet Sandhu 20060621Iterator Pattern Baljeet Sandhu 20060621
Iterator Pattern Baljeet Sandhu 20060621
 
Eclipse e4 Overview
Eclipse e4 OverviewEclipse e4 Overview
Eclipse e4 Overview
 
Java Hands-On Workshop
Java Hands-On WorkshopJava Hands-On Workshop
Java Hands-On Workshop
 
Apache camel
Apache camelApache camel
Apache camel
 
Concurrency & Parallel Programming
Concurrency & Parallel ProgrammingConcurrency & Parallel Programming
Concurrency & Parallel Programming
 
Java day2016 "Reinventing design patterns with java 8"
Java day2016 "Reinventing design patterns with java 8"Java day2016 "Reinventing design patterns with java 8"
Java day2016 "Reinventing design patterns with java 8"
 
Getting Started with IntelliJ IDEA as an Eclipse User
Getting Started with IntelliJ IDEA as an Eclipse UserGetting Started with IntelliJ IDEA as an Eclipse User
Getting Started with IntelliJ IDEA as an Eclipse User
 
Why Transcriptome? Why RNA-Seq? ENCODE answers….
Why Transcriptome? Why RNA-Seq?  ENCODE answers….Why Transcriptome? Why RNA-Seq?  ENCODE answers….
Why Transcriptome? Why RNA-Seq? ENCODE answers….
 

Similar to JAVA design patterns and Basic OOp concepts

MCA NOTES.pdf
MCA NOTES.pdfMCA NOTES.pdf
MCA NOTES.pdf
RAJASEKHARV10
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
danhaley45372
 
Mac/iOS Design Patterns
Mac/iOS Design PatternsMac/iOS Design Patterns
Mac/iOS Design Patterns
Robert Brown
 
Jump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsJump Start To Ooad And Design Patterns
Jump Start To Ooad And Design Patterns
Lalit Kale
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkAkhil Mittal
 
1. Mini seminar intro
1. Mini seminar intro1. Mini seminar intro
1. Mini seminar intro
Leonid Maslov
 
Design Pattern with Actionscript
Design Pattern with ActionscriptDesign Pattern with Actionscript
Design Pattern with Actionscript
Daniel Swid
 
Object-Oriented Programming in Java.pdf
Object-Oriented Programming in Java.pdfObject-Oriented Programming in Java.pdf
Object-Oriented Programming in Java.pdf
Bharath Choudhary
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Luis Valencia
 
M.c.a. (sem iv)- java programming
M.c.a. (sem   iv)- java programmingM.c.a. (sem   iv)- java programming
M.c.a. (sem iv)- java programming
Praveen Chowdary
 
ActionScript Design Patterns
ActionScript Design Patterns ActionScript Design Patterns
ActionScript Design Patterns
Yoss Cohen
 
02 objective-c session 2
02  objective-c session 202  objective-c session 2
02 objective-c session 2
Amr Elghadban (AmrAngry)
 
Lecture01
Lecture01Lecture01
Lecture01
artgreen
 
OOP design patterns
OOP design patternsOOP design patterns
OOP design patterns
Igor Talevski
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Bill Buchan
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
Aneega
 

Similar to JAVA design patterns and Basic OOp concepts (20)

MCA NOTES.pdf
MCA NOTES.pdfMCA NOTES.pdf
MCA NOTES.pdf
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
 
Mac/iOS Design Patterns
Mac/iOS Design PatternsMac/iOS Design Patterns
Mac/iOS Design Patterns
 
Jump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsJump Start To Ooad And Design Patterns
Jump Start To Ooad And Design Patterns
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
 
1. Mini seminar intro
1. Mini seminar intro1. Mini seminar intro
1. Mini seminar intro
 
Java chapter 3
Java   chapter 3Java   chapter 3
Java chapter 3
 
Design Pattern with Actionscript
Design Pattern with ActionscriptDesign Pattern with Actionscript
Design Pattern with Actionscript
 
Object-Oriented Programming in Java.pdf
Object-Oriented Programming in Java.pdfObject-Oriented Programming in Java.pdf
Object-Oriented Programming in Java.pdf
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
 
M.c.a. (sem iv)- java programming
M.c.a. (sem   iv)- java programmingM.c.a. (sem   iv)- java programming
M.c.a. (sem iv)- java programming
 
ActionScript Design Patterns
ActionScript Design Patterns ActionScript Design Patterns
ActionScript Design Patterns
 
Mca 504 dotnet_unit3
Mca 504 dotnet_unit3Mca 504 dotnet_unit3
Mca 504 dotnet_unit3
 
02 objective-c session 2
02  objective-c session 202  objective-c session 2
02 objective-c session 2
 
Lecture01
Lecture01Lecture01
Lecture01
 
OOP design patterns
OOP design patternsOOP design patterns
OOP design patterns
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
 
Hibernate3 q&a
Hibernate3 q&aHibernate3 q&a
Hibernate3 q&a
 

Recently uploaded

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 

Recently uploaded (20)

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 

JAVA design patterns and Basic OOp concepts

  • 1.
  • 2. What is Java? Programming Language Fast Secure Reliable
  • 3. What is Java? Programming Language Fast Secure Reliable
  • 4. Some Facts about JAVA: Developed by JAMES GOSLING at SUN MICROSYSTEMS Related to two languages C and C++ HOW ? JAVA derives its Syntax from C and, Many concepts based on OOPs were influenced by C++ Initially JAVA was named as “Oak” But was renamed by “JAVA” in 1995 3977 classes
  • 5. The Way JavaWorks : Objective :Write an Application and make it run on whether devices your friends have.
  • 6. The JAVA BUZZWORDS : Simple Secure Portable Dynamic Distributed Object-oriented Robust(Consistent) Multithreaded Architecture neutral High Performance
  • 7. Major OOP Principles : Abstraction Encapsulation Inheritance Polymorphism
  • 8. Abstraction:  Manages Complexity(Generalization)  Hierarchal Classification  Makes Java more Understandable
  • 9. Encapsulation: Binds Code and data Together Keeps it safe from outside interference and Misuse It works through Classes. A AB C CD C is accessible with in this Block
  • 10. Inheritance : Process of acquiring the properties of another object In absence of inheritance, each object needs to define all characteristics
  • 11. Polymorphism : An Ability of an object to acquire more than one form For example: public interface Vegetarian{ } public class Animal{ } public class Deer extends Animal implements Vegetarian{ } A Deer IS-A Animal A Deer IS-A Vegetarian A Deer IS-A Deer A Deer IS-A Object
  • 12. Interface :  It is an Collection of Abstract Methods  It can contain any no. of methods  How do it do this??? HOW ?
  • 13. Lets Design Some Patterns General solution to programmers problems faced while designing software Increase the Code Maintainability GOF: Erich Gamma, Richard helm, Ralph Johnsons and John vlissides Helps in Reusing the codes Time saving and Cost reduction
  • 14. Types Of Patterns Creational Pattern: Way to create Objects while hiding the Creational Logic Structural Pattern: Concerns class and object composition Behavioral pattern: Referred to communication between objects J2EE: Presentation tier.
  • 15. Classification Of Patterns Creational pattern: 1. Factory Pattern 2. Singleton Pattern 3. Abstract Factory Pattern 4. Builder Pattern 5. Prototype Pattern Structural Patterns: 1. Adapter Pattern 2. Composite Pattern 3. Proxy Pattern 4. Flyweight Pattern 5. Façade Pattern 6. Bridge Pattern 7. Decorator Pattern Behavioral Pattern: 1. Template Method Pattern 2. Mediator Pattern 3. Chain of Responsibility Pattern 4. Observer Pattern 5. Strategy Pattern 6. Command Pattern 7. State Pattern 8. Visitor Pattern 9. Iterator Pattern 10. Memento Pattern
  • 17. Factory Pattern Comes Under the creational Pattern Create object without Exposing the Creational Logic used to instantiate an object from one among a set of classes based on a logic Assume that you have a set of classes which extends a common super class or interface. Now you will create a concrete class with a method which accepts one or more arguments.This method is our factory method.
  • 18. Factory Pattern Super Class SubClass 3Sub Class 2Sub Class 1 Factory Super ClassLogic
  • 20. Adapter Pattern Allows you to use two Incompatible Interfaces to work together Used when the client expects a(target) interface Adapter Class allows the use of available Interface and the target  interface Any class can work together as long as the Adapter solves the issue that All classes must implements every method defined by the shared interface
  • 21. Adapter Pattern Client Enemy Attacker <Interface> Fire weapon():void Drive Forward():void Assign driver():void Enemy Robot Adapter Fire weapon():void Drive Forward():void Assign driver():void Enemy Robot Smash with hands():void walk Forward():void React to human():void Enemy Robot Enemy Attacker (Target) Enemy Robot Adapter (Adaptor) Enemy Robot (Adaptee)
  • 23. Observer Pattern In observer design pattern multiple observer objects registers with a subject for change notification.When the state of subject changes, it notifies the observers. Objects that listen or watch for change are called observers and the object that is being watched for is called subject. Pattern involved is also called as publish-subscribe pattern. Model view controller (MVC) architecture’s core uses the observer design pattern.
  • 24. Observer Pattern Subject provides interface for observers to register and unregister themselves with the subject. Subject knows who its subscribers are. Multiple observers can subscribe for notifications. Subject publishes the notifications. Subject just sends the notification saying the state has changed. It does not pass any state information. Once the notification is received from subject, observers call the subject and get data that is changed.
  • 25. Observer Pattern Consider an excel sheet, data is shown to the user in different views. Generally data is shown in grid cells and as required different graphs, charts can be created for same data. Underlying data is same and when that data (subject) state changes all the different view are updated.  When multiple objects depend on state of one object and all these multiple objects should be in sync with the state of this one object then observer design pattern is the right choice to apply. When?
  • 26. Observer Pattern Let us take a blog and subscriber example for observer design pattern sample implementation. Assume that there is a blog and users register to that blog for update.When a new article is posted in the blog, it will send update to the registered users saying a new article is posted.Then the user will access the blog and read the new article posted. In this example, blog is the subject and user is the observer.
  • 27. Proxy Design Pattern Proxy means ‘in place of’. In attendance roll call, we give proxy for our friends in college right? ‘Representing’ or ‘in place of’ or ‘on behalf of’ are literal meanings of proxy and that directly explains proxy design pattern.
  • 28. Proxy Design Pattern Remote Proxy – Represents an object locally which belongs to a different address space.Think of an ATM implementation, it will hold proxy objects for bank information that exists in the remote server. Virtual Proxy – In place of a complex or heavy object use a skeleton representation. Protection Proxy –working on a MNC? If so, you might be well aware of the proxy server that provides you internet. Saying more than provides, the right word is censors internet. Smart Reference – Just we keep a link/reference to the real object a kind of pointer.
  • 29. Proxy Design Pattern Provide a class which will limit access to another class You may do this for Security reasons, because an Object is intensive to Create, or is accessed from a remote location.
  • 30. Proxy Design Pattern Client GetATMState <interface> +getATMState(): ATMState +getCashINMachine():int ATM Proxy +getATMState(): ATMState +getCashINMachine():int ATM Machine +getATMState(): ATMState +getCashINMachine():int
  • 31. MVC Design Pattern Completely Separates the Calculation and Interface from each other Model: Data and Model Used to Work with it View:The Interface Controller: Coordinates interactions between the view and Model My Favorite One!!