Docstoc

Design Pattern Implementation

Document Sample
Design Pattern Implementation Powered By Docstoc
					                         Design Pattern Implementation

Currently Implemented Patterns

1. Façade Pattern
       Participants:
            (Façade) HealthWatcherFacade(Init) class
            (sub-system classes) HW Record Classes (ComplaintRecord,
               HealthUnitRecord, EmployeeRecord etc.)

       Composition Features 1:
          Class-level interlacing via HealthWatcherFacade(Init) class.
          Composed with Singleton pattern.

       Composition Features 2:
          Some type of overlapping (not sure of the exact classification) via
            HealthWatcherFacadeInit class.
          Composed with Strategy pattern.

       Composition Features 3:
          Class-level interlacing via HealthWatcherFacade(Init) class.
          Composed with Adapter Pattern.

       Composition Features 4:
          Complete overlapping via HealthWatcherFacade(Init) class
          Composed with PDC Pattern

       Composition Features 5:
          Complete overlapping via PDC BusinessCollection classes
            (ComplaintRecord, DiseaseRecord, etc.)
          Composed with PDC pattern
          Not really suprising as PDC pattern is implemented using the Façade
            pattern.

       Composition Features 6:
          Invocation-based composition via Class Controlled class of the
            Concurrency Manager pattern
          Composed with Concurrency Manager Pattern

2. Singleton Pattern (Instance 1)
        Participants:
             (Singleton) HealthWatcherFacade(Init?) class

       Composition Features 1:
          Class-level interlacing via HealthWatcherFacade(Init) class.
          Composed with Façade pattern.

       Composition Features 2:
          Class-level interlacing via HealthWatcherFacade(Init) class.
             Composed with Adapter Pattern.

       Composition Features 3:
          Class-level interlacing via HealthWatcherFacade(Init) class.
          Composed with PDC Pattern.


3. Singleton Pattern (Instance 2)
        Participants:
             (Singleton) PersistenceMechanism class

       Composition Features 1:
          Some type of overlapping (not sure of the exact classification) via
            HealthWatcherFacadeInit class.
          Composed with Strategy pattern.

4. Strategy Pattern
        Participants:
             (Strategy) IComplaintRepository interface
             (Concrete Strategy) Repository Array classes
                (ComplaintRepositoryArray, DiseaseRepositoryArray,
                EmployeeRepositoryArray, etc.), Repositry Database classes
                (ComplaintRepositoryBDR, DiseaseRepositroyBDR,
                EmployeeRepositoryArray, etc.)
             (Context) HealthWatchFacade(Init) class

       Composition Features 1:
          Some type of overlapping (not sure of the exact classification) via
            HealthWatcherFacadeInit class.
          Composed with Facade pattern.

       Composition Features 2:
          Some type of overlapping (not sure of the exact classification) via
            HealthWatcherFacadeInit class.
          Composed with Singleton pattern (Instance 1).

       Composition Features 3:
          Method interlacing/overlapping via HealthWatcherFacade(Init) class.
          Composed with Adapter Pattern.

       Composition Features 4:
          Class-level interlacing via HealthWatcherFacade(Init) class.
          Composed with PDC Pattern.

       Composition Features 6:
          Class-level overlapping via PersistentDataCollection classes
            (ComplaintRepositoryBDR, EmployeeRepositoryBDR, etc.)
          Composed with Strategy Pattern
5. Adapter Pattern (not sure if this is fully implemented/working)
       Participants:
            (Target) IteratorDsk interface
            (Client) HealthWatcherFacade class
            (Adaptee) ConcreteIterator
            (Adapter) IteratorRMISourceAdapter and IteratorRMITargetAdapter
               (?) classes.

       Composition Features 1:
          Method interlacing/overlapping via HealthWatcherFacade methods.
          Composed with Façade pattern.

       Composition Features 2:
          Class-level interlacing via HealthWatcherFacade(Init) class.
          Composed with Singleton Pattern (Instance 1).

       Composition Features 3:
          Class-level interlacing via HealthWatcherFacade(Init) class.
          Composed with Strategy Pattern.

       Composition Features 4:
          Class-level interlacing via HealthWatcherFacade(Init) class.
          Composed with PDC Pattern.

6. Persistent Data Collections (PDC) Pattern
        Participants:
             (Façade) HealthWatcherFacade(Init) class
             (BusinessBasic) Complaint, DiseaseType, HealthUnit, Employee,
                Speciality
             (BusinessCollection) ComplaintRecord, DiseaseRecord,
                HealthUnitRecord, EmployeeRecord, SpecialityRecord
             (PersistentDataCollection) ComplaintRepositoryBDR,
                DiseaseRepositoryBDR, HealthUnitRepoistoryBDR,
                EmployeeRepositoryBDR, SpecialityRepositoryBDR
             (IBusiness-Data) IComplaintRepository, IDiseaseRepository,
                IHealthUnitRepository, IEmployeeRepository, ISpecilaityRepository
             (PersistenceMechanism) PersistenceMechanism class
             (IPersistenceMechanism) IPersistenceMechanism interface

       Composition Features 1:
          Complete overlapping via HealthWatcherFacade(Init) class
          Composed with Façade pattern

       Composition Features 2:
          Complete overlapping via Façade sub-system classes
            (ComplaintRecord, DiseaseRecord, etc.)
          Composed with Façade pattern
             Not really suprising as PDC pattern is implemented using the Façade
              pattern.

       Composition Features 3:
          Class-level interlacing via HealthWatcherFacade(Init) class.
          Composed with Singleton Pattern (Instance 1).

       Composition Features 4:
          Class-level interlacing via HealthWatcherFacade(Init) class.
          Composed with Strategy Pattern.

       Composition Features 5:
          Class-level interlacing via HealthWatcherFacade(Init) class.
          Composed with Adapter Pattern.

       Composition Features 6:
          Class-level overlapping via Concrete Strategy classes
            (ComplaintRepositoryBDR, EmployeeRepositoryBDR, etc.)
          Composed with Strategy Pattern

       Composition Features 7:
          Class-level overlapping via Singleton class form Singleton Pattern
            (Instance 2).
          Composed with Singleton Pattern (Instance 2).

       Composition Features 8:
          Invocation-based composition via Class Controlled class of the
            Concurrency Manager pattern
          Composed with Concurrency Manager Pattern

7. Concurrency Manager Pattern (not fully implemented in HW)
       Participants:
            (ClassControlled) Employee class (insert can occasionally be executed
               concurrently depending on the login name of the Employee being
               inserted) although the pattern is only invoked through
               EmployeeRecord class
            (Thread)
            (IConcurrencyManager)
            (ConcurrencyManager) ConcurrencyManager class
            (ConcurrencyManagerData)

       Composition Features 1:
          Invocation-based composition via sub-system classes of the Façade
            pattern
          Composed with Façade Pattern

       Composition Features 2:
          Invocation-based composition via BusinessCollection classes of PDC
            pattern
              Composed with PDC pattern

Potential New Patterns

1. Observer Pattern
Use the observer pattern to detect when an HW data entry is updated, this can then be
used to update the dirty object list so that the database can be updated accordingly.

2. Command Pattern
Encapsulate the various operations to be carried out by the Servlets into there own
objects, decouples the commands to be invoked from the user-interfaces would then
make it possible to use an interface other than servlets.

3. Abstract Factory Pattern
Uira – could you comment on this please???

4. Factory Method Pattern
Uira – could you comment on this please???

5. Interpreter Pattern
Could possibly be used to verify the SQL statements being entered??? Not sure if this
is really appropriate though as the SQL statements used in HW are constant.

6. State Design Pattern
Could use the complaint status to alter the behaviour of the complaint in some way –
perhaps use this to prevent changes being made to its state when the complaint is
closed for example?

				
DOCUMENT INFO