simple-learning

Simple learning web program
git clone git://git.laack.co/simple-learning.git
Log | Files | Refs | README | LICENSE

1.0_better_programming_through_ocaml.sl (2490B)


      1 # Better Programming Through OCaml
      2 
      3 Do you already know how to program in a mainstream language like Python or Java? Good. This book is for you. It's time to learn how to program better. It's time to learn a functional language, OCaml.
      4 
      5 =>e https://www.youtube.com/embed/MUcka_SvhLw
      6 
      7 Functional programming provides a different perspective on programming than what you have experienced so far. Adapting to that perspective requires letting go of old ideas: assignment statements, loops, classes and objects, among others. That won't be easy.
      8 
      9 I believe that learning OCaml will make you a better programmer. Here's why:
     10 
     11 - You will experience the freedom of immutability, in which the values of so-called "variables" cannot change. Goodbye, debugging.
     12 - You will improve at abstraction, which is the practice of avoiding repetition by factoring out commonality. Goodbye, bloated code.
     13 - You will be exposed to a type system that you will at first hate because it rejects programs you think are correct. But you will come to love it, because you will humbly realize it was right and your programs were wrong. Goodbye, failing tests.
     14 - You will be exposed to some of the theory and implementation of programming languages, helping you to understand the foundations of what you are saying to the computer when you write code. Goodbye, mysterious and magic incantations.
     15 
     16 All of those ideas can be learned in other contexts and languages. But OCaml provides an incredible opportunity to bundle them all together. OCaml will change the way you think about programming.
     17 
     18 > A language that doesn't affect the way you think about programming is not worth knowing.
     19 
     20 -- Alan J. Perlis (1922-1990), first recipient of the Turing Award
     21 
     22 Moreover, OCaml is beautiful. OCaml is elegant, simple, and graceful. Aesthetics do matter. Code isn't written just to be executed by machines. It's also written to communicate to humans. Elegant code is easier to read and maintain. It isn't necessarily easier to write.
     23 
     24 The OCaml code you write can be stylish and tasteful. At first, this might not be apparent. You are learning a new language after all -- you wouldn't expect to appreciate Sanskrit poetry on day 1 of Introductory Sanskrit. In fact, you'll likely feel frustrated for a while as you struggle to express yourself in a new language. So give it some time. After you've mastered OCaml, you might be surprised at how ugly those other languages you already know end up feeling when you return to them.