SlideShare a Scribd company logo
1 of 35
More on Design Patterns


Pre-assessment Questions

         2.   Which UML diagram depicts the sequential invocation of methods of a
              system?
              a)   Sequence
              b) Collaboration
              c)   Package
              d) Use Case




 ©NIIT                 Architecting J2EE Solutions         Lesson 2B / Slide 1 of 35
More on Design Patterns


Pre-assessment Questions

         2.   Which option identifies the scope of a system in a Use Case diagram
              and is represented by a solid rectangle?
              a)   Use Case
              b)   Message
              c)   Actor
              d)   State boundary




 ©NIIT                  Architecting J2EE Solutions         Lesson 2B / Slide 2 of 35
More on Design Patterns


Pre-assessment Questions

         2.   Consider the statements:
              Statement A: Extent relationship indicates that an existing use case is
                          extended by additional behavior to obtain another use case.
              Statement B: Include relationship indicates that the functions of one
              use case are included in the functions of the other.
               Identify the correct option.
              a)   Statement A is true and statement B is false
              b) Statement A is false and statement B is true
              c)   Both, statements A and B, are true
              d) Both, statements A and B, are false




 ©NIIT                  Architecting J2EE Solutions         Lesson 2B / Slide 3 of 35
More on Design Patterns


Pre-assessment Questions

         2.   Consider the statements:
              Statement A: Component diagram represents the grouping of related
              classes, interfaces, and methods of a given system.
              Statement B: Component diagram elements represent the various
              components of business entities of a given system.
              Identify the correct option.
              a)   Statement A is true and statement B is false
              b) Statement A is false and statement B is true
              c)   Both, statements A and B, are true
              d) Both, statements A and B, are false




 ©NIIT                 Architecting J2EE Solutions       Lesson 2B / Slide 4 of 35
More on Design Patterns


Pre-assessment Questions

         2.   Which element of GoF’s design pattern emphasizes on relationships,
              responsibilities, and collaborations among the constituents of a pattern?
              a)   Pattern name
              b) Solution
              c)   Problem
              d) Consequences




 ©NIIT                  Architecting J2EE Solutions          Lesson 2B / Slide 5 of 35
More on Design Patterns

Solutions to Pre-assessment Questions

         1.   a. Sequence
         2.   d. State boundary
         3.   c. Both, statements A and B, are true
         4.   b. Statement A is false and statement B is true
         5.   b. Solution




 ©NIIT                  Architecting J2EE Solutions         Lesson 2B / Slide 6 of 35
More on Design Patterns


Objectives

         In this lesson you will learn to:


              •   Use Structural Design Patterns
              •   Use Behavioral Design Patterns




 ©NIIT                   Architecting J2EE Solutions   Lesson 2B / Slide 7 of 35
More on Design Patterns


Structural Design Patterns
    •    Structural design patterns
           • Represent the composition of classes and objects.
           • Defines how classes inherit each other.
    •    The class-creation pattern uses inheritance in order to provide more functional
         program interfaces.
    •    The object-creation pattern defines how objects can be composed to provide
         new functionality using object composition.
    •    The various structural design patterns are Adaptor, Bridge, Composite,
         Decorator, Façade, Flyweight, and Proxy.




 ©NIIT                    Architecting J2EE Solutions          Lesson 2B / Slide 8 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    Adapter Pattern
          • The Adapter design pattern
               • Converts the interface of a class into an interface that is required by
                  the client.
          • The advantages of using Adapter design pattern are:
               • Enabling two or more incompatible objects to interact with each
                  other.
               • Making an existing functionality reusable.
          • The participants of Adapter design pattern are:
               • adapterTest : Implements the methods of MouseAdapter class.
               • MouseListener: Receives the mouse events generated.
               • MouseAdapter: Provides blank implementation of the methods
                  defined in the MouseListener abstract class.



 ©NIIT                    Architecting J2EE Solutions          Lesson 2B / Slide 9 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    Class diagram of the Adapter design pattern




 ©NIIT                   Architecting J2EE Solutions   Lesson 2B / Slide 10 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    Bridge Pattern
           • The Bridge design pattern
                • Separates an interface and its implementation. This enables both the
                  interface and its interface to change without affecting each other.
                • Uses encapsulation, aggregation, and inheritance to divide
                  responsibilities into various classes.
           • The advantages of using Bridge design pattern are:
                • Separates the implementation details from interface.
                • Hides implementation details from the client.




 ©NIIT                   Architecting J2EE Solutions        Lesson 2B / Slide 11 of 35
More on Design Patterns


Structural Design Patterns (Contd.)

    •    The participants of Bridge design pattern are:
           • ClientApp: Invokes the methods of ConcreteImplementor1 and
             ConcreteImplementor2 class.
           • Abstraction: Defines the methods that are implemented by
             ConcreteImplementor1 and ConcreteImplementor2 classes.
           • RefinedAbstraction: Extends the methods defined by class, Abstraction.
           • Implementor: Extends the methods of the Abstraction class to the
             implementation classes, ConcreteImplementor1 and
             ConcreteImplementor2.
           • ConcreteImplementor1: Implements the methods defined in the abstract
             class, Implementor.

          •   ConcreteImplementor2: Implements the methods defined in the abstract
              class, Implementor.


 ©NIIT                    Architecting J2EE Solutions      Lesson 2B / Slide 12 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    Class diagram of the Bridge design pattern




 ©NIIT                    Architecting J2EE Solutions   Lesson 2B / Slide 13 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    Composite Pattern
          • The Composite design pattern
              • Composes objects into tree structures.
              • Enables a client to identically treat both the single component and
                 collection of components.
          • The advantages of Composite design pattern are:
              • Adds new components.
              • Describes the hierarchies of a class, which consists of primitive and
                 complex objects.




 ©NIIT                    Architecting J2EE Solutions        Lesson 2B / Slide 14 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    The participants of Composite design pattern are:
         • ClientClass: Invokes methods of an object through Component interface.
         • Component: Declares interface for accessing and managing its child
              components.
         • Leaf: Defines an object in composition, which has no children.
         • Composite: Defines behavior for parent components and stores child
              components.




 ©NIIT                 Architecting J2EE Solutions      Lesson 2B / Slide 15 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    Class diagram of the Composite design pattern




 ©NIIT                 Architecting J2EE Solutions       Lesson 2B / Slide 16 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    Decorator Pattern
         • The Decorator design pattern
             • Enables you to extend the functionality of a particular object of a
                   class and dynamically provide additional responsibilities to it.
             • Uses composition instead of inheritance in order to extend the
                   functionality, the Decorator design pattern.
         • The advantages of using Decorator design pattern are:
             • It makes it easy to code a behavior, by enabling you to create
                   functionality classes.
             • It is more flexible as compared to static inheritance.
             • It improves the extensibility of an object as you code new classes
                   to make a change in functionality.




 ©NIIT                  Architecting J2EE Solutions       Lesson 2B / Slide 17 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
         •   The participants of Decorator design pattern are:
             • Component: Describes the functionality that the client requires.
             • ConcreteComponent: Implements the functionality described in the
                  abstract class, Component and represents the object to which you
                  can add additional functionalities.
             • Decorator: Enables ConcreteDecorator1 and ConcreteDecorator2 to
                  implement the functionality of the abstract class, Component.
             • ConcreteDecorator1: Implements the functionality of the abstract
                  class, Component through the abstract class, Decorator.
             • ConcreteDecorator2: Implements the functionality of the abstract
                  class, Component through the abstract class, Decorator.




 ©NIIT                Architecting J2EE Solutions       Lesson 2B / Slide 18 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
•      Class diagram of the Decorator design pattern




    ©NIIT                 Architecting J2EE Solutions   Lesson 2B / Slide 19 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    Facade Pattern
           • The Façade design pattern
               • Provides a unified interface to a collection of interfaces in a
                  subsystem.
           • The advantages of using Façade design pattern are:
               • Simplifies the interfacing that makes it difficult to use a large amount
                  of coupling.
               • Protects the client from the complex subsystem components.
           • The Façade design pattern has two participants:
               • Façade: Is also a participant of a system that intercepts client
                  requests and dispatches the request to the subsystem to service the
                  client request.
               • SubSystemN: Defines an application, which uses a façade to interact
                  with the client. There can be multiple subsystems in an application,
                  such as SubSystem1, SubSystem2, …, SubSystemN.



 ©NIIT                    Architecting J2EE Solutions         Lesson 2B / Slide 20 of 35
More on Design Patterns

Structural Design Patterns (Contd.)
    •    Class diagram of the Façade design pattern




 ©NIIT                   Architecting J2EE Solutions   Lesson 2B / Slide 21 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    Flyweight Pattern
          • The Flyweight design pattern is used to efficiently share information
               between a large numbers of objects.
          • Several objects may exist in a system, each using some information
               and thereby consuming a large amount of memory.
          • If all the objects share some static information, you can remove that
               information from each object and place in one object.
          • All other objects can refer to this object, thus reducing the memory
               requirement of the system.
          • The object, which contains the common information that is referenced
               by other objects, is known as the flyweight object.




 ©NIIT                Architecting J2EE Solutions       Lesson 2B / Slide 22 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    The advantages of using Flyweight design pattern are:
         • Enabling large amount objects to share information.
         • Making optimum use of memory.
    •    The participants of Flyweight design pattern are:
         • FlyweightFactory: Creates the flyweight objects.
         • Flyweight: Declares an interface to enable the flyweights to interact
              with the abstract state.
         • ClientApp: Invokes the methods of FlyweightFactory class.
         • ConcreteFlyweight: Implements the functionality of the abstract class,
              Flyweight.




 ©NIIT                 Architecting J2EE Solutions      Lesson 2B / Slide 23 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
•      Class diagram of the Flyweight design pattern




    ©NIIT                  Architecting J2EE Solutions   Lesson 2B / Slide 24 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
    •    Proxy Pattern
         • The Proxy design pattern enables you to provide a stand-in object in
              place of another object.
         • The stand-in object receives the requests that are meant for the original
              object and delegates the requests to the original object.
         • The examples of proxy are remote and virtual.
         • A remote proxy object provides a local representation of an object that
              runs in a different address space.




 ©NIIT                 Architecting J2EE Solutions        Lesson 2B / Slide 25 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
         •   The advantages of using Proxy design pattern are:
             • A remote proxy provides location transparency to the client of
                  object.
             • A virtual proxy provides memory optimization be creating objects
                  when required.

         •   The participants of Proxy design pattern are:
             • ClientProgram: Invokes the methods on a remote object.
             • InterfaceMatter: Declares the methods, which are implemented
                  by the Matter class.
             • Matter: An object that provides services to its clients.
             • Proxy: An object that intercepts the requests and delegates them
                  to the original object.




 ©NIIT                Architecting J2EE Solutions      Lesson 2B / Slide 26 of 35
More on Design Patterns


Structural Design Patterns (Contd.)
•      Class diagram of the Proxy design pattern




    ©NIIT                  Architecting J2EE Solutions   Lesson 2B / Slide 27 of 35
More on Design Patterns


Identifying Structural Design Patterns
         •   Problem Statement
             • BlueMoon Inc. provides software consultancy services. The
                  company foresees a high demand for the retail automation
                  software. As a result, BlueMoon Inc. decides to develop Retailer
                  Automation Solution (RAS), which provides the functions to update
                  the inventory, automate the sales record, and reduce the
                  transaction-processing time. RAS needs to be developed in a way
                  that it can be modified according to the specific requirements of
                  each retailer. For this reason, BlueMoon Inc. ensures that RAS is
                  extensible and adaptable, which enables BlueMoon Inc. to reuse
                  the components of the RAS to create customized solutions for
                  different retailers. John, the software consultant at BlueMoon Inc.
                  decides to model the structural diagram and identify the various
                  structural design patterns, which will enable him to reuse the
                  existing components.



 ©NIIT                 Architecting J2EE Solutions        Lesson 2B / Slide 28 of 35
More on Design Patterns


Identifying Structural Design Patterns
  (Contd.)
         •   Solution
             • To solve the preceding problem, perform the following tasks:
                  • Draw the structural diagram of the application.
                  • Identify the Decorator design pattern.
                  • Identify the Proxy design pattern.
                  • Identify the Bridge design pattern.
                  • Identify the Facade design pattern.




 ©NIIT                Architecting J2EE Solutions      Lesson 2B / Slide 29 of 35
More on Design Patterns


Behavioral Design Patterns

    •    The Behavioral design pattern
         • Defines the state, behavior, and communication among the objects.
         • Various Behavioral design patterns are Chain of Responsibility,
              Command, Interpreter, Iterator, Mediator, Memento, Observer, State,
              Strategy, Template Method, and Visitor.
    •    Chain of Responsibility Pattern
         • Chain of Responsibility design pattern
              • Decouples the sender and receiver of a request by introducing a
                   number of objects between them.
         • The advantages of using Chain of Responsibility design pattern are:
              • Enabling a group of classes to act as a single class.
              • Providing flexibility while dividing responsibilities among the
                   objects.


 ©NIIT                 Architecting J2EE Solutions       Lesson 2B / Slide 30 of 35
More on Design Patterns


Behavioral Design Patterns (Contd.)

•      Class diagram of the Chain of Responsibility design pattern




    ©NIIT                  Architecting J2EE Solutions         Lesson 2B / Slide 31 of 35
More on Design Patterns


Behavioral Design Patterns (Contd.)
    •    Command Pattern
         • The Command design pattern
            • Encapsulates a request as an object and enables the queuing and
                logging of requests.
            • Supports undo operations.
         • The advantages of using Command design pattern are:
            • Enables you to execute the commands whenever the resources are
                available.
            • Enables you to add new commands, as the existing classes do not
                change.




 ©NIIT                Architecting J2EE Solutions    Lesson 2B / Slide 32 of 35
More on Design Patterns


Behavioral Design Patterns (Contd.)
•      Class diagram of the Command design pattern




    ©NIIT                Architecting J2EE Solutions   Lesson 2B / Slide 33 of 35
More on Design Patterns


Summary
    •    Structural design patterns that describe the composition of the classes and
         objects. This design pattern introduces a level of indirection between a client
         class and the class that the client wants to use. The various structural design
         patterns are:
         • Adapter: Enables classes of different interfaces work together in a
              single program.
         • Bridge: Separates an interface from its implementation so that either
              can be changed without affecting each other.
         • Composite: Enables a client to identically treat both the single
              component and collection of components.
         • Decorator: Enables you to extend the functionality of a particular object
              and dynamically provide additional responsibilities to it.
         • Façade: provides a unified interface to a collection of interfaces in a
              subsystem.
         • Flyweight: Enable you to share information among a number of objects.
         • Proxy: Enables you to provide a stand-in object in place of another
              object.

 ©NIIT                  Architecting J2EE Solutions          Lesson 2B / Slide 34 of 35
More on Design Patterns


Summary(Contd.)
    •    Behavioral design patterns that describe the behavior of an object. The
         various Behavioral design patterns are Chain of Responsibility, Command,
         Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy,
         Template Method, and Visitor.
         • Chain of Responsibility: Defines a number of classes can handle a
              request without knowing the capabilities of other classes.
         • Command: Dispatches a request to a specific application.




 ©NIIT                  Architecting J2EE Solutions       Lesson 2B / Slide 35 of 35

More Related Content

What's hot

Vb net xp_10
Vb net xp_10Vb net xp_10
Vb net xp_10Niit Care
 
4 - Architetture Software - Architecture Portfolio
4 - Architetture Software - Architecture Portfolio4 - Architetture Software - Architecture Portfolio
4 - Architetture Software - Architecture PortfolioMajong DevJfu
 
Context-Oriented Programming
Context-Oriented ProgrammingContext-Oriented Programming
Context-Oriented Programmingkim.mens
 
Software Patterns
Software PatternsSoftware Patterns
Software Patternskim.mens
 
8 - Architetture Software - Architecture centric processes
8 - Architetture Software - Architecture centric processes8 - Architetture Software - Architecture centric processes
8 - Architetture Software - Architecture centric processesMajong DevJfu
 
2 - Architetture Software - Software architecture
2 - Architetture Software - Software architecture2 - Architetture Software - Software architecture
2 - Architetture Software - Software architectureMajong DevJfu
 
3 f6 9_distributed_systems
3 f6 9_distributed_systems3 f6 9_distributed_systems
3 f6 9_distributed_systemsop205
 
Software Engineering Sample Question paper for 2012
Software Engineering Sample Question paper for 2012Software Engineering Sample Question paper for 2012
Software Engineering Sample Question paper for 2012Neelamani Samal
 
Chapter 2 slides
Chapter 2 slidesChapter 2 slides
Chapter 2 slideslara_ays
 
3 f6 8_databases
3 f6 8_databases3 f6 8_databases
3 f6 8_databasesop205
 
OO Development 6 - Software Design
OO Development 6 - Software DesignOO Development 6 - Software Design
OO Development 6 - Software DesignRandy Connolly
 
Pitfalls of software product development
Pitfalls of software product developmentPitfalls of software product development
Pitfalls of software product developmentSofismo AG
 
Sa 006 modifiability
Sa 006 modifiabilitySa 006 modifiability
Sa 006 modifiabilityFrank Gielen
 

What's hot (20)

Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Vb net xp_10
Vb net xp_10Vb net xp_10
Vb net xp_10
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
05 architectural design
05 architectural design05 architectural design
05 architectural design
 
4 - Architetture Software - Architecture Portfolio
4 - Architetture Software - Architecture Portfolio4 - Architetture Software - Architecture Portfolio
4 - Architetture Software - Architecture Portfolio
 
Context-Oriented Programming
Context-Oriented ProgrammingContext-Oriented Programming
Context-Oriented Programming
 
Software Patterns
Software PatternsSoftware Patterns
Software Patterns
 
8 - Architetture Software - Architecture centric processes
8 - Architetture Software - Architecture centric processes8 - Architetture Software - Architecture centric processes
8 - Architetture Software - Architecture centric processes
 
2 - Architetture Software - Software architecture
2 - Architetture Software - Software architecture2 - Architetture Software - Software architecture
2 - Architetture Software - Software architecture
 
08 component level_design
08 component level_design08 component level_design
08 component level_design
 
3 f6 9_distributed_systems
3 f6 9_distributed_systems3 f6 9_distributed_systems
3 f6 9_distributed_systems
 
Introducing MDSD
Introducing MDSDIntroducing MDSD
Introducing MDSD
 
Software Engineering Sample Question paper for 2012
Software Engineering Sample Question paper for 2012Software Engineering Sample Question paper for 2012
Software Engineering Sample Question paper for 2012
 
5 software design
5 software design5 software design
5 software design
 
Chapter 2 slides
Chapter 2 slidesChapter 2 slides
Chapter 2 slides
 
3 f6 8_databases
3 f6 8_databases3 f6 8_databases
3 f6 8_databases
 
OO Development 6 - Software Design
OO Development 6 - Software DesignOO Development 6 - Software Design
OO Development 6 - Software Design
 
Pitfalls of software product development
Pitfalls of software product developmentPitfalls of software product development
Pitfalls of software product development
 
Software design
Software designSoftware design
Software design
 
Sa 006 modifiability
Sa 006 modifiabilitySa 006 modifiability
Sa 006 modifiability
 

Viewers also liked

Mr Paul Moore.odt retail2016
Mr Paul Moore.odt retail2016Mr Paul Moore.odt retail2016
Mr Paul Moore.odt retail2016paul moore
 
concetti elementari per la sicurezza
concetti elementari per la sicurezzaconcetti elementari per la sicurezza
concetti elementari per la sicurezzaPaolo Pasquinelli
 
Ville et mobile : nouvelles pistes de services
Ville et mobile : nouvelles pistes de servicesVille et mobile : nouvelles pistes de services
Ville et mobile : nouvelles pistes de servicesEmile Hooge
 
Java session08
Java session08Java session08
Java session08Niit Care
 
Arta conversatiei
Arta conversatieiArta conversatiei
Arta conversatieiBiro Bela
 
Portfolio_Mainak Dey
Portfolio_Mainak DeyPortfolio_Mainak Dey
Portfolio_Mainak DeyMainak Dey
 
10-etude des carffours
10-etude des carffours10-etude des carffours
10-etude des carffoursMehdid Hichem
 
The 3 e’s of customer experience
The 3 e’s of customer experienceThe 3 e’s of customer experience
The 3 e’s of customer experienceNIIT Technologies
 
la prochaine marque dominante du tourisme air bnb
la prochaine marque dominante du tourisme air bnbla prochaine marque dominante du tourisme air bnb
la prochaine marque dominante du tourisme air bnbFrederic Gonzalo
 
RAVI RANA HOTEL MANAGEMENT PPT
RAVI RANA HOTEL MANAGEMENT PPTRAVI RANA HOTEL MANAGEMENT PPT
RAVI RANA HOTEL MANAGEMENT PPTSameer Gurjar
 
Le marché du logement neuf en Ile de France - 3ème trimestre 2015
Le marché du logement neuf en Ile de France - 3ème trimestre 2015Le marché du logement neuf en Ile de France - 3ème trimestre 2015
Le marché du logement neuf en Ile de France - 3ème trimestre 2015Monimmeuble.com
 

Viewers also liked (18)

Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 
Mr Paul Moore.odt retail2016
Mr Paul Moore.odt retail2016Mr Paul Moore.odt retail2016
Mr Paul Moore.odt retail2016
 
Physics Tutor
Physics TutorPhysics Tutor
Physics Tutor
 
Cronograma de Evaluación
Cronograma de EvaluaciónCronograma de Evaluación
Cronograma de Evaluación
 
concetti elementari per la sicurezza
concetti elementari per la sicurezzaconcetti elementari per la sicurezza
concetti elementari per la sicurezza
 
Tharani Chellandy Resume
Tharani Chellandy ResumeTharani Chellandy Resume
Tharani Chellandy Resume
 
Ville et mobile : nouvelles pistes de services
Ville et mobile : nouvelles pistes de servicesVille et mobile : nouvelles pistes de services
Ville et mobile : nouvelles pistes de services
 
Management Agile & management 3.0
Management Agile & management 3.0Management Agile & management 3.0
Management Agile & management 3.0
 
Java session08
Java session08Java session08
Java session08
 
Arta conversatiei
Arta conversatieiArta conversatiei
Arta conversatiei
 
All about studio test
All about studio testAll about studio test
All about studio test
 
Portfolio_Mainak Dey
Portfolio_Mainak DeyPortfolio_Mainak Dey
Portfolio_Mainak Dey
 
10-etude des carffours
10-etude des carffours10-etude des carffours
10-etude des carffours
 
VKT.DinhHuuHanh
VKT.DinhHuuHanhVKT.DinhHuuHanh
VKT.DinhHuuHanh
 
The 3 e’s of customer experience
The 3 e’s of customer experienceThe 3 e’s of customer experience
The 3 e’s of customer experience
 
la prochaine marque dominante du tourisme air bnb
la prochaine marque dominante du tourisme air bnbla prochaine marque dominante du tourisme air bnb
la prochaine marque dominante du tourisme air bnb
 
RAVI RANA HOTEL MANAGEMENT PPT
RAVI RANA HOTEL MANAGEMENT PPTRAVI RANA HOTEL MANAGEMENT PPT
RAVI RANA HOTEL MANAGEMENT PPT
 
Le marché du logement neuf en Ile de France - 3ème trimestre 2015
Le marché du logement neuf en Ile de France - 3ème trimestre 2015Le marché du logement neuf en Ile de France - 3ème trimestre 2015
Le marché du logement neuf en Ile de France - 3ème trimestre 2015
 

Similar to Ajs 2 b

Vb.net session 03
Vb.net session 03Vb.net session 03
Vb.net session 03Niit Care
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxanguraju1
 
SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfB.T.L.I.T
 
Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design patternchetankane
 
kuyper_instructionalscience29
kuyper_instructionalscience29kuyper_instructionalscience29
kuyper_instructionalscience29Michiel Kuijper
 
1 IA Swinburne Faculty of Engineering, Science and Techn.docx
1 IA Swinburne Faculty of Engineering, Science and Techn.docx1 IA Swinburne Faculty of Engineering, Science and Techn.docx
1 IA Swinburne Faculty of Engineering, Science and Techn.docxjeremylockett77
 
Design Concepts in Software Engineering-1.pptx
Design Concepts in Software Engineering-1.pptxDesign Concepts in Software Engineering-1.pptx
Design Concepts in Software Engineering-1.pptxKarthigaiSelviS3
 
Software Architecture by Reuse, Composition and Customization
Software Architecture by Reuse, Composition and Customization  Software Architecture by Reuse, Composition and Customization
Software Architecture by Reuse, Composition and Customization Ivano Malavolta
 
Vb.net session 13
Vb.net session 13Vb.net session 13
Vb.net session 13Niit Care
 
NGIoT Sustainability Workshop 2023_ Hans-Martin Heyn presentation
NGIoT Sustainability Workshop 2023_ Hans-Martin Heyn presentationNGIoT Sustainability Workshop 2023_ Hans-Martin Heyn presentation
NGIoT Sustainability Workshop 2023_ Hans-Martin Heyn presentationVEDLIoT Project
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)stanbridge
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General IntroductionAsma CHERIF
 
Csqe sample exam 1 solutions 05.00.04
Csqe sample exam 1   solutions 05.00.04Csqe sample exam 1   solutions 05.00.04
Csqe sample exam 1 solutions 05.00.04binodrit98
 
Chapter 1 - Software Design - Introduction.pptx
Chapter 1 - Software Design - Introduction.pptxChapter 1 - Software Design - Introduction.pptx
Chapter 1 - Software Design - Introduction.pptxHaifaMohd3
 

Similar to Ajs 2 b (20)

Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Dacj 1-1 c
Dacj 1-1 cDacj 1-1 c
Dacj 1-1 c
 
Vb.net session 03
Vb.net session 03Vb.net session 03
Vb.net session 03
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdf
 
Design patterns tutorials
Design patterns tutorialsDesign patterns tutorials
Design patterns tutorials
 
Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design pattern
 
Architectural design
Architectural designArchitectural design
Architectural design
 
kuyper_instructionalscience29
kuyper_instructionalscience29kuyper_instructionalscience29
kuyper_instructionalscience29
 
1 IA Swinburne Faculty of Engineering, Science and Techn.docx
1 IA Swinburne Faculty of Engineering, Science and Techn.docx1 IA Swinburne Faculty of Engineering, Science and Techn.docx
1 IA Swinburne Faculty of Engineering, Science and Techn.docx
 
Design Concepts in Software Engineering-1.pptx
Design Concepts in Software Engineering-1.pptxDesign Concepts in Software Engineering-1.pptx
Design Concepts in Software Engineering-1.pptx
 
Software Architecture by Reuse, Composition and Customization
Software Architecture by Reuse, Composition and Customization  Software Architecture by Reuse, Composition and Customization
Software Architecture by Reuse, Composition and Customization
 
Vb.net session 13
Vb.net session 13Vb.net session 13
Vb.net session 13
 
NGIoT Sustainability Workshop 2023_ Hans-Martin Heyn presentation
NGIoT Sustainability Workshop 2023_ Hans-Martin Heyn presentationNGIoT Sustainability Workshop 2023_ Hans-Martin Heyn presentation
NGIoT Sustainability Workshop 2023_ Hans-Martin Heyn presentation
 
unit 3 Design 1
unit 3 Design 1unit 3 Design 1
unit 3 Design 1
 
Ch08lect2 ud
Ch08lect2 udCh08lect2 ud
Ch08lect2 ud
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
 
Csqe sample exam 1 solutions 05.00.04
Csqe sample exam 1   solutions 05.00.04Csqe sample exam 1   solutions 05.00.04
Csqe sample exam 1 solutions 05.00.04
 
Chapter 1 - Software Design - Introduction.pptx
Chapter 1 - Software Design - Introduction.pptxChapter 1 - Software Design - Introduction.pptx
Chapter 1 - Software Design - Introduction.pptx
 

More from Niit Care

More from Niit Care (17)

Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 1-3 b
Dacj 1-3 bDacj 1-3 b
Dacj 1-3 b
 
Dacj 1-3 a
Dacj 1-3 aDacj 1-3 a
Dacj 1-3 a
 
Dacj 1-2 c
Dacj 1-2 cDacj 1-2 c
Dacj 1-2 c
 
Dacj 1-2 a
Dacj 1-2 aDacj 1-2 a
Dacj 1-2 a
 
Dacj 1-1 b
Dacj 1-1 bDacj 1-1 b
Dacj 1-1 b
 
Dacj 1-1 a
Dacj 1-1 aDacj 1-1 a
Dacj 1-1 a
 
Dacj 2-2 b
Dacj 2-2 bDacj 2-2 b
Dacj 2-2 b
 
Dacj 2-2 a
Dacj 2-2 aDacj 2-2 a
Dacj 2-2 a
 
Dacj 2-1 c
Dacj 2-1 cDacj 2-1 c
Dacj 2-1 c
 
Dacj 2-1 b
Dacj 2-1 bDacj 2-1 b
Dacj 2-1 b
 

Recently uploaded

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

Ajs 2 b

  • 1. More on Design Patterns Pre-assessment Questions 2. Which UML diagram depicts the sequential invocation of methods of a system? a) Sequence b) Collaboration c) Package d) Use Case ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 1 of 35
  • 2. More on Design Patterns Pre-assessment Questions 2. Which option identifies the scope of a system in a Use Case diagram and is represented by a solid rectangle? a) Use Case b) Message c) Actor d) State boundary ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 2 of 35
  • 3. More on Design Patterns Pre-assessment Questions 2. Consider the statements: Statement A: Extent relationship indicates that an existing use case is extended by additional behavior to obtain another use case. Statement B: Include relationship indicates that the functions of one use case are included in the functions of the other. Identify the correct option. a) Statement A is true and statement B is false b) Statement A is false and statement B is true c) Both, statements A and B, are true d) Both, statements A and B, are false ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 3 of 35
  • 4. More on Design Patterns Pre-assessment Questions 2. Consider the statements: Statement A: Component diagram represents the grouping of related classes, interfaces, and methods of a given system. Statement B: Component diagram elements represent the various components of business entities of a given system. Identify the correct option. a) Statement A is true and statement B is false b) Statement A is false and statement B is true c) Both, statements A and B, are true d) Both, statements A and B, are false ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 4 of 35
  • 5. More on Design Patterns Pre-assessment Questions 2. Which element of GoF’s design pattern emphasizes on relationships, responsibilities, and collaborations among the constituents of a pattern? a) Pattern name b) Solution c) Problem d) Consequences ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 5 of 35
  • 6. More on Design Patterns Solutions to Pre-assessment Questions 1. a. Sequence 2. d. State boundary 3. c. Both, statements A and B, are true 4. b. Statement A is false and statement B is true 5. b. Solution ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 6 of 35
  • 7. More on Design Patterns Objectives In this lesson you will learn to: • Use Structural Design Patterns • Use Behavioral Design Patterns ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 7 of 35
  • 8. More on Design Patterns Structural Design Patterns • Structural design patterns • Represent the composition of classes and objects. • Defines how classes inherit each other. • The class-creation pattern uses inheritance in order to provide more functional program interfaces. • The object-creation pattern defines how objects can be composed to provide new functionality using object composition. • The various structural design patterns are Adaptor, Bridge, Composite, Decorator, Façade, Flyweight, and Proxy. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 8 of 35
  • 9. More on Design Patterns Structural Design Patterns (Contd.) • Adapter Pattern • The Adapter design pattern • Converts the interface of a class into an interface that is required by the client. • The advantages of using Adapter design pattern are: • Enabling two or more incompatible objects to interact with each other. • Making an existing functionality reusable. • The participants of Adapter design pattern are: • adapterTest : Implements the methods of MouseAdapter class. • MouseListener: Receives the mouse events generated. • MouseAdapter: Provides blank implementation of the methods defined in the MouseListener abstract class. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 9 of 35
  • 10. More on Design Patterns Structural Design Patterns (Contd.) • Class diagram of the Adapter design pattern ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 10 of 35
  • 11. More on Design Patterns Structural Design Patterns (Contd.) • Bridge Pattern • The Bridge design pattern • Separates an interface and its implementation. This enables both the interface and its interface to change without affecting each other. • Uses encapsulation, aggregation, and inheritance to divide responsibilities into various classes. • The advantages of using Bridge design pattern are: • Separates the implementation details from interface. • Hides implementation details from the client. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 11 of 35
  • 12. More on Design Patterns Structural Design Patterns (Contd.) • The participants of Bridge design pattern are: • ClientApp: Invokes the methods of ConcreteImplementor1 and ConcreteImplementor2 class. • Abstraction: Defines the methods that are implemented by ConcreteImplementor1 and ConcreteImplementor2 classes. • RefinedAbstraction: Extends the methods defined by class, Abstraction. • Implementor: Extends the methods of the Abstraction class to the implementation classes, ConcreteImplementor1 and ConcreteImplementor2. • ConcreteImplementor1: Implements the methods defined in the abstract class, Implementor. • ConcreteImplementor2: Implements the methods defined in the abstract class, Implementor. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 12 of 35
  • 13. More on Design Patterns Structural Design Patterns (Contd.) • Class diagram of the Bridge design pattern ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 13 of 35
  • 14. More on Design Patterns Structural Design Patterns (Contd.) • Composite Pattern • The Composite design pattern • Composes objects into tree structures. • Enables a client to identically treat both the single component and collection of components. • The advantages of Composite design pattern are: • Adds new components. • Describes the hierarchies of a class, which consists of primitive and complex objects. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 14 of 35
  • 15. More on Design Patterns Structural Design Patterns (Contd.) • The participants of Composite design pattern are: • ClientClass: Invokes methods of an object through Component interface. • Component: Declares interface for accessing and managing its child components. • Leaf: Defines an object in composition, which has no children. • Composite: Defines behavior for parent components and stores child components. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 15 of 35
  • 16. More on Design Patterns Structural Design Patterns (Contd.) • Class diagram of the Composite design pattern ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 16 of 35
  • 17. More on Design Patterns Structural Design Patterns (Contd.) • Decorator Pattern • The Decorator design pattern • Enables you to extend the functionality of a particular object of a class and dynamically provide additional responsibilities to it. • Uses composition instead of inheritance in order to extend the functionality, the Decorator design pattern. • The advantages of using Decorator design pattern are: • It makes it easy to code a behavior, by enabling you to create functionality classes. • It is more flexible as compared to static inheritance. • It improves the extensibility of an object as you code new classes to make a change in functionality. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 17 of 35
  • 18. More on Design Patterns Structural Design Patterns (Contd.) • The participants of Decorator design pattern are: • Component: Describes the functionality that the client requires. • ConcreteComponent: Implements the functionality described in the abstract class, Component and represents the object to which you can add additional functionalities. • Decorator: Enables ConcreteDecorator1 and ConcreteDecorator2 to implement the functionality of the abstract class, Component. • ConcreteDecorator1: Implements the functionality of the abstract class, Component through the abstract class, Decorator. • ConcreteDecorator2: Implements the functionality of the abstract class, Component through the abstract class, Decorator. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 18 of 35
  • 19. More on Design Patterns Structural Design Patterns (Contd.) • Class diagram of the Decorator design pattern ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 19 of 35
  • 20. More on Design Patterns Structural Design Patterns (Contd.) • Facade Pattern • The Façade design pattern • Provides a unified interface to a collection of interfaces in a subsystem. • The advantages of using Façade design pattern are: • Simplifies the interfacing that makes it difficult to use a large amount of coupling. • Protects the client from the complex subsystem components. • The Façade design pattern has two participants: • Façade: Is also a participant of a system that intercepts client requests and dispatches the request to the subsystem to service the client request. • SubSystemN: Defines an application, which uses a façade to interact with the client. There can be multiple subsystems in an application, such as SubSystem1, SubSystem2, …, SubSystemN. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 20 of 35
  • 21. More on Design Patterns Structural Design Patterns (Contd.) • Class diagram of the Façade design pattern ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 21 of 35
  • 22. More on Design Patterns Structural Design Patterns (Contd.) • Flyweight Pattern • The Flyweight design pattern is used to efficiently share information between a large numbers of objects. • Several objects may exist in a system, each using some information and thereby consuming a large amount of memory. • If all the objects share some static information, you can remove that information from each object and place in one object. • All other objects can refer to this object, thus reducing the memory requirement of the system. • The object, which contains the common information that is referenced by other objects, is known as the flyweight object. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 22 of 35
  • 23. More on Design Patterns Structural Design Patterns (Contd.) • The advantages of using Flyweight design pattern are: • Enabling large amount objects to share information. • Making optimum use of memory. • The participants of Flyweight design pattern are: • FlyweightFactory: Creates the flyweight objects. • Flyweight: Declares an interface to enable the flyweights to interact with the abstract state. • ClientApp: Invokes the methods of FlyweightFactory class. • ConcreteFlyweight: Implements the functionality of the abstract class, Flyweight. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 23 of 35
  • 24. More on Design Patterns Structural Design Patterns (Contd.) • Class diagram of the Flyweight design pattern ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 24 of 35
  • 25. More on Design Patterns Structural Design Patterns (Contd.) • Proxy Pattern • The Proxy design pattern enables you to provide a stand-in object in place of another object. • The stand-in object receives the requests that are meant for the original object and delegates the requests to the original object. • The examples of proxy are remote and virtual. • A remote proxy object provides a local representation of an object that runs in a different address space. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 25 of 35
  • 26. More on Design Patterns Structural Design Patterns (Contd.) • The advantages of using Proxy design pattern are: • A remote proxy provides location transparency to the client of object. • A virtual proxy provides memory optimization be creating objects when required. • The participants of Proxy design pattern are: • ClientProgram: Invokes the methods on a remote object. • InterfaceMatter: Declares the methods, which are implemented by the Matter class. • Matter: An object that provides services to its clients. • Proxy: An object that intercepts the requests and delegates them to the original object. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 26 of 35
  • 27. More on Design Patterns Structural Design Patterns (Contd.) • Class diagram of the Proxy design pattern ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 27 of 35
  • 28. More on Design Patterns Identifying Structural Design Patterns • Problem Statement • BlueMoon Inc. provides software consultancy services. The company foresees a high demand for the retail automation software. As a result, BlueMoon Inc. decides to develop Retailer Automation Solution (RAS), which provides the functions to update the inventory, automate the sales record, and reduce the transaction-processing time. RAS needs to be developed in a way that it can be modified according to the specific requirements of each retailer. For this reason, BlueMoon Inc. ensures that RAS is extensible and adaptable, which enables BlueMoon Inc. to reuse the components of the RAS to create customized solutions for different retailers. John, the software consultant at BlueMoon Inc. decides to model the structural diagram and identify the various structural design patterns, which will enable him to reuse the existing components. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 28 of 35
  • 29. More on Design Patterns Identifying Structural Design Patterns (Contd.) • Solution • To solve the preceding problem, perform the following tasks: • Draw the structural diagram of the application. • Identify the Decorator design pattern. • Identify the Proxy design pattern. • Identify the Bridge design pattern. • Identify the Facade design pattern. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 29 of 35
  • 30. More on Design Patterns Behavioral Design Patterns • The Behavioral design pattern • Defines the state, behavior, and communication among the objects. • Various Behavioral design patterns are Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, and Visitor. • Chain of Responsibility Pattern • Chain of Responsibility design pattern • Decouples the sender and receiver of a request by introducing a number of objects between them. • The advantages of using Chain of Responsibility design pattern are: • Enabling a group of classes to act as a single class. • Providing flexibility while dividing responsibilities among the objects. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 30 of 35
  • 31. More on Design Patterns Behavioral Design Patterns (Contd.) • Class diagram of the Chain of Responsibility design pattern ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 31 of 35
  • 32. More on Design Patterns Behavioral Design Patterns (Contd.) • Command Pattern • The Command design pattern • Encapsulates a request as an object and enables the queuing and logging of requests. • Supports undo operations. • The advantages of using Command design pattern are: • Enables you to execute the commands whenever the resources are available. • Enables you to add new commands, as the existing classes do not change. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 32 of 35
  • 33. More on Design Patterns Behavioral Design Patterns (Contd.) • Class diagram of the Command design pattern ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 33 of 35
  • 34. More on Design Patterns Summary • Structural design patterns that describe the composition of the classes and objects. This design pattern introduces a level of indirection between a client class and the class that the client wants to use. The various structural design patterns are: • Adapter: Enables classes of different interfaces work together in a single program. • Bridge: Separates an interface from its implementation so that either can be changed without affecting each other. • Composite: Enables a client to identically treat both the single component and collection of components. • Decorator: Enables you to extend the functionality of a particular object and dynamically provide additional responsibilities to it. • Façade: provides a unified interface to a collection of interfaces in a subsystem. • Flyweight: Enable you to share information among a number of objects. • Proxy: Enables you to provide a stand-in object in place of another object. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 34 of 35
  • 35. More on Design Patterns Summary(Contd.) • Behavioral design patterns that describe the behavior of an object. The various Behavioral design patterns are Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, and Visitor. • Chain of Responsibility: Defines a number of classes can handle a request without knowing the capabilities of other classes. • Command: Dispatches a request to a specific application. ©NIIT Architecting J2EE Solutions Lesson 2B / Slide 35 of 35