SlideShare a Scribd company logo
DESIGN PATTERNS

       Fahad Ali Shaikh
About Me
• CIS Graduate
• 3+ years experience in software development
• Asp.Net 3.5, Silverlight 3, Drupal
  CMS, Android, CRM
• Currently CRM consultant at Sakonent
• Passionate Technology Trainer
• Wing Chun Kung Fu student
• Google Fahad Ali Shaikh for more 
Agenda
• What are Design Patterns and why should we
  use them?
• Let’s strengthen our OOP.
• Creational Pattern
  – Singleton
  – Factory Pattern
• Behavioral Patterns
  – Strategy Pattern
  – Observer Pattern
Agenda
• Structural Patterns
  – Decorator Pattern
• Architectural Patterns
  – MVC
What are DP and Why DP?
What are DP and Why DP?
• A design pattern is a documented best
  practice or core of a solution that has been
  applied successfully in multiple environments
  to solve a problem that recurs in a specific set
  of situations.

• Patterns address solution to a problem
What are DP and Why DP?


• Focus on solving the MAIN problem rather
  than the small ones
What are DP and Why DP?


• Someone has already done what you want to
  do
What are DP and Why DP?


• A shared language for communicating the
  experience gained in dealing with these
  recurring problems and their solutions
What are DP and Why DP?


• Patterns are discovered not invented
What are DP and Why DP?


• Patterns are used effectively with experience
Design Patterns Categories
Purpose      Design Pattern            Aspects that can vary

Creational    Abstract Factory   Families of product objects
              Singleton            Creation of a single object
              Factory Method     Subclass of object instantiated

Structural     Adapter           Interface to an object

               Facade              Interface to a subsystem
               Flyweight           Storage costs of objects
               Proxy              How an object is accessed
Behavioral    Command             When & how a request is fulfilled
               Iterator          Traversal of elements in an
                                 aggregate
Lets Strengthen Our OOP!
Lets Strengthen Our OOP!
• Tight Encapsulation
• Encapsulation refers to the combining of
  fields and methods together in a class
  such that the methods operate on the
  data, as opposed to users of the class
  accessing the fields directly.
Lets Strengthen Our OOP!
• Loose Coupling
• Coupling is the extent to which one object
  depends on another object to achieve its
  goal.
Lets Strengthen Our OOP!
• Loose Coupling
  –Coupling is the extent to which one
   object depends on another object
   to achieve its goal.
Lets Strengthen Our OOP!
• Loose Coupling

•   public class Address {
•   public String street;
•   public String city;
•   public int zip;
•   }
Lets Strengthen Our OOP!
• Not so Loose Coupling
•   public class Employee {
•   private Address home;
•   public Employee(String street, String city, int zip) {
•   home = new Address();
•   home.street = street;
•   home.city = city;
•   home.zip = zip;
      }
• }
Lets Strengthen Our OOP!

• Loose Coupling
• Encapsulate – Use getters and setters
Lets Strengthen Our OOP!
• High Cohesion
• Cohesion refers to how closely related
  the specific tasks are of an object.
• High cohesion is when an object performs
  a collection of closely related tasks.
Lets Strengthen Our OOP!
• High Cohesion
•   public class Payroll {
•   public void computeEmployeePay() {
•   System.out.println(“Compute pay for employees”);
•   }
•   public void computeEmployeeTaxes() {
•   System.out.println(“Compute taxes for employees”);
•   }
•   public void addNewEmployee(Employee e) {
•   System.out.println(“New employee hired...”);
•   }
•   }
Lets Strengthen Our OOP!
• Composition vs Inheritance
The Strategy Pattern
• Composition vs Inheritance
The Strategy Pattern
• Define a family of
  algorithms, encapsulate each
  one, and make them
  interchangeable.

• Strategy lets the algorithm vary
  independently from clients that use
  it.
The Strategy Pattern
The Strategy Pattern
But now we need ducks to fly
The Strategy Pattern
The Strategy Pattern
The Strategy Pattern
The Strategy Pattern
The Strategy Pattern
The Strategy Pattern
What do you think about this design?
The Strategy Pattern
The Strategy Pattern
The Strategy Pattern
The Strategy Pattern
The Strategy Pattern
The Strategy Pattern
The Strategy Pattern
The Strategy Pattern
The Strategy Pattern
The Singleton Pattern
The Singleton Pattern
• Ensures a class has only one instance

• Provides a single point of reference
The Singleton Pattern – Use When
• There must be exactly one instance of a
  class.

• May provide synchronous access to
  avoid deadlocks.

• Very common in GUI toolkits, to specify
  the connection to the OS/Windowing
  system
The Singleton Pattern - Benefits
• Controls access to a scarce or unique
  resource

• Helps avoid a central application class with
  various global object references

• Subclasses can have different
  implementations as required. Static or
  global references don’t allow this

• Multiple or single instances can be allowed
The Singleton Pattern
public class ClassicSingleton {
     private static ClassicSingleton instance = null;
     protected ClassicSingleton() {
        // exists only to defeat instantiation.
       //should be private and final for performance
     }
     public static ClassicSingleton getInstance() {
       if(instance == null) {
        instance = new ClassicSingleton();
       }
       return instance;
     }
}
The Factory Pattern
The Factory pattern returns an instance of one of several possible
classes depending on the data provided to it.




   Here, x is a base class and classes xy and xz are derived from it.
   The Factory is a class that decides which of these subclasses to
    return depending on the arguments you give it.
   The getClass() method passes in some value abc, and returns
    some instance of the class x. Which one it returns doesn't matter
    to the programmer since they all have the same methods, but
    different implementations.
The Factory Pattern
The Factory pattern returns an instance of one of several possible
classes depending on the data provided to it.




   Here, x is a base class and classes xy and xz are derived from it.
   The Factory is a class that decides which of these subclasses to
    return depending on the arguments you give it.
   The getClass() method passes in some value abc, and returns
    some instance of the class x. Which one it returns doesn't matter
    to the programmer since they all have the same methods, but
    different implementations.
The Factory Pattern
   Suppose we have an entry form and we want to allow the user to enter his
    name either as “firstname lastname” or as “lastname, firstname”.
   Let’s make the assumption that we will always be able to decide the name
    order by whether there is a comma between the last and first name.


class Namer { //a simple class to take a string apart into two names
        protected String last; //store last name here
        protected String first; //store first name here
        public String getFirst() {
                  return first; //return first name
        }
        public String getLast() {
                  return last; //return last name
        }
}
The Factory Pattern
In the FirstFirst class, we assume that everything before the last
space is part of the first name.

class FirstFirst extends Namer {
     public FirstFirst(String s) {
          int i = s.lastIndexOf(" "); //find sep space
          if (i > 0) {
                 first = s.substring(0, i).trim(); //left is first name
                 last =s.substring(i+1).trim(); //right is last name
          } else {
                 first = “” // put all in last name
                 last = s; // if no space
          }
     }
}
The Factory Pattern
In the LastFirst class, we assume that a comma delimits the last
name.

class LastFirst extends Namer { //split last, first
    public LastFirst(String s) {
        int i = s.indexOf(","); //find comma
            if (i > 0) {
                 last = s.substring(0, i).trim(); //left is last name
                 first = s.substring(i + 1).trim(); //right is first name
            } else {
                 last = s; // put all in last name
                 first = ""; // if no comma
            }
      }
}
The Factory Pattern
The Factory class is relatively simple. We just test for the existence
of a comma and then return an instance of one class or the other.

class NameFactory {
      //returns an instance of LastFirst or FirstFirst
      //depending on whether a comma is found
      public Namer getNamer(String entry) {
            int i = entry.indexOf(","); //comma determines name order
            if (i>0)
                   return new LastFirst(entry); //return one class
            else
                   return new FirstFirst(entry); //or the other
      }
}
The Factory Pattern
NameFactory nfactory = new NameFactory();
String sFirstName, sLastName;
….
private void computeName() {
  //send the text to the factory and get a class back
  namer = nfactory.getNamer(entryField.getText());
  //compute the first and last names using the returned class
  sFirstName = namer.getFirst();
  sLastName = namer.getLast();
}
The Factory – When to use
You should consider using a Factory pattern
  when:
 A class can’t anticipate which kind of class of
  objects it must create.
 A class uses its subclasses to specify which
  objects it creates.
 You want to localize the knowledge of which
  class gets created.
Feeling hungry ?
Let’s have a break
The Observer Pattern
 The cases when certain objects need to be
 informed about the changes which occurred
 in other objects and are frequent.
The Observer Pattern
 The cases when certain objects need to be
 informed about the changes which occurred
 in other objects and are frequent.


 Define a one-to-many dependency between
 objects so that when one object changes
 state, all its dependents are notified and
 updated automatically.
The Observer Pattern
• This pattern is a cornerstone of the Model-
  View-Controller architectural design, where
  the Model implements the mechanics of the
  program, and the Views are implemented as
  Observers that are as much uncoupled as
  possible to the Model components.
The Observer Pattern
• The participants classes in the Observer pattern are:
•
  Observable - interface or abstract class defining the operations for
  attaching and de-attaching observers to the client. In the GOF
  book this class/interface is known as Subject.

• ConcreteObservable - concrete Observable class. It maintain the
  state of the observed object and when a change in its state occurs
  it notifies the attached Observers.

• Observer - interface or abstract class defining the operations to be
  used to notify the Observer object.

• ConcreteObserverA, ConcreteObserverB - concrete Observer
  implementations.
The Observer Pattern
•    Observable()
•                 Construct an Observable with zero Observers.
•    void addObserver(Observer o)
•                 Adds an observer to the set of observers for this
     object, provided     that it is not the same as some observer
     already in the set.
•    protected void clearChanged()
•                 Indicates that this object has no longer
     changed, or that it has     already notified all of its
     observers of its most recent change, so    that the hasChanged
     method will now return false.
•    int countObservers()
•                 Returns the number of observers of this
     Observable object.
•    void deleteObserver(Observer o)
•                 Deletes an observer from the set of observers of
     this object.
•    void deleteObservers()
•                 Clears the observer list so that this object no
     longer has any              observers.
The Observer Pattern
•   boolean hasChanged()
•              Tests if this object has changed.
•   void notifyObservers()
•              If this object has changed, as indicated by
    the hasChanged method, then notify all of its
    observers and then call the clearChanged     method to
    indicate that this object has no longer changed.
•   void notifyObservers(Object arg)
•              If this object has changed, as indicated by
    the hasChanged method, then notify all of its
    observers and then call the clearChanged     method to
    indicate that this object has no longer changed.
•   protected void setChanged()
•              Marks this Observable object as having been
    changed; the hasChanged method will now return true.
The Observer Pattern
•   // A Sub-class of Observable: a Clock Timer
•   import java.util.Observable;

•   class ClockTimerModel extends Observable {
      public:
        ClockTimer();
•       int GetHour(){return hour};
        int GetMinute(){return minute};
        int GetSecond(){return second};
•       void tick(){
•        // update internal time-keeping state ……………………
         // The Observable object notifies all its registered observers
         setChanged();
•        notifyObservers();};
•     private:
•       int hour;
•       int minute;
•       int second;
    };

• In green are the changes to be applied to the class to be made an observable
  class.
The Observer Pattern

• public void update(Observable o, Object arg)
•     This method is called whenever the observed
  object is changed. An       application calls an
  Observable object's notifyObservers method to
      have all the object's observers notified of
  the change.
•     Parameters:
•         o   - the observable object.
•         arg - an argument passed to the
  notifyObservers method.
The Observer Pattern
•   // A specific Observer to observe ClockTimerModel:
    DigitalClockView
•   //

•   import java.util.Observer;

•   class DigitalClockView implements Observer {

•        public void update(Observable obs, Object x) {
•         //redraw my clock’s reading
          draw();};
•
         void draw(){
          int hour    = obs.GetHour();
          int minute = obs.GetMinute();
          int second = obs.GetSecond();
•         // draw operation};
•   };
The Observer Pattern
•   public class ObserverDemo extends Object {
•     DigitalClockView clockView;
•     ClockTimerModel clockModel;

•    public ObservDemo() {
•      clockView = new DigitalClockView();
•      clockModel = new ClockTimerModel();
•      clockModel.addObserver(clockView);
•    }
•    public static void main(String[] av) {
•      ObserverDemo me = new ObserverDemo();
•      me.demo();
•    }
•    public void demo() {
•      clockModel.Tick();
•    }
The Decorator Pattern
The Decorator Pattern
First Idea of Implementation
In Reality
Now a beverage can be mixed from different condiment to form
a new
Now, your turns. It is a good solution?
Take some time to complete
What can you criticize about this
inheritance architecture?



Write down your notes to see if you are right…
3 minutes….
Ok time’s up.
The Problem
• The problems of two previous designs
  – we get class explosions, rigid designs,
  – or we add functionality to the base class that
    isn’t appropriate for some of the subclasses.
The Problem Revisited
• If a customer wants a Dark Roast with Mocha
  and Whip
  – Take a DarkRoast object
  – Decorate it with a Mocha object
  – Decorate it with a Whip object
  – Call the cost() method and rely on
  – delegation to add on the condiment costs
Decorator at action
Decorator at action
Decorator at action
Decorator at action
Decorator Pattern Defined
Decorator Pattern for StarBuzz Bevereges
Let’s see some code…
Abstract class for condiments
Concrete base class for beverages
Concrete condiment class
Constructing the new beverages instance
dynamically
Constructing the new beverages instance
dynamically
Model View Controller
MVC
Questions ?

More Related Content

What's hot

Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHP
Lorna Mitchell
 
Java02
Java02Java02
Java tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry LevelJava tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry Level
Ramrao Desai
 
Lecture 6 inheritance
Lecture   6 inheritanceLecture   6 inheritance
Lecture 6 inheritance
manish kumar
 
Unit 4 exceptions and threads
Unit 4 exceptions and threadsUnit 4 exceptions and threads
Unit 4 exceptions and threads
DevaKumari Vijay
 
Lecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptLecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops concept
manish kumar
 
Core java oop
Core java oopCore java oop
Core java oop
Parth Shah
 
Lecture - 5 Control Statement
Lecture - 5 Control StatementLecture - 5 Control Statement
Lecture - 5 Control Statement
manish kumar
 
Core java concepts
Core java conceptsCore java concepts
Core java concepts
laratechnologies
 
Java Performance MythBusters
Java Performance MythBustersJava Performance MythBusters
Java Performance MythBusters
Sebastian Zarnekow
 
Java basic
Java basicJava basic
Java basic
Sonam Sharma
 
Pi j2.3 objects
Pi j2.3 objectsPi j2.3 objects
Pi j2.3 objects
mcollison
 
Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674
Lokesh Kakkar Mobile No. 814-614-5674
 
Scala Paradigms
Scala ParadigmsScala Paradigms
Scala Paradigms
Tom Flaherty
 
Unit3 part1-class
Unit3 part1-classUnit3 part1-class
Unit3 part1-class
DevaKumari Vijay
 
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arraysUnit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
DevaKumari Vijay
 
Java Generics
Java GenericsJava Generics
Java Generics
jeslie
 
Polymorphism in C# Function overloading in C#
Polymorphism in C# Function overloading in C#Polymorphism in C# Function overloading in C#
Polymorphism in C# Function overloading in C#
Abid Kohistani
 
Inheritance Mixins & Traits
Inheritance Mixins & TraitsInheritance Mixins & Traits
Inheritance Mixins & Traits
Maximiliano Fierro
 
Lecture 4_Java Method-constructor_imp_keywords
Lecture   4_Java Method-constructor_imp_keywordsLecture   4_Java Method-constructor_imp_keywords
Lecture 4_Java Method-constructor_imp_keywords
manish kumar
 

What's hot (20)

Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHP
 
Java02
Java02Java02
Java02
 
Java tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry LevelJava tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry Level
 
Lecture 6 inheritance
Lecture   6 inheritanceLecture   6 inheritance
Lecture 6 inheritance
 
Unit 4 exceptions and threads
Unit 4 exceptions and threadsUnit 4 exceptions and threads
Unit 4 exceptions and threads
 
Lecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptLecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops concept
 
Core java oop
Core java oopCore java oop
Core java oop
 
Lecture - 5 Control Statement
Lecture - 5 Control StatementLecture - 5 Control Statement
Lecture - 5 Control Statement
 
Core java concepts
Core java conceptsCore java concepts
Core java concepts
 
Java Performance MythBusters
Java Performance MythBustersJava Performance MythBusters
Java Performance MythBusters
 
Java basic
Java basicJava basic
Java basic
 
Pi j2.3 objects
Pi j2.3 objectsPi j2.3 objects
Pi j2.3 objects
 
Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674
 
Scala Paradigms
Scala ParadigmsScala Paradigms
Scala Paradigms
 
Unit3 part1-class
Unit3 part1-classUnit3 part1-class
Unit3 part1-class
 
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arraysUnit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
 
Java Generics
Java GenericsJava Generics
Java Generics
 
Polymorphism in C# Function overloading in C#
Polymorphism in C# Function overloading in C#Polymorphism in C# Function overloading in C#
Polymorphism in C# Function overloading in C#
 
Inheritance Mixins & Traits
Inheritance Mixins & TraitsInheritance Mixins & Traits
Inheritance Mixins & Traits
 
Lecture 4_Java Method-constructor_imp_keywords
Lecture   4_Java Method-constructor_imp_keywordsLecture   4_Java Method-constructor_imp_keywords
Lecture 4_Java Method-constructor_imp_keywords
 

Viewers also liked

Evaluations
EvaluationsEvaluations
Evaluations
palderman
 
Data architecture around risk management
Data architecture around risk managementData architecture around risk management
Data architecture around risk management
Suvradeep Rudra
 
Ruby overview
Ruby overviewRuby overview
Ruby overviewAaa Bbb
 
E personal information system
E personal information systemE personal information system
E personal information system
Bishar Bn
 
Estrategias competitivas básicas
Estrategias competitivas básicasEstrategias competitivas básicas
Estrategias competitivas básicas
LarryJimenez
 
Sq Lv1a
Sq Lv1aSq Lv1a
Sq Lv1a
Daniel Cruz
 
1 introducción a la teoria general de sistemas
1 introducción a la teoria general de sistemas1 introducción a la teoria general de sistemas
1 introducción a la teoria general de sistemas
Oscar Chevez
 
Nombr
NombrNombr
Elasticity Of Demand Sangam Kumar
Elasticity Of Demand   Sangam KumarElasticity Of Demand   Sangam Kumar
Elasticity Of Demand Sangam Kumar
Sangam Agrawal
 
Mcconnell brief2e
Mcconnell brief2e Mcconnell brief2e
Mcconnell brief2e
Heshan MApatuna
 
LAB REPORT DROSOPHILA MELANOGASTER
LAB REPORT DROSOPHILA MELANOGASTERLAB REPORT DROSOPHILA MELANOGASTER
LAB REPORT DROSOPHILA MELANOGASTER
siti sarah
 
Logistica y Cadena de Suministros
Logistica y Cadena de SuministrosLogistica y Cadena de Suministros
Logistica y Cadena de Suministros
Gonzalo Lagunes
 
PRESENTACIÓN ACTIVIDAD 2
PRESENTACIÓN ACTIVIDAD 2PRESENTACIÓN ACTIVIDAD 2
PRESENTACIÓN ACTIVIDAD 2
juankimo2012
 
Conf fuerza mena
Conf fuerza menaConf fuerza mena
Conf fuerza mena
juangares
 
Cuestionario
CuestionarioCuestionario
Cuestionario
Perla Espinoza
 
PowerPoint presentation for creating a blog on www.wordpress.com
PowerPoint presentation for creating a blog on www.wordpress.comPowerPoint presentation for creating a blog on www.wordpress.com
PowerPoint presentation for creating a blog on www.wordpress.com
Sohail Siddiqi
 
Designing Long-Term Policy: Rethinking Transition Management
Designing Long-Term Policy: Rethinking Transition ManagementDesigning Long-Term Policy: Rethinking Transition Management
Designing Long-Term Policy: Rethinking Transition Management
iBoP Asia
 
Master%20 calidad textos%20del%20curso%20para%20el%20alumno
Master%20 calidad textos%20del%20curso%20para%20el%20alumnoMaster%20 calidad textos%20del%20curso%20para%20el%20alumno
Master%20 calidad textos%20del%20curso%20para%20el%20alumno
Lizeth Molina Solis
 
Taller ley de victimas y restitucion de tierras
Taller ley de victimas y restitucion de tierrasTaller ley de victimas y restitucion de tierras
Taller ley de victimas y restitucion de tierras
Autonomo
 
Fundamentos de Pruebas de Software - Capítulo 2
Fundamentos de Pruebas de Software - Capítulo 2Fundamentos de Pruebas de Software - Capítulo 2
Fundamentos de Pruebas de Software - Capítulo 2
Professional Testing
 

Viewers also liked (20)

Evaluations
EvaluationsEvaluations
Evaluations
 
Data architecture around risk management
Data architecture around risk managementData architecture around risk management
Data architecture around risk management
 
Ruby overview
Ruby overviewRuby overview
Ruby overview
 
E personal information system
E personal information systemE personal information system
E personal information system
 
Estrategias competitivas básicas
Estrategias competitivas básicasEstrategias competitivas básicas
Estrategias competitivas básicas
 
Sq Lv1a
Sq Lv1aSq Lv1a
Sq Lv1a
 
1 introducción a la teoria general de sistemas
1 introducción a la teoria general de sistemas1 introducción a la teoria general de sistemas
1 introducción a la teoria general de sistemas
 
Nombr
NombrNombr
Nombr
 
Elasticity Of Demand Sangam Kumar
Elasticity Of Demand   Sangam KumarElasticity Of Demand   Sangam Kumar
Elasticity Of Demand Sangam Kumar
 
Mcconnell brief2e
Mcconnell brief2e Mcconnell brief2e
Mcconnell brief2e
 
LAB REPORT DROSOPHILA MELANOGASTER
LAB REPORT DROSOPHILA MELANOGASTERLAB REPORT DROSOPHILA MELANOGASTER
LAB REPORT DROSOPHILA MELANOGASTER
 
Logistica y Cadena de Suministros
Logistica y Cadena de SuministrosLogistica y Cadena de Suministros
Logistica y Cadena de Suministros
 
PRESENTACIÓN ACTIVIDAD 2
PRESENTACIÓN ACTIVIDAD 2PRESENTACIÓN ACTIVIDAD 2
PRESENTACIÓN ACTIVIDAD 2
 
Conf fuerza mena
Conf fuerza menaConf fuerza mena
Conf fuerza mena
 
Cuestionario
CuestionarioCuestionario
Cuestionario
 
PowerPoint presentation for creating a blog on www.wordpress.com
PowerPoint presentation for creating a blog on www.wordpress.comPowerPoint presentation for creating a blog on www.wordpress.com
PowerPoint presentation for creating a blog on www.wordpress.com
 
Designing Long-Term Policy: Rethinking Transition Management
Designing Long-Term Policy: Rethinking Transition ManagementDesigning Long-Term Policy: Rethinking Transition Management
Designing Long-Term Policy: Rethinking Transition Management
 
Master%20 calidad textos%20del%20curso%20para%20el%20alumno
Master%20 calidad textos%20del%20curso%20para%20el%20alumnoMaster%20 calidad textos%20del%20curso%20para%20el%20alumno
Master%20 calidad textos%20del%20curso%20para%20el%20alumno
 
Taller ley de victimas y restitucion de tierras
Taller ley de victimas y restitucion de tierrasTaller ley de victimas y restitucion de tierras
Taller ley de victimas y restitucion de tierras
 
Fundamentos de Pruebas de Software - Capítulo 2
Fundamentos de Pruebas de Software - Capítulo 2Fundamentos de Pruebas de Software - Capítulo 2
Fundamentos de Pruebas de Software - Capítulo 2
 

Similar to Design patterns(red)

Design patterns
Design patternsDesign patterns
Design patterns
Anas Alpure
 
Object Oriented Programming - 7.2. Polymorphism
Object Oriented Programming - 7.2. PolymorphismObject Oriented Programming - 7.2. Polymorphism
Object Oriented Programming - 7.2. Polymorphism
AndiNurkholis1
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshow
ilias ahmed
 
02-OOP with Java.ppt
02-OOP with Java.ppt02-OOP with Java.ppt
02-OOP with Java.ppt
EmanAsem4
 
Java Basics
Java BasicsJava Basics
Java Basics
Rajkattamuri
 
Java design patterns
Java design patternsJava design patterns
Java design patterns
Shawn Brito
 
Java basic tutorial
Java basic tutorialJava basic tutorial
Java basic tutorial
Bui Kiet
 
Core java
Core javaCore java
Core java
Rajkattamuri
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
Abdii Rashid
 
Java: Inheritance
Java: InheritanceJava: Inheritance
Java: Inheritance
Tareq Hasan
 
java tutorial 3
 java tutorial 3 java tutorial 3
java tutorial 3
Tushar Desarda
 
Java Concepts
Java ConceptsJava Concepts
Java Concepts
AbdulImrankhan7
 
Object-Oriented Programming with C#
Object-Oriented Programming with C#Object-Oriented Programming with C#
Object-Oriented Programming with C#
Svetlin Nakov
 
Introduction to OOP with PHP
Introduction to OOP with PHPIntroduction to OOP with PHP
Introduction to OOP with PHP
Michael Peacock
 
Java for the Impatient, Java Constructors, Scope, Wrappers, Inheritance, and ...
Java for the Impatient, Java Constructors, Scope, Wrappers, Inheritance, and ...Java for the Impatient, Java Constructors, Scope, Wrappers, Inheritance, and ...
Java for the Impatient, Java Constructors, Scope, Wrappers, Inheritance, and ...
argsstring
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer Programming
Inocentshuja Ahmad
 
Defining classes-and-objects-1.0
Defining classes-and-objects-1.0Defining classes-and-objects-1.0
Defining classes-and-objects-1.0
BG Java EE Course
 
Java Programming - 04 object oriented in java
Java Programming - 04 object oriented in javaJava Programming - 04 object oriented in java
Java Programming - 04 object oriented in java
Danairat Thanabodithammachari
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
Gousalya Ramachandran
 
Ch-2ppt.pptx
Ch-2ppt.pptxCh-2ppt.pptx
Ch-2ppt.pptx
ssuser8347a1
 

Similar to Design patterns(red) (20)

Design patterns
Design patternsDesign patterns
Design patterns
 
Object Oriented Programming - 7.2. Polymorphism
Object Oriented Programming - 7.2. PolymorphismObject Oriented Programming - 7.2. Polymorphism
Object Oriented Programming - 7.2. Polymorphism
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshow
 
02-OOP with Java.ppt
02-OOP with Java.ppt02-OOP with Java.ppt
02-OOP with Java.ppt
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Java design patterns
Java design patternsJava design patterns
Java design patterns
 
Java basic tutorial
Java basic tutorialJava basic tutorial
Java basic tutorial
 
Core java
Core javaCore java
Core java
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
 
Java: Inheritance
Java: InheritanceJava: Inheritance
Java: Inheritance
 
java tutorial 3
 java tutorial 3 java tutorial 3
java tutorial 3
 
Java Concepts
Java ConceptsJava Concepts
Java Concepts
 
Object-Oriented Programming with C#
Object-Oriented Programming with C#Object-Oriented Programming with C#
Object-Oriented Programming with C#
 
Introduction to OOP with PHP
Introduction to OOP with PHPIntroduction to OOP with PHP
Introduction to OOP with PHP
 
Java for the Impatient, Java Constructors, Scope, Wrappers, Inheritance, and ...
Java for the Impatient, Java Constructors, Scope, Wrappers, Inheritance, and ...Java for the Impatient, Java Constructors, Scope, Wrappers, Inheritance, and ...
Java for the Impatient, Java Constructors, Scope, Wrappers, Inheritance, and ...
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer Programming
 
Defining classes-and-objects-1.0
Defining classes-and-objects-1.0Defining classes-and-objects-1.0
Defining classes-and-objects-1.0
 
Java Programming - 04 object oriented in java
Java Programming - 04 object oriented in javaJava Programming - 04 object oriented in java
Java Programming - 04 object oriented in java
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
 
Ch-2ppt.pptx
Ch-2ppt.pptxCh-2ppt.pptx
Ch-2ppt.pptx
 

Recently uploaded

GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 

Recently uploaded (20)

GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 

Design patterns(red)

  • 1. DESIGN PATTERNS Fahad Ali Shaikh
  • 2. About Me • CIS Graduate • 3+ years experience in software development • Asp.Net 3.5, Silverlight 3, Drupal CMS, Android, CRM • Currently CRM consultant at Sakonent • Passionate Technology Trainer • Wing Chun Kung Fu student • Google Fahad Ali Shaikh for more 
  • 3. Agenda • What are Design Patterns and why should we use them? • Let’s strengthen our OOP. • Creational Pattern – Singleton – Factory Pattern • Behavioral Patterns – Strategy Pattern – Observer Pattern
  • 4. Agenda • Structural Patterns – Decorator Pattern • Architectural Patterns – MVC
  • 5. What are DP and Why DP?
  • 6. What are DP and Why DP? • A design pattern is a documented best practice or core of a solution that has been applied successfully in multiple environments to solve a problem that recurs in a specific set of situations. • Patterns address solution to a problem
  • 7. What are DP and Why DP? • Focus on solving the MAIN problem rather than the small ones
  • 8. What are DP and Why DP? • Someone has already done what you want to do
  • 9. What are DP and Why DP? • A shared language for communicating the experience gained in dealing with these recurring problems and their solutions
  • 10. What are DP and Why DP? • Patterns are discovered not invented
  • 11. What are DP and Why DP? • Patterns are used effectively with experience
  • 12. Design Patterns Categories Purpose Design Pattern Aspects that can vary Creational Abstract Factory Families of product objects Singleton Creation of a single object Factory Method Subclass of object instantiated Structural Adapter Interface to an object Facade Interface to a subsystem Flyweight Storage costs of objects Proxy How an object is accessed Behavioral Command When & how a request is fulfilled Iterator Traversal of elements in an aggregate
  • 14. Lets Strengthen Our OOP! • Tight Encapsulation • Encapsulation refers to the combining of fields and methods together in a class such that the methods operate on the data, as opposed to users of the class accessing the fields directly.
  • 15. Lets Strengthen Our OOP! • Loose Coupling • Coupling is the extent to which one object depends on another object to achieve its goal.
  • 16. Lets Strengthen Our OOP! • Loose Coupling –Coupling is the extent to which one object depends on another object to achieve its goal.
  • 17. Lets Strengthen Our OOP! • Loose Coupling • public class Address { • public String street; • public String city; • public int zip; • }
  • 18. Lets Strengthen Our OOP! • Not so Loose Coupling • public class Employee { • private Address home; • public Employee(String street, String city, int zip) { • home = new Address(); • home.street = street; • home.city = city; • home.zip = zip; } • }
  • 19. Lets Strengthen Our OOP! • Loose Coupling • Encapsulate – Use getters and setters
  • 20. Lets Strengthen Our OOP! • High Cohesion • Cohesion refers to how closely related the specific tasks are of an object. • High cohesion is when an object performs a collection of closely related tasks.
  • 21. Lets Strengthen Our OOP! • High Cohesion • public class Payroll { • public void computeEmployeePay() { • System.out.println(“Compute pay for employees”); • } • public void computeEmployeeTaxes() { • System.out.println(“Compute taxes for employees”); • } • public void addNewEmployee(Employee e) { • System.out.println(“New employee hired...”); • } • }
  • 22. Lets Strengthen Our OOP! • Composition vs Inheritance
  • 23. The Strategy Pattern • Composition vs Inheritance
  • 24. The Strategy Pattern • Define a family of algorithms, encapsulate each one, and make them interchangeable. • Strategy lets the algorithm vary independently from clients that use it.
  • 27. But now we need ducks to fly
  • 34. What do you think about this design?
  • 45. The Singleton Pattern • Ensures a class has only one instance • Provides a single point of reference
  • 46. The Singleton Pattern – Use When • There must be exactly one instance of a class. • May provide synchronous access to avoid deadlocks. • Very common in GUI toolkits, to specify the connection to the OS/Windowing system
  • 47. The Singleton Pattern - Benefits • Controls access to a scarce or unique resource • Helps avoid a central application class with various global object references • Subclasses can have different implementations as required. Static or global references don’t allow this • Multiple or single instances can be allowed
  • 48. The Singleton Pattern public class ClassicSingleton { private static ClassicSingleton instance = null; protected ClassicSingleton() { // exists only to defeat instantiation. //should be private and final for performance } public static ClassicSingleton getInstance() { if(instance == null) { instance = new ClassicSingleton(); } return instance; } }
  • 49. The Factory Pattern The Factory pattern returns an instance of one of several possible classes depending on the data provided to it.  Here, x is a base class and classes xy and xz are derived from it.  The Factory is a class that decides which of these subclasses to return depending on the arguments you give it.  The getClass() method passes in some value abc, and returns some instance of the class x. Which one it returns doesn't matter to the programmer since they all have the same methods, but different implementations.
  • 50. The Factory Pattern The Factory pattern returns an instance of one of several possible classes depending on the data provided to it.  Here, x is a base class and classes xy and xz are derived from it.  The Factory is a class that decides which of these subclasses to return depending on the arguments you give it.  The getClass() method passes in some value abc, and returns some instance of the class x. Which one it returns doesn't matter to the programmer since they all have the same methods, but different implementations.
  • 51. The Factory Pattern  Suppose we have an entry form and we want to allow the user to enter his name either as “firstname lastname” or as “lastname, firstname”.  Let’s make the assumption that we will always be able to decide the name order by whether there is a comma between the last and first name. class Namer { //a simple class to take a string apart into two names protected String last; //store last name here protected String first; //store first name here public String getFirst() { return first; //return first name } public String getLast() { return last; //return last name } }
  • 52. The Factory Pattern In the FirstFirst class, we assume that everything before the last space is part of the first name. class FirstFirst extends Namer { public FirstFirst(String s) { int i = s.lastIndexOf(" "); //find sep space if (i > 0) { first = s.substring(0, i).trim(); //left is first name last =s.substring(i+1).trim(); //right is last name } else { first = “” // put all in last name last = s; // if no space } } }
  • 53. The Factory Pattern In the LastFirst class, we assume that a comma delimits the last name. class LastFirst extends Namer { //split last, first public LastFirst(String s) { int i = s.indexOf(","); //find comma if (i > 0) { last = s.substring(0, i).trim(); //left is last name first = s.substring(i + 1).trim(); //right is first name } else { last = s; // put all in last name first = ""; // if no comma } } }
  • 54. The Factory Pattern The Factory class is relatively simple. We just test for the existence of a comma and then return an instance of one class or the other. class NameFactory { //returns an instance of LastFirst or FirstFirst //depending on whether a comma is found public Namer getNamer(String entry) { int i = entry.indexOf(","); //comma determines name order if (i>0) return new LastFirst(entry); //return one class else return new FirstFirst(entry); //or the other } }
  • 55. The Factory Pattern NameFactory nfactory = new NameFactory(); String sFirstName, sLastName; …. private void computeName() { //send the text to the factory and get a class back namer = nfactory.getNamer(entryField.getText()); //compute the first and last names using the returned class sFirstName = namer.getFirst(); sLastName = namer.getLast(); }
  • 56. The Factory – When to use You should consider using a Factory pattern when:  A class can’t anticipate which kind of class of objects it must create.  A class uses its subclasses to specify which objects it creates.  You want to localize the knowledge of which class gets created.
  • 58. Let’s have a break
  • 59. The Observer Pattern  The cases when certain objects need to be informed about the changes which occurred in other objects and are frequent.
  • 60. The Observer Pattern  The cases when certain objects need to be informed about the changes which occurred in other objects and are frequent.  Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
  • 61. The Observer Pattern • This pattern is a cornerstone of the Model- View-Controller architectural design, where the Model implements the mechanics of the program, and the Views are implemented as Observers that are as much uncoupled as possible to the Model components.
  • 62. The Observer Pattern • The participants classes in the Observer pattern are: • Observable - interface or abstract class defining the operations for attaching and de-attaching observers to the client. In the GOF book this class/interface is known as Subject. • ConcreteObservable - concrete Observable class. It maintain the state of the observed object and when a change in its state occurs it notifies the attached Observers. • Observer - interface or abstract class defining the operations to be used to notify the Observer object. • ConcreteObserverA, ConcreteObserverB - concrete Observer implementations.
  • 63. The Observer Pattern • Observable() • Construct an Observable with zero Observers. • void addObserver(Observer o) • Adds an observer to the set of observers for this object, provided that it is not the same as some observer already in the set. • protected void clearChanged() • Indicates that this object has no longer changed, or that it has already notified all of its observers of its most recent change, so that the hasChanged method will now return false. • int countObservers() • Returns the number of observers of this Observable object. • void deleteObserver(Observer o) • Deletes an observer from the set of observers of this object. • void deleteObservers() • Clears the observer list so that this object no longer has any observers.
  • 64. The Observer Pattern • boolean hasChanged() • Tests if this object has changed. • void notifyObservers() • If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed. • void notifyObservers(Object arg) • If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed. • protected void setChanged() • Marks this Observable object as having been changed; the hasChanged method will now return true.
  • 65. The Observer Pattern • // A Sub-class of Observable: a Clock Timer • import java.util.Observable; • class ClockTimerModel extends Observable { public: ClockTimer(); • int GetHour(){return hour}; int GetMinute(){return minute}; int GetSecond(){return second}; • void tick(){ • // update internal time-keeping state …………………… // The Observable object notifies all its registered observers setChanged(); • notifyObservers();}; • private: • int hour; • int minute; • int second; }; • In green are the changes to be applied to the class to be made an observable class.
  • 66. The Observer Pattern • public void update(Observable o, Object arg) • This method is called whenever the observed object is changed. An application calls an Observable object's notifyObservers method to have all the object's observers notified of the change. • Parameters: • o - the observable object. • arg - an argument passed to the notifyObservers method.
  • 67. The Observer Pattern • // A specific Observer to observe ClockTimerModel: DigitalClockView • // • import java.util.Observer; • class DigitalClockView implements Observer { • public void update(Observable obs, Object x) { • //redraw my clock’s reading draw();}; • void draw(){ int hour = obs.GetHour(); int minute = obs.GetMinute(); int second = obs.GetSecond(); • // draw operation}; • };
  • 68. The Observer Pattern • public class ObserverDemo extends Object { • DigitalClockView clockView; • ClockTimerModel clockModel; • public ObservDemo() { • clockView = new DigitalClockView(); • clockModel = new ClockTimerModel(); • clockModel.addObserver(clockView); • } • public static void main(String[] av) { • ObserverDemo me = new ObserverDemo(); • me.demo(); • } • public void demo() { • clockModel.Tick(); • }
  • 71. First Idea of Implementation
  • 73. Now a beverage can be mixed from different condiment to form a new
  • 74.
  • 75.
  • 76. Now, your turns. It is a good solution?
  • 77. Take some time to complete
  • 78. What can you criticize about this inheritance architecture? Write down your notes to see if you are right… 3 minutes….
  • 80.
  • 81. The Problem • The problems of two previous designs – we get class explosions, rigid designs, – or we add functionality to the base class that isn’t appropriate for some of the subclasses.
  • 82. The Problem Revisited • If a customer wants a Dark Roast with Mocha and Whip – Take a DarkRoast object – Decorate it with a Mocha object – Decorate it with a Whip object – Call the cost() method and rely on – delegation to add on the condiment costs
  • 88. Decorator Pattern for StarBuzz Bevereges
  • 89. Let’s see some code…
  • 90. Abstract class for condiments
  • 91. Concrete base class for beverages
  • 93. Constructing the new beverages instance dynamically
  • 94. Constructing the new beverages instance dynamically
  • 96. MVC

Editor's Notes

  1. This template can be used as a starter file for presenting training materials in a group setting.SectionsRight-click on a slide to add sections. Sections can help to organize your slides or facilitate collaboration between multiple authors.NotesUse the Notes section for delivery notes or to provide additional details for the audience. View these notes in Presentation View during your presentation. Keep in mind the font size (important for accessibility, visibility, videotaping, and online production)Coordinated colors Pay particular attention to the graphs, charts, and text boxes.Consider that attendees will print in black and white or grayscale. Run a test print to make sure your colors work when printed in pure black and white and grayscale.Graphics, tables, and graphsKeep it simple: If possible, use consistent, non-distracting styles and colors.Label all graphs and tables.
  2. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  3. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  4. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  5. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  6. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  7. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  8. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  9. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  10. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  11. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  12. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  13. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  14. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  15. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  16. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  17. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  18. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  19. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  20. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  21. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  22. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  23. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  24. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  25. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  26. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  27. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  28. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  29. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  30. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  31. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  32. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  33. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  34. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  35. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  36. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  37. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  38. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  39. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  40. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  41. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  42. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  43. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  44. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  45. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  46. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  47. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  48. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  49. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  50. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  51. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  52. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  53. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  54. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  55. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  56. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  57. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  58. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  59. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  60. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  61. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  62. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  63. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  64. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  65. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  66. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  67. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  68. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  69. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  70. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  71. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  72. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  73. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  74. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  75. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  76. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  77. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  78. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  79. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  80. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  81. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  82. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  83. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  84. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  85. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  86. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  87. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  88. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  89. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  90. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  91. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  92. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  93. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  94. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  95. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  96. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  97. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.