Hari's Corner
Humour, comics, tech, law, software, reviews, essays, articles and HOWTOs intermingled with random philosophy now and thenFive tips about Functional Programming for a Haskell newbie from a Haskell newbie
		Filed under:
		Tutorials and HOWTOs by
		Hari
			
		Posted on Mon, Nov 7, 2011 at 15:43 IST		(last updated: Mon, Nov 7, 2011 @ 16:15 IST)
				
| In this series | < Previous | Next > | 
 My order of practicing writing your own programs would be something like this (of course, feel free to disagree with this list):
My order of practicing writing your own programs would be something like this (of course, feel free to disagree with this list):
- Simple calculator that takes two values and performs an action based on user input. Areas of a triangle, area of parallelogram etc.
- Fibonacci series, and other basic recursive patterns.
- A Caesar-cipher encryption function.
- A program that reads a string of characters and identifies it as either an integer, a floating point number or a word.
- A program that reads an integer number and outputs its English equivalent. E.g. 1200 : one thousand two hundred. (this could be where it gets harder though)
- A postfix (or reverse polish) expression evaluator.
 Thinking before a single line of code is the right approach
In Haskell circles, it is a common saying that you would spend more time thinking about the problem than implementing it. This is not strictly true, particularly for a newbie, but it has merit which you will appreciate as you progress. In the functional programming paradigm, solutions are worked out in a methodical and mathematical fashion and thinking ahead is often a big part of it.
Finally don't pressurize yourself to learn quickly
One mistake is trying to swallow too many concepts at once. It doesn't work like that. Everything takes time to sink in, because it's all so new and different. Learning yet another procedural/OOP programming language is easy if you already have some background in procedural/OOP programming, because the concepts are familiar. Not so with FP.
Haskell seems to have a reputation for being hard and academically oriented, even in Functional Programming circles. And actually reinforcing that idea can lead to mental blocks in a newbie. Learning it with an open mind can work wonders. Allow the learning to happen at its own pace and enjoy the process. Thinking of "how I will ever be productive in Haskell" is counter-productive. Rather learn for the sake of learning and feel good about the knowledge you already possess.
Hope this helps. As always I welcome feedback and tips from the Haskell community.
Thinking before a single line of code is the right approach
In Haskell circles, it is a common saying that you would spend more time thinking about the problem than implementing it. This is not strictly true, particularly for a newbie, but it has merit which you will appreciate as you progress. In the functional programming paradigm, solutions are worked out in a methodical and mathematical fashion and thinking ahead is often a big part of it.
Finally don't pressurize yourself to learn quickly
One mistake is trying to swallow too many concepts at once. It doesn't work like that. Everything takes time to sink in, because it's all so new and different. Learning yet another procedural/OOP programming language is easy if you already have some background in procedural/OOP programming, because the concepts are familiar. Not so with FP.
Haskell seems to have a reputation for being hard and academically oriented, even in Functional Programming circles. And actually reinforcing that idea can lead to mental blocks in a newbie. Learning it with an open mind can work wonders. Allow the learning to happen at its own pace and enjoy the process. Thinking of "how I will ever be productive in Haskell" is counter-productive. Rather learn for the sake of learning and feel good about the knowledge you already possess.
Hope this helps. As always I welcome feedback and tips from the Haskell community.		
						In this series
- Musings on Functional Programming and Haskell
- Tic Tac Toe (a.k.a Noughts and Crosses) in Haskell
- Five tips about Functional Programming for a Haskell newbie from a Haskell newbie
- My Haskell article was linked at reddit
- Why learning Functional Programming and Haskell in particular can be hard
- Something about Haskell I wanted to share
- So on to learning Haskell
Comments closed
The blog owner has closed further commenting on this entry.
2 comment(s)
Secondly, in relation to what you say about learning slowly, I would like to reiterate the comment on your last post: I think Scheme is a better starting point for learning functional programming. Haskell is two things: it is purely functional, but it is also strongly typed and you have to learn both of them at the same time and that can be daunting. Undoubtedly the combination of pure functions and algebraic data types is very powerful, but it can also be difficult to understand in its entirety.
Comment by Shrutarshi Basu (visitor) on Tue, Nov 8, 2011 @ 00:15 IST #
Comment by Hari (blog owner) on Tue, Nov 8, 2011 @ 07:29 IST #