CSC/ECE 517 Summer 2008/wiki3 3 dm

From Expertiza_Wiki
Jump to navigation Jump to search

Topic Description

Patterns Almanac. Peruse the Patterns Almanac for additional patterns that seem appropriate to cover in CSC/ECE 517. Explain why the patterns are appropriate for students to learn, and if possible, link to training materials (explanations, examples, etc.) for covering them. Your reviewers should rate your choices on how much value they will add to the course!

Introduction

In CSC/ECE 517 we cover a number of basic design patterns in an effort to aid our coding development. Design Patterns like most intellectual processes provide a framework for thought, getting you to think of components and polymorphism. By examining the problem and deciding which pattern fits it most closely, we create a basic framework for the program to be constructed from. A factory pattern dedicates certain components and behaves in a certain manner, so using it for an application implies both structure and function.

However we only cover a small number of the possible patterns, with many of them being either too simplistic to be encompassing or providing the necessary structure for the sort of programming we are likely to need to perform in the work force. While they provide a basic tool box, but that isn't going to sufficient for wielding or electrician's work. So we need more complex patterns to deal with much more likely scenarios.

Pattern Definitions

  1. Acyclical Vistor A more robust version of the more traditional visitor pattern, it defines operations to be performed on an object without adding them to the class itself or the class hierarchy. This can be useful if one needs to build handling or transformation functions that would otherwise not be a part of that class hierarchy. Avoids the dependency loops that can otherwise result in visitor or other rigid designs. This pattern is our default pattern for discussing functions or even classes that we can't fit into a design or to add necessary functionality. So this is your go to pattern when your boss requires additional functionality that your object structure can't handle or you need add a handler/converter function for an object that doesn't fit into your object structure or increase the complexity to unacceptable degrees.
  2. Command Processor A more complex version of the command pattern, it is defined by creating an object to encapsulate a request. It allows you to create parameters for the methods that go with the request, allow for customization based on the client. This pattern allows for scheduling requests and creating queues. This pattern can handle many different 'clients', creating a very versatile request and handling engine. A good example would be an object that handles request for locks or encryption. By creating a central object that handles the other "commands" and the overall scheduling can add a significant amount of flexibility. By creating a basic framework for the command, you can then use that processor to schedule them without having to modify the processor. This is also the basis for any interpreted languages or scripting, and prove valuable insight should you need to construct a custom controls for a program.
  3. Half-Object+Protocol A pattern that deals with multiple address spaces and the problems with getting information between them. Since you cannot have a single object that exists in more than 1 address space, you divide the object into two interdependent objects which use a protocol to communicate. This is a valuable pattern as its the basis of every type of distributed and internet structure, server/clients or even distributed nodes needing to communicate and being in separate address spaces. Besides simply being the basic pattern for anything that functions on the internet or distributed computing, it also can prove useful for dividing objects over multiple threads as well. Given the increasingly common multiple core system, especially with hyperthreading, this is exceptionally useful.
  4. Pipes and Filters A pattern dealing primarily with streams of data, something that is more and more common in days of feeds and streaming. By constructing a pipeline as your primary object and then applying filters to generate the correct objects at the other end are particularly useful. Pipes connect filters which are the abstraction on any data operation. Any sort of input stream will naturally lead to this pattern. This can be a file stream or bit stream, which is becoming more common as more information is streamed in from cameras. Facial recognition and filters designed to break images down to data points a computer can interpret is an ever more common field.
  5. Wrapper Facade Based on the facade pattern, this pattern provides a robust object to encompass low-level data structures and operations. This is designed to make those structures easier to work with and provided additional functionality. Anytime that an object needs to deal with an int or any other primitive, it should have a wrapper. But primarily this deals lower-level interfaces like those that handles or manages the input from registers and other elements. At it can also handle the functionality that we don't want to expose to the rest of program as well, like encryption generation and the like.
  6. Presentation-Abstraction-Controller PAC can be seen as a generalization and extension of Model/View/Controller. It defines a structure for interactive software systems in the form of a hierarchy of cooperating agents.Every agent is responsible for a specific aspect of the application’s functionality and consists of three components: presentation, abstraction and control.The key to the pattern is that PAC agents can be built up into layers with the Presentation API of each lower agent creating a higher abstraction for the next level.
  7. Broker "The Broker architectural pattern can be used to structure distributed software systems with decoupled components that interact by remote service invocations. A broker component is responsible for coordinating communication, such as forwarding requests, as well as for transmitting results and exceptions." (Buschmann, F., R. Meunier, H. Rohnert, P. Sommerlad, and M. Stal. Pattern-Oriented Software Architecture: A System Of Patterns. West Sussex, England: John Wiley & Sons Ltd., 1996
  8. Client-Dispatcher-Server "The Client-Dispatcher-Server design pattern introduces an intermediate layer between clients and servers, the dispatcher component. It provides location transparency by means of a name service, and hides the details of the establishment of the communication connection between clients and servers." (Buschmann, F., R. Meunier, H. Rohnert, P. Sommerlad, M. Stal. Pattern-Oriented Software Architecture: A System Of Patterns. West Sussex, England: John Wiley & Sons Ltd., 1996)
  9. Reflection "The Reflection architectural pattern provides a mechanism for changing structure and behavior of software systems dynamically. It supports the modification of fundamental aspects, such as type structures and function call mechanisms. In this pattern, an application is split into two parts. A meta level provides information about selected system properties and makes the software self-aware. A base level includes the application logic. Its implementation builds on the meta level. Changes to information kept in the meta level affect subsequent base-level behavior." (Buschmann, F., R. Meunier, H. Rohnert, P. Sommerlad, and M. Stal. Pattern-Oriented Software Architecture: A System Of Patterns. West Sussex, England: John Wiley & Sons Ltd., 1996)
  10. Pluggable Factory Create objects from a repository. When a client requests an object from the repository, a reseller object can instantiate a class in the repository by name. Clients can also query the repository for a list of class names.This pattern is an extension of Factory Method [Gamma+95] and Abstract Factory [Gamma+95].

Conclusions

Overall, each of these patterns provides more descriptive and focused scenarios. Each of these design patterns are less likely to appropriate for a given program, as they have more specific requires. But in return they provide much greater detail or deal with problems that the other patterns cannot properly cope with. These select few are examples that will likely be much more common in the future, in both distributed and internet development. These new patterns are more tools for the box, providing more information and dealing with scenarios. Most of the modern applications are likely to fall into using these patterns.

Related Links

  1. http://c2.com/cgi/wiki?AcyclicVisitor
  2. http://www.vico.org/pages/PatronsDisseny/Pattern%20Command%20Processor/index.html
  3. http://jan.newmarch.name/distjava/hopp/lecture.html
  4. http://msdn.microsoft.com/en-us/library/ms978599.aspx
  5. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.5282
  6. http://web.ist.utl.pt/rito.silva/mdo/papers/Kobryn.html
  7. http://www.automationit.hut.fi/julkaisut/documents/seminars/sem_s02/Honkanen_paper.pdf
  8. http://www.smallmemory.com/almanac/Schmidt99.html
  9. http://www.smallmemory.com/almanac/Meunier95.html
  10. http://www.smallmemory.com/almanac/Martin98.html
  11. http://www.smallmemory.com/almanac/Sommerlad96.html
  12. http://www.cix.co.uk/~smallmemory/almanac/VandenBroeckeEtc97.html
  13. http://www.smallmemory.com/almanac/BuschmannEtc96.html
  14. http://www.vico.org/pages/PatronsDisseny/Pattern%20Broker