Author | Message |
---|---|
rabbott
Posts: 1649
|
Posted 04:49 Sep 13, 2017 |
Programming is about thinking clearly and then expressing your thoughts in a programming language. The higher the level of the language the better suited it is to letting you express thoughts directly. Haskell is a pretty high level language. But it is still a programming language. Writing a Haskell program is almost never the same as expressing the idea behind the program. One of the primary reasons to purse an education is to become more skilled in thinking clearly -- and expressing your thoughts clearly. Learning functional programming can certainly help. But functional programming isn't all there is to thinking clearly. I want you all to focus on thinking clearly and learning how to express yourself clearly. As undergraduates you should have learned about the difference between declarative and procedure programming. Declarative programming, to the extent it is possible at all, is expressing directly what you want to accomplish. Procedural programming is saying, step by step, how to accomplish that objective. For example, suppose I want the next prime larger than a given integer. The following program will do it.
Notice the difference between the functions and the descriptions.
Your comments before each of your functions should say declaratively what the function returns, not how it goes about producing that result. When you explain a function f that uses some other function g, you should describe the function g declaratively. Say what g returns and how that result is useful in the context where it is called within f. You will sooner or later forget how to write Haskell code (probably sooner). I hope that you won't forget how to think and express yourselves clearly. Last edited by rabbott at
04:55 Sep 13, 2017.
|