Seven Languages in Seven Weeks

Seven Languages in Seven Weeks - A Pragmatic Guide to Learning Programming Languages by Bruce A. Tate, aims to provide the reader an introduction to seven programming languages.

7languages.JPG

They are:

  1. Ruby
  2. Io
  3. Prolog
  4. Scala
  5. Erlang
  6. Clojure, and
  7. Haskell

I’ve skimmed through the book and found that the exercises are relatively easy, especially for someone like me who is not a programmer, just someone curious about programming languages. I am interested in the linguistic aspects of programming languages, how the languages express the problem to solve, their syntaxes, and semantics. Seven Languages in Seven Weeks gives you insight into how these different languages express themselves.

My programming experience encompasses procedural or imperative programming and some object-oriented programming. Procedural programming consists of steps that define how to solve the problem. It is a set of instructions.

Object-oriented programming, according to Wikipedia, is:

a programming paradigm based on the concept of “objects”, which may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods.

Ruby, Scala, and many other languages are object-oriented.

Logic programming represents the problem using logic statements. An example from Wikipedia illustrates this.

Consider, for example, the following clause:

fallible(X) :- human(X).

based on an example used by Terry Winograd [1] to illustrate the programming language Planner.

As a clause in a logic program, it can be used both as a procedure to test whether X is fallible by testing whether X is human, and as a procedure to find an X that is fallible by finding an X that is human. Even facts have a procedural interpretation. For example, the clause:

human(socrates).

can be used both as a procedure to show that socrates is human, and as a procedure to find an X that is human by “assigning” socrates to X.

Prolog uses the logic programming paradigm.

Functional programming describes a problem and its solution by defining functions. Here is a Python example from Wikipedia.

def fibonacci(n, first=0, second=1):

while n != 0:

      print(first, end="\n") # side-effect

      n, first, second = n - 1, second, first + second # assignment

fibonacci(10)

Our program sample begins by defining a function called fibonacci. The function is called passing the parameter 10. Scala, Erlang, Clojure, and Haskell are languages that use the functional model.

Io uses a prototype-based programming style. To understand what this means, let’s look at an analogy from Wikipedia.

A fruit bowl serves as one example. A “fruit” object would represent the properties and functionality of fruit in general. A “banana” object would be cloned from the “fruit” object, and would also be extended to include general properties specific to bananas. Each individual “banana” object would be cloned from the generic “banana” object.

The fruit object provides a general description of fruits. The banana object inherits its initial definition from the fruits object but changes where necessary to distinguish a banana from a fruit.

Each programming model has its benefits. I don’t see technology as an either/or world. It is not a matter of one model being better than another. Different models work well for different types of problems. Different models also provide new ways to think about programming and advances in computer science.

Bruce Tate has a new book, Seven More Languages in Seven Weeks: Languages That Are Shaping the Future that explores Lua, Factor, Elixir, Elm, Julia, MiniKanren, and Idris. I look forward to reading that book once I complete the original Seven Languages book.

7morelanguages.JPG

 
0
Kudos
 
0
Kudos

Now read this

Learning the hard way

I’m beginning my journey to learn the art of programming with Learn Python the Hard Way and Learn Ruby the Hard Way. I have some experience with these languages from playing around with them, thinking about an idea and then creating it... Continue →