[Haskell-cafe] Object Oriented programming for Functional Programmers

Heinrich Apfelmus apfelmus at quantentunnel.de
Mon Dec 31 11:11:33 CET 2012


Daniel Díaz Casanueva wrote:
> Hello, Haskell Cafe folks.
> 
> My programming life (which has started about 3-4 years ago) has always been
> in the functional paradigm. Eventually, I had to program in Pascal and
> Prolog for my University (where I learned Haskell). I also did some PHP,
> SQL and HTML while building some web sites, languages that I taught to
> myself. I have never had any contact with JavaScript though.
> 
> But all these languages were in my life as secondary languages, being
> Haskell my predominant preference. Haskell was the first programming
> language I learned, and subsequent languages never seemed so natural and
> worthwhile to me. In fact, every time I had to use another language, I
> created a combinator library in Haskell to write it (this was the reason
> that brought me to start with the HaTeX library). Of course, this practice
> wasn't always the best approach.
> 
> But, why I am writing this to you, haskellers?
> 
> Well, my curiosity is bringing me to learn a new general purpose
> programming language. Haskellers are frequently comparing Object-Oriented
> languages with Haskell itself, but I have never programmed in any
> OO-language! (perhaps this is an uncommon case) I thought it could be good
> to me (as a programmer) to learn C/C++. Many interesting courses (most of
> them) use these languages and I feel like limited for being a Haskell
> programmer. It looks like I have to learn imperative programming (with side
> effects all over around) in some point of my programming life.
> 
> So my questions for you all are:
> 
> * Is it really worthwhile for me to learn OO-programming?
> 
> * If so, where should I start? There are plenty of "functional programming
> for OO programmers" but I have never seen "OO programming for functional
> programmers".
> 
> * Is it true that learning other programming languages leads to a better
> use of your favorite programming language?
> 
> * Will I learn new programming strategies that I can use back in the
> Haskell world?

Personally, I don't think that learning an imperative OO language will 
"expand your mind" in a way that Haskell does. I have started with 
Pascal and later C, but once I learned about Haskell, I switched to it 
immediately for virtually all my programming tasks and never looked back.

The only thing that OO languages are good for are "legacy" systems, 
where no Haskell compiler is readily available. If you have a concrete 
project in mind, like an Android or iPhone app, or a client-heavy web 
application, it is certainly worthwhile to learn the relevant language 
(Java, Objective-C, JavaScript) in order to make your ideas a reality. 
But other than that, you already know Pascal and programming in these 
languages is not very different.


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com




More information about the Haskell-Cafe mailing list