Right now, if you want to understand the state of the art in computer programming, those are your choices as I see them.
Sorry to be so blunt … please don’t shoot the messenger.
My awakening started when I began searching for a better Java, and found Scala. Scala had these weird (in my ignorance) functional features and learned Scala people often talked about Haskell. A uni friend Bernie Pope raved about it too.
I took a look at Haskell. It wasn’t a pleasurable experience. Much of the code was almost incomprehensible. Half the concepts I’d never heard of before. It made me feel stupid, but actually what I was was ignorant.
I say ignorant, rather than innocent, because Haskell has been around for over a decade, and FP much longer.
I still struggle to read most Haskell, and I certainly can’t use it to build anything. But I am starting to get a sense of just how sophisticated it is, and a map of it’s concepts in my mind. I began by going down a rabbit-hole, and expected to find a burrow, a community of Haskelliers programming in their own unique way. Instead, bit by bit Ive realised Ive ended up in a vast cavern absolutely full of stuff I barely even knew existed.
- Monads & friends
- Typeclasses (see “Typeclassopedia”, a must-read for advanced programmers, if only to appreciate what you don’t yet know
) - Composability (Need a good succinct web ref here, please suggest)
- Laziness
- Higher order functions
- Functional Reactive Programming
- Software Transactional memory
- Point-free style
- Zippers, Finger Trees and other Immutable Data Structures
- Real World Haskell and Hudak’s book
The bit that stirs me up is that this “stuff” isn’t, repeat is not, Haskell-specific. Its rooted in the fabric of our reality, in our mathematics and our problem domains, and bits poke up like the tips of icebergs into mainstream OO languages, their true structure part-revealed. But rarely in the OO-world have I found such carefully abstracted and subtle techniques of programming in daily use.
Ideas from Haskell & Functional Programming will continue to flow into the mainstream over the next couple of decades. Innovations will be trumpeted, trends identified, features debated, technologies evangelized.
But personally, Im too curious (and too lazy a typist) to wait that long.,
Lachlan O'Dea said,
June 2, 2009 at 2:51 pm
I had exactly the same experience when I started learning Scala (also coming from Java). To a Java programmer like myself, Haskell looks like alien technology at first. I feel like I’m learning how to program from scratch when I try to program in this way. I should point out, in case it wasn’t clear, that this is a good thing
.
I’m coming to the conclusion that functional programming is more than just a different “style” of programming. It’s not a case of “functional vs OOP, which is better?”. Functional programming is about working with the fundamental mathematical concepts that describe computation (knowledgeable functional people will probably cringe at my clumsy wording). All of the fundamental concepts like monads are present in code written in Java or C#, but they’re not explicit and you’re simply not aware of it until you learn some functional stuff. One of the results is that most Java programmers have no idea how much of their code is actually boilerplate.
BONUS said,
June 3, 2009 at 6:11 am
That’s what I really like about functional programming. We describe what stuff is in terms of other stuff instead of giving a computer some steps to carry out. The concepts aren’t langage-specific, and our logic, reality, and mathemathics kind of pop out in functional languages, allowing us to model them with programs and learn more about them. For instance, the whole overlap of functional programming and cathegory theory is a testament to that. Also zippers being derivatives of types, etc.
So yeah, it’s pretty awesome and I’ve even developed a little obsession where I spend a lot of time trying to explain to myself why I find all this so awesome.
Tommi Ripatti said,
June 5, 2009 at 7:46 pm
Welcome to FP land!
Haskell is truly awesome and when you get it, it can be a once-in-a-lifetime learning experience
The thing I most like about Haskell is the way it really cuts down code to it’s bare essentials. That is, unless you go over the board with arrows, point free style and all the other goodies Haskell programmars are spoiled with
Although I had my mandatory introduction to functional programming
concepts at Uni (in those days Scheme was still mandatory at Helsinki University of Technology), I did not really have the background or experience to see any benefits of doing things ‘the hard way’, as it then seemed.
I was very lucky to have plenty of control over my work when I was doing non-comp.sci research recently for a few years. Implementing / reimplementing a bunch of projects in Haskell was certainly among the most rewarding experiences I have ever had in computing.
Sadly some of it’s libraries are quite unstable, and many lack documentation past the mandatory typesignatures.
Getting a working set of libraries to do varied IO stuff ( databases, user interfaces, and such) can be a real pain.
Having said that, I wish I could work with Haskell – every day.
Tommi