Design
patterns capture best user practices and describe the possible solutions to a
problem in context; depicting generic example of real life scenarios. Last
night in LA .
NET
developers’ group meeting, David Wells, President OCIUG
and OCNSUG spoke about software design
patterns and their implementation in development frameworks.
This event about software reusability techniques was held in
UCLA Dodd’s hall with
Scott Robertson, President LA .NET
Developers group’s opening keynote and usual announcements. Jeffrey
Hasan announced he’ll be
delivering next months’ presentation on “Build Message-Based
Web Services for Service Oriented Applications” on 3rd May
2004.
David’s
speech was a breadth first approach to Design patterns; He began with examples
from classical texts; Addison-Wesley’s
Design Patterns which is considered a-must-read for Software design
Engineers. This book is commonly known as GOF (Gang of four) after authors
Erich
Gamma,
Richard
Helm,
Ralph
Johnson and
John
Vlissides. A detailed overview of GOF
Patterns and there frequency of usage in projects can be found
here. David’s listed patterns in the following unclassified order.
|
Software
Patterns
|
|
Design
Patterns
.
NET
patterns
Use Case Patterns
Enterprise
Patterns
Analysis Patterns
Data Model
Patterns
Business Rules
Patterns
Framework Patterns
UML & Patterns
Extreme
Programming
Test Driven
development
Object Modeling
UML
Anti-Patterns
|
One
can always disagree with this list and there could various additions for
instance I miss “Agile development” and
aspect oriented
programming.
Software
patterns, as he defined them, are classified into three major categories;
Behavioral, Creational and
Structural patterns. He later elaborated each of the types as follows.
|
Behavioral
Patterns
|
Creational
patterns
|
Structural
patterns
|
|
Chain
of responsibility
Command
Interpreter
Iterator
Mediator
Memento
Observer
State
Strategy
Template method
Visitor
|
Abstract
factory
Builder
Factory method
Prototype
Singleton
|
Adapter
Bridge
Composite
Decorator
Facade
Flyweight
Proxy
|
David’s
presentation can be
downloaded from OCIUG website as he
promised to upload the latest version soon;
Observer and
Singleton Presentation
& code samples are already uploaded. For Singleton Design Pattern,
Exploring the Singleton Design Pattern by Mark Townsend of Microsoft
Corporation is a good reading. (David Wells used the illustration in this
article during the presentation). Observer is implemented in both major
development frameworks in the form of delegates and call back features;
System.IO.FileSystemWatcher is a good example of Observer Pattern. It
is mostly low-level implementation (multithreaded event handler attachment),
and appears in its entirety as part of other important patterns (e.g.
ModelViewController).
Couple
of things which he emphasized on during the talk, and I remembered, other than
classical Singleton and Factory patterns were Refactoring and XP. Refactoring
is code oriented optimization approach defined
as “is a disciplined technique for
restructuring an existing body of code, altering its internal structure without
changing its external behavior.” In simple words its better &
optimized code. There is a collection of
tools available for different IDE’s and platforms on Martin Fowler’s
Refactoring.com; (also includes my favorite
C# refactory listed).
Refactoring in Whidbey by Scott Water,
Refactoring in VS.NET Whidbey hands on labs PDC
Visual C# "Whidbey": IDE Enhancements For C# Devlopers
are good articles to read for those interested in up coming IDE’s
support for Refactoring.
Extreme
Programming is the approach to create better, deliberate and
disciplined software projects; most suitable for dynamic and altering
requirement projects (Iterative Model of Software Engineering), XP revolves
around planning, coding, designing and testing phases which are defined
here in greater detail as
XP rules.
Later
during discussion data access patterns, business object patterns, use case
patterns, .
NET
patterns, CRC
(Class,
Responsibilities, and Collaborators) cards were being
explained. Anti Patterns
are bad approaches combined together for developers to beware of potential
development pitfalls; David stated what’s mentioned on
Anti-Patterns Home “A survey of hundreds of corporate
software development projects indicated that five out of six software projects
are considered unsuccessful. About a third of software projects are canceled.
The remaining projects delivered software that was typically twice the expected
budget and took twice as long to developed as originally planned [Johnson 95].”
Some of the anti-patterns are
Blob, Lava flow,
Spaghetti code etc.
I
found another good definition of Anti-Patterns
here.
“An
AntiPattern is a pattern that tells how to go from a problem
to a bad solution. (Contrast to an
AmeliorationPattern,
which is a pattern that tells how to go from a bad solution to a good
solution.)”
The
presentation ended with a raffle and I won a cool LA .
NET
developers group coffee mug :D
Recommended
Readings