And Design Patterns suddenly Degrade!
Lately I’ve been writing some programs with Haskell (a pure functional programming language) and I noticed that I am not using GoF design patterns anymore, and that got me to a question: What are GoF design patterns? And why do we need them?
This actually reminds me of a good definition I read (I can’t recall where) of these design patterns: Resolutions to programming language limitations implemented using the programming language available syntax. When one learns a programming language, he learns to express what he wants to express using a very limited set of expressions of the language. The problem with this is that his imagination in this environment gets boxed! So what are GoF design patterns?
Most of GoF design patterns are inspired from Smaltalk, so what is so special about Smaltalk? Closures! It turns out that Java and C++ didn’t have closures and higher order functions. Some of the Design Patterns came to rescue and provide "alternatives" to these powerful constructs or workarounds to resolve these limitations. Such an approach requires a kind of object gymnastics and results in an explosion of classes!
I am now on a project where I use C# 3.5 features, and guess what? Suddenly I use much less strategies, much less templates. I write much less code yet being as or even more flexible. Powerful lambda expressions!
Update: DSLs also come from fp paradigm!
March 21, 2008
Programming Languages: More Powerful with less Freedom?
In quest for more power, languages are often grown with new features. While it provides programmer with more freedom, does this actually achieve more power? Reg Braithwaite believes that this is not necessarily true and argues that it is possible to render language more powerful yet limiting options offered to programmers.
March 9, 2008
Obsev:: Mutability is addictive like drugs, Mutation can become a cancer!
This is really crazy!
The first time I got introduced to mutation, I had a bad feeling. How can x:=x+1 be logical at all?
It felt so unnatural, scary, or maybe like a hack. Then, because of society constrains, I got to forget the bad feeling about that. Well, my mind started to tolerate with counter-logic logic. And that is how I became an enterprise developer. I am not sure how proud I am with this title anyway. I feel that tolerating and accepting the counter-logic logic is one, and most important one, of the prerequisite to this title.
OBSEV:: Dangerous Coupling: A coupling that most people aren’t aware enough of !
Behavior coupling problem might seem obvious, and easily evitable. But not when, with a little observation, we notice that it is everywhere!
Powered by WordPress




