First off, I find it interesting that the
article quickly states that many software design patterns are object-oriented
(and therefore involve explicit state), and are not very applicable to function
programming paradigms. I'd like to read more about the design paradigms
that functional languages are used with. It seems like object-oriented
design is sort of at the heart of many (or most) of the design patterns listed
in this article.
I think the fact that design patterns are not
directly implementable (i.e. are not software specs) is both a great strength
and a weakness. This trait means they are flexible and more abstract than
actual software specs or prototype programs, but there may be some ambiguity in
making an implementation of some patterns. The implementations may vary
across languages and platforms to a degree that it can be brought into question
if they still reflect the design they were trying to adhere to. But after
all, I guess that previous statement is a general one about the common gap that
exists between software design and implementation.
Some interesting design patterns:
Bridge: "decouple an
abstraction from its implementation allowing the two to vary
independently". To me, this sounds
like a description of technologies like the Java Virtual Machine (JVM).
Iterator: "Provide a way
to access the elements of an aggregate object sequentially without exposing its
underlying representation". I love
design patterns like this one. When well-made,
iterators are a nice abstraction that allows you to loop through a set or list
without thinking about where things are or how they are stored.
Lazy initialization: "Tactic
of delaying the creation of an object, the calculation of a value, or some
other expensive process until the first time it is needed..." I think most of the students in this class
will think of Haskell when they hear this, except in that language it's called
"lazy evaluation". Though I
think it's mostly an efficiency thing, lazy initialization is also cool because
it allows for some flexible data structures (such as 'infinite' lists in
Haskell).
Proxy: "Provide
a surrogate or placeholder for another object to control access to
it". I think this is a very common
design pattern. For instance, some large
software systems have a kind of 'manager' module through which all reads and
writes to a database must be handled.
Lock
(parallelism): "One thread puts a 'lock' on a resource,
preventing other threads from accessing or modifying it". This functionality is often critical in
multi-threaded applications to prevent screwy behavior. The MPI library for C++ and Fortran offers
many ways to 'lock' a resource for a thread.
No comments:
Post a Comment