Sadek Drobi’s Blog

April 20, 2008

And Design Patterns suddenly Degrade!

Filed under: Architecture, C#, DSL, Functional Programming, Haskell, LinQ — Sadache @ 9:25 pm

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!

April 11, 2008

Try to get the best of your Statically Typed Language

Filed under: Architecture — Sadache @ 6:55 pm

The use of dynamic type-checking in static languages is often perceived as unavoidable on complex projects, even though workarounds necessary to enforce it tend to negatively impact the quality of code. According to Debasish Ghosh, new features in static languages, i.e. Java generics, offer an opportunity to avoid runtime type checking and optimize the advantages of static typing.

(more…)

April 2, 2008

Are Custom Chips An Answer to the Multicore Crisis?

Filed under: Uncategorized — Sadache @ 11:00 pm

Adapting to multicore paradigm is one of the emerging challenges in the software industry. What if the solution lays at the hardware level?  Bob Warfield suggests that creation of chips optimized for running specific virtual machines could reduce the gap between the potential performance of processors and the actual capacity of software to take advantage from it.

(more…)

Powered by WordPress