Sadek Drobi’s Blog

December 7, 2009

My Computation Abstraction Talk Slides for Functional Exchange

Computation Abstraction: Going beyond programming language control syntax, or what we’ve missed from FP for so long in mainstream

For a long time, and due to the lack of main FP concepts in most mainstream languages, we missed opportunities to abstraction and code expressiveness and conciseness. With today’s democratization of FP, Computational Abstraction is what will enable us to be less dependent on specific programming language syntax offering; creating libraries of control structures and composition forms that help find concise and expresive solutions to enterprise programming challenges (null, lists treatment, error handling), capturing elegantly important business concepts in code, and programming at the right level of abstraction.For a long time, and due to the lack of main FP concepts in most mainstream languages, we missed opportunities to abstraction and code expressiveness and conciseness. With today’s democratization of FP, Computational Abstraction is what will enable us to be less dependent on specific programming language syntax offering; creating libraries of control structures and composition forms that help find concise and expresive solutions to enterprise programming challenges (null, lists treatment, error handling), capturing elegantly important business concepts in code, and programming at the right level of abstraction.

Slides:  http://sadekdrobi.com/wp-content/uploads/2009/12/Computation-Abstraction666iiioii6jjjjjjhjj-5.pdf

Google wave:  https://wave.google.com/wave/#restored:wave:googlewave.com!w%252BPgcakhgiA

November 6, 2009

Side Effects

Most of my Erlang programming is side effect free. I think I probably write very unusual Erlang programs that look a lot like Haskell ones. Now and then, I do write side effecting code. For example, when I use the random number generation libraries that comes with Erlang, it has a side effecting interface. It’s very tempting when you are building something on top of the library with a stateful interface to build code on top of that that also has a stateful interface.

That’s what I did the first time I tried to use it. That has caused me so much trouble. I think every single bug that I spent hours trying to track down has been caused by a side effect. In a way, I’ve been programming Haskell for so many years, that I’d forgotten just how devastating side effects are and just how difficult they make debugging. I’ve learnt that lesson again and nowadays, if I want to use a stateful library, I usually build a side effect free interface on top of it, so that I can then use it safely in the rest of my code.

from my interview with John Hughes at Erlang Factory

June 26, 2009

A monad in C# for simplifying WPF multi-threading for a more responsive GUI

Code included here is over simplified for clarity, I hosted a better implementation code on CodePlex. These modifications change strictly nothing for the client code and are only an implementation detail. I use a continuation rather than a delay, and I chose to design a custom continuation class rather than using a delegate because of a type system limitations.

DSC_2468Most GUI frameworks, including Silverlight and WPF, are shipped with a fundamental problem: long use of the main thread causes the Window to blackout, and using different threads requires you to get your hands dirty with the Dispatcher stuff and freezable objects. Worse, you wont learn the necessity to do so until you get a surprise of “The calling thread cannot access this object because a different thread owns it.” exception when all what you were doing is to use available methods on an object that seemed you have access to, at lease it seemed until runtime! This post illustrates a solution based on Monads abstraction and LinQ syntax.
(more…)

May 8, 2009

Paul Hudak on Haskell

Filed under: Functional Programming, Haskell, InfoQ — Sadache @ 2:52 pm

An interview I did with Paul Hudak that begins with a discussion of when to introduce difficult Haskell concepts like monads, moves to a discussion of the philosophy of higher order programming, the success and influence of Haskell, its use in the mainstream, and concludes with the idea of teaching computer music and Haskell simultaneously.

 

http://www.infoq.com/interviews/paul-hudak-haskell-Qcon-SF-08&language=en

May 4, 2009

Yet another million dollar mistake?

Filed under: Architecture, C#, Functional Programming, JVM, Java, Scala — Sadache @ 11:53 pm

Martin Odersky:

In the generics design, there were a lot of very, very hard constraints. The strongest constraint, the most difficult to cope with, was that it had to be fully backwards compatible with ungenerified Java. The story was the collections library had just shipped with 1.2, and Sun was not prepared to ship a completely new collections library just because generics came about. So instead it had to just work completely transparently.

That’s why there were a number of fairly ugly things. You always had to have ungenerified types with generified types, the so called raw types. Also you couldn’t change what arrays were doing so you had unchecked warnings. Most importantly you couldn’t do a lot of the things you wanted to do with arrays, like generate an array with a type parameter T, an array of something where you didn’t know the type. [..]

When Java first shipped, Bill Joy and James Gosling and the other members of the Java team thought that Java should have generics, only they didn’t have the time to do a good job designing it in. So because there would be no generics in Java, at least initially, they felt that arrays had to be covariant. That means an array of String is a subtype of array of Object, for example. The reason for that was they wanted to be able to write, say, a “generic” sort method that took an array of Object and a comparator and that would sort this array of Object. And then let you pass an array of String to it. It turns out that this thing is type unsound in general. That’s why you can get an array store exception in Java. And it actually also turns out that this very same thing blocks a decent implementation of generics for arrays. That’s why arrays in Java generics don’t work at all. You can’t have an array of list of string, it’s impossible. You’re forced to do the ugly raw type, just an array of list, forever. So it was sort of like an original sin. They did something very quickly and thought it was a quick hack. But it actually ruined every design decision later on.

March 29, 2009

Imperative Programming vs. Functional Programming

Filed under: Conferences, Functional Programming, Mutability, QCon — Sadache @ 11:18 pm

image 

From my QCon09 London presentation slides.

Abstraction for People: Configurations, Patterns, DSLs and Monads

DSC_2692a3

LinQ is often understood in terms of introducing a Domain Specific Language to work with data to C# and .Net in general. The fact is:it is not, and there is a considerable difference between LinQ syntax nature and a DSL. The problem is that DSL definition is blur enough to take anything interesting or cool under it!

(more…)

Interview: Don Syme Answering Questions on F#, C#, Haskell and Scala

Filed under: C#, F#, Functional Programming, Haskell, InfoQ, LinQ, Polyglot Programming — Sadache @ 9:14 pm

A great discussion I had with Don Syme at QCon SF. Don is one of the heroes to thank for .Net generics and he is a major contributor to F# design, Thanks Don!

http://www.infoq.com/interviews/F-Sharp-Don-Syme

March 5, 2009

Erik Mejier: LinQ, Beyond List Comprehensions in C# and .Net

Filed under: DOTNET, DSL, Functional Programming, Haskell, InfoQ, LinQ — Sadache @ 9:55 pm

Erik Meijer talks about less known LINQ features, like meta programming, about the differences between functional languages and OO ones, asynchronous computation, and others.

(more…)

February 18, 2009

I am speaking at QCon

download (1)

 

(more…)

Older Posts »

Powered by WordPress