Friday, September 07, 2007
Long time-no post...
I haven't posted here in a long time. For awhile this site has been used mainly when I'm involved with a class where using a blog helped. I'm in another class but I'm not sure yet if I'll be using this blog or my main blog (www.williamsblog.net). Anyway this class is with Jones International University (JUI) and (short version) it's about e-learning.
Tuesday, March 22, 2005
Overview of Design Patterns
CIS327-Tuesday
William
March 2005
Final Paper
“Design Patterns” and the Gang of Four (GoF)
Software design patterns mirror (or mimic) the “real world” processes and methodologies. The reasons for this come not only to the fact that humans have been building computer processes along the same lines that we approach the real world. Getting to the “lower levels” when you look at what computers do for us they simply “take the same steps” that we would take to “get from point A to point B.” Much of what a computer does above this ends up being the interface to allow me (the simple human) to interact with the computer. So, there isn’t any real surprise that as we design and develop the computer systems we would follow the same methodologies that we already implement in the “real world”. Just as we moved from the “manual, single person” building of, for example, a car and moved into the implementation of an “assembly line” process to allow multiple people become involved with the process – each completing their individual section of the process to complete the building of the car.
The Gang of Four (GoF) has outlined 23 design patterns into three categories:
creational
structural
behavioral
And how these design patterns are implemented in the software (JAVA) development follows (as outlined in the JAVA PROGRAMMING I and II book):
Creational design patterns address issues related to the creation of objects (such as preventing a system from creating more than one object of a class, or deferring until execution time the decision as to what types of objects are going to be created.
Abstract Factory allows a system to determine the subclass from which to instantiate an object at run time. Abstract Factory uses an object known as a factory that uses an interface to instantiate objects.
Factory Method creates objects by allowing the system to determine which class to instantiate at run time.
Prototype design pattern allows an object – called a prototype – to return a copy of that prototype to a requesting object – called a client.
Singleton. Occasionally, a system should contain exactly one object of a class – that is, once the program instantiates that object, the program should not be allowed to create additional objects of that class. The Singleton design pattern guarantees that a system instantiates a maximum of one object of a class.
Structural design patterns describe common ways to organize classes and objects in a system.
Adapter provides an object with a new interface that adapts to another object’s interface, allowing both objects to collaborate with one another. (for example electrical socket adapters in Europe)
Bridge avoids these problems by dividing an abstraction and its implementations into separate class hierarchies.
Composite each component in a hierarchical structure implements the same interface or extends a common superclass. This polymorphism ensures that clients can traverse all elements (branch or leaf) uniformly in the structure.
Decorator allows an object to gain additional functionality dynamically. Using this pattern, designers do not have to create separate, unnecessary classes to add responsibilities to objects of a given class.
Facade allows an object – called a facade object – to provide a simple interface for the behaviors of a subsystem (an aggregate of objects that comprise collectively a major system responsibility).
Proxy. This pattern allows one object to act as a replacement for another. For example, the displaying of something while an applet loads an image to provide the user positive feedback that something is going on in the background.
Behavioral design patterns provide proven strategies to model how objects collaborate with one another in a system and offer special behaviors appropriate for a wide variety of applications
Chain of Responsibility enables a system to determine at run time the object that will handle a message. This pattern allows an object to send a message to several objects in the chain of objects.
Command. The command design pattern solves this problem (having several ways to perform a given task) by enabling developers to encapsulate the desired functionality once in a reusable object; that functionality can then be added to a menu, toolbar, popup menu or other mechanisms.
Iterator allows objects to access individual objects from any data structure without “knowing” the data structure’s behavior or how that data structure stores objects.
Memento. The memento design pattern allows an object to save its state, so that – if necessary – the object can be restored to its former state. The memento design pattern requires three types of objects (originator object – state, memento object – copy, caretaker object – references)
Observer. This pattern promotes loose coupling between a subject object and observer objects – a subject notifies the observers when the subject changes state. When notified by the subject, the observers change in response to the change in the subject.
State. This pattern covers the requirement to convey an object’s state information or represent the various states that an object can occupy.
Strategy. The Strategy design pattern is similar to the State design pattern. The Strategy design pattern contains a strategy object, which is analogous to the State pattern’s state object. The key difference between a state object and a strategy object is that the strategy object encapsulates an algorithm rather than state information.
Template Method. Where the Strategy design pattern allows several objects to contain distinct algorithms the Template Method design pattern requires all objects to share a single algorithm defined by a superclass.
There are other design patterns outlined in the GoF book which are not covered above. These include:
Builder (Creational) design pattern
Flyweight (Structural) design pattern
Interpreter (Behavioral) design pattern
Mediator (Behavioral) design pattern
Visitor (Behavioral) design pattern
There are a number of good books and sites that cover this topic. Following is a small list of some of them:
Design Patterns
by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
ISBN: 0201633612
URL: book on Amazon.com
Notes: This is “the” Gang of Four book.
Design pattern (computer science)
URL: http://en.wikipedia.org/wiki/Design_pattern_(computer_science)
Notes: This is the wikipedia web site covering computer focused design patterns. This is a very good site with multiple other references. Because it is “wikipedia” it is edited and commented on by a group of peers (which can help keep the views balanced).
Briefing on Design Patters (apparently utilized at CMSC class 433)
URL: http://www.cs.umd.edu/class/spring2001/cmsc433-0101/designPatterns.pdf
Notes: This is a PDF file that covers the pattern/methods but also includes the focus on implementation in JAVA.
Needless to say you can use the JAVA PROGRAMMING I and II book (that we utilized in the class) as a reference in the approach of applying this to JAVA programming.
William
William
March 2005
Final Paper
“Design Patterns” and the Gang of Four (GoF)
Software design patterns mirror (or mimic) the “real world” processes and methodologies. The reasons for this come not only to the fact that humans have been building computer processes along the same lines that we approach the real world. Getting to the “lower levels” when you look at what computers do for us they simply “take the same steps” that we would take to “get from point A to point B.” Much of what a computer does above this ends up being the interface to allow me (the simple human) to interact with the computer. So, there isn’t any real surprise that as we design and develop the computer systems we would follow the same methodologies that we already implement in the “real world”. Just as we moved from the “manual, single person” building of, for example, a car and moved into the implementation of an “assembly line” process to allow multiple people become involved with the process – each completing their individual section of the process to complete the building of the car.
The Gang of Four (GoF) has outlined 23 design patterns into three categories:
creational
structural
behavioral
And how these design patterns are implemented in the software (JAVA) development follows (as outlined in the JAVA PROGRAMMING I and II book):
Creational design patterns address issues related to the creation of objects (such as preventing a system from creating more than one object of a class, or deferring until execution time the decision as to what types of objects are going to be created.
Abstract Factory allows a system to determine the subclass from which to instantiate an object at run time. Abstract Factory uses an object known as a factory that uses an interface to instantiate objects.
Factory Method creates objects by allowing the system to determine which class to instantiate at run time.
Prototype design pattern allows an object – called a prototype – to return a copy of that prototype to a requesting object – called a client.
Singleton. Occasionally, a system should contain exactly one object of a class – that is, once the program instantiates that object, the program should not be allowed to create additional objects of that class. The Singleton design pattern guarantees that a system instantiates a maximum of one object of a class.
Structural design patterns describe common ways to organize classes and objects in a system.
Adapter provides an object with a new interface that adapts to another object’s interface, allowing both objects to collaborate with one another. (for example electrical socket adapters in Europe)
Bridge avoids these problems by dividing an abstraction and its implementations into separate class hierarchies.
Composite each component in a hierarchical structure implements the same interface or extends a common superclass. This polymorphism ensures that clients can traverse all elements (branch or leaf) uniformly in the structure.
Decorator allows an object to gain additional functionality dynamically. Using this pattern, designers do not have to create separate, unnecessary classes to add responsibilities to objects of a given class.
Facade allows an object – called a facade object – to provide a simple interface for the behaviors of a subsystem (an aggregate of objects that comprise collectively a major system responsibility).
Proxy. This pattern allows one object to act as a replacement for another. For example, the displaying of something while an applet loads an image to provide the user positive feedback that something is going on in the background.
Behavioral design patterns provide proven strategies to model how objects collaborate with one another in a system and offer special behaviors appropriate for a wide variety of applications
Chain of Responsibility enables a system to determine at run time the object that will handle a message. This pattern allows an object to send a message to several objects in the chain of objects.
Command. The command design pattern solves this problem (having several ways to perform a given task) by enabling developers to encapsulate the desired functionality once in a reusable object; that functionality can then be added to a menu, toolbar, popup menu or other mechanisms.
Iterator allows objects to access individual objects from any data structure without “knowing” the data structure’s behavior or how that data structure stores objects.
Memento. The memento design pattern allows an object to save its state, so that – if necessary – the object can be restored to its former state. The memento design pattern requires three types of objects (originator object – state, memento object – copy, caretaker object – references)
Observer. This pattern promotes loose coupling between a subject object and observer objects – a subject notifies the observers when the subject changes state. When notified by the subject, the observers change in response to the change in the subject.
State. This pattern covers the requirement to convey an object’s state information or represent the various states that an object can occupy.
Strategy. The Strategy design pattern is similar to the State design pattern. The Strategy design pattern contains a strategy object, which is analogous to the State pattern’s state object. The key difference between a state object and a strategy object is that the strategy object encapsulates an algorithm rather than state information.
Template Method. Where the Strategy design pattern allows several objects to contain distinct algorithms the Template Method design pattern requires all objects to share a single algorithm defined by a superclass.
There are other design patterns outlined in the GoF book which are not covered above. These include:
Builder (Creational) design pattern
Flyweight (Structural) design pattern
Interpreter (Behavioral) design pattern
Mediator (Behavioral) design pattern
Visitor (Behavioral) design pattern
There are a number of good books and sites that cover this topic. Following is a small list of some of them:
Design Patterns
by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
ISBN: 0201633612
URL: book on Amazon.com
Notes: This is “the” Gang of Four book.
Design pattern (computer science)
URL: http://en.wikipedia.org/wiki/Design_pattern_(computer_science)
Notes: This is the wikipedia web site covering computer focused design patterns. This is a very good site with multiple other references. Because it is “wikipedia” it is edited and commented on by a group of peers (which can help keep the views balanced).
Briefing on Design Patters (apparently utilized at CMSC class 433)
URL: http://www.cs.umd.edu/class/spring2001/cmsc433-0101/designPatterns.pdf
Notes: This is a PDF file that covers the pattern/methods but also includes the focus on implementation in JAVA.
Needless to say you can use the JAVA PROGRAMMING I and II book (that we utilized in the class) as a reference in the approach of applying this to JAVA programming.
William
Thursday, March 10, 2005
Utility Class Fills in Java's Missing Functionality
Anybody who regularly switches between Perl and Java can find Java lacking in elementary operations. Try out a utility that bundles all the methods and helper classes that Java is missing into one class.
I ran across this like while reviewing my bloglines and I figured that I would pass it on. I'm not sure how many other "multiple language programmers" there are in the class or who might actually read this blog, but I figured that for those that are/do then here is the link
Tuesday, March 01, 2005
Is anyone else from the class reading this or posting???
I just went through the list of blogs setup by my classmates (see list below) and for the most part I haven't seen much of any postings on them... other than the originally requested (read: required) posts. That is except for:
And the following blogs are in the basically not used list:
I didn't put my blog in this list since you are looking at it now and needless to say I have been doing some updates...
And the following blogs are in the basically not used list:
- http://cis327marvinthomas.blogspot.com/
- http://cis327saul.blogspot.com/
- http://cis327mg.blogspot.com/
- http://cis327michelle.blogspot.com/
- http://cis327jeancb.blogspot.com/
- http://dgcis327.blogspot.com/
- http://cis327brians.blogspot.com/
- http://cis327bethharris.blogspot.com/
- http://hollythomas.blogspot.com/
I didn't put my blog in this list since you are looking at it now and needless to say I have been doing some updates...
Saturday, February 26, 2005
Best Java Blogger
There is a contest for the best java blogger. No, in no way do I think I have any option on this... I'm just adding the link here so people can go and see what sites have been included in the contest.
Subscribe to:
Posts (Atom)