Topic outline

  • Design Pattern Exercises in Java

    Contributors : Christophe Saint Marcel (Velossity)

    Contact : Christophe Saint Marcel

    Logo UGA

  • What is in this catalog ?


    This catalog provides exercises about design patterns. Each exercise defines a context and a problem for which you must apply one or more Design Patterns. Caseine checks that your design and your implementation conforms to the original solution.

    All solutions should be first modelled with UML, then implemented in Java and checked with the JUnit framework.

    You do not have to follow the proposed order of exercises. Each of them is built separately so as you are free to pick one or another pattern.

    All the exercises are compliant and tested with the Eclipse Plugin for CaseInE.

    Prerequisites

    - Object-Oriented Design

    - Java

    - UML: Class and sequence diagrams


    References

    Most of the pattern come from the book written in 1994 by the Gang of 4, Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides. "Design Patterns: Elements of Reusable Object-Oriented Software" is even today a bible for OO practitioners.

    All the exercises are proposed by a community of teachers and students motivated by open courses. Feel free to propose new Design Pattern challenges of your own.

  • What is not in this catalog ?

    It is not yet another catalogue of Design Patterns. It does not answer to questions like what is a given Design Pattern useful for, how it works or in which context it applies. 


    Patterns themselves are generally not described in this course. Patterns and usage samples are widely documented on the internet. 

    We will soon propose a merge with the site of Cédric Bouhours. It is the right place to discover Design Patterns!

    Before starting an exercise, be sure you have understood the underlying pattern. 

  • Adapter

    Family: Structural

    Intent:
    Adapts the contract of a class into another contract

    Can be used to wrap a class behind an interface

    Useful when you want to use legacy systems

  • Command

    Family: Behavioural

    Intent: Encapsulates an operation as an object that can be called hereafter, in parallel or in sequence. It supports undoable operations. Command decouples the object that invokes the operation from the one that knows how to perform it.


  • Factory

    Family: Creational

    Intent:
    Encapsulating object creation.

  • Iterator

    Family: Behavioural

    Intent:
    Provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation

  • Observer

    Family: Behavioural

    Intent:

    Lets you define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.





  • Singleton

    Family: Creational

    Intent:
    Ensure a class has only one instance, and provide a global point of access to it.



  • Proxy

    Family: Structural

    Intent

    Proxy is a structural design pattern that lets you provide a substitute or placeholder for another object. A proxy controls access to the original object, allowing you to perform something either before or after the request gets through to the original object.


  • Quizz