Tuesday, 22 July 2014

Venn Diagrams

At work I seem to be the authority on the presence (or absence) of a colleague of mine who is much requested within the company for his domain model knowledge. Let's call him Hans, for that is his name.

The reason I am an authority is because I always walk with him from the train station to work.

A fact is that we both have long hair.

Hence a colleague of mine assumed that Long hair is a requirement for people who work here and go by train.

Venn Diagrams

So we have the following sets:
  • people who go by train
  • people who have long hair
  • people who work at my company

Problems

As I pointed out, the people my colleague, Bart, knows who work at my company and travel by train, also happen to have long hair. But the people my colleague knows is just a subset of people at my company. So let's add the set "people who Bart knows". So we have the following sets:

  • people who go by train
  • people who have long hair
  • people who work at my company
  • people who Bart knows

Now, we run into a little problem with Venn diagrams. As always, Wikipedia[1] to the rescue.

It's not possible to show all possibilities using regular circles, when the sets increase to more than three. In our case, for four possibilities, we can use ellipses.

Euler Diagrams[2]

Venn Diagrams are a Subset of Euler Diagrams, because Euler Diagrams are a bit more flexible when it comes to showing only some instead of all possible intersections.

The relationship between Venn and Euler diagrams can be displayed as an Euler Diagram.

I'm going to stop now, before I break my brain on the recursion.

References

[1] Wikipedia - Venn Diagram
http://en.wikipedia.org/wiki/Venn_diagram
[2] Wikipedia - Euler Diagram
http://en.wikipedia.org/wiki/Euler_diagram

Saturday, 19 July 2014

Successfully completed Functional Programming Principles in Scala

I earned 97.7% with distinction.

Evaluation

One can tell that the subject matter was Academic, with a firm grounding in Mathematics, which appealed to me.

The assignments provided a lot of information on what is expected, so there are no surprises, but you do need to read carefully.

The one assigment that provided the most difficulty was assignment 6, regarding the discovery of Anagrams of a sentence.

I had to wrestle a bit with the Scala syntax. It's new for me.

I especially found foldLeft and foldRight counter-intuitive sometimes.

I learned a lot on the following topics, in no specific ordering.
Scala Programming Language
by the creator, Martin Odersky, himself.
Functional Programming
one of the main subjects of the course
Domain Specific Language
Scala provides several ways to program according to a domain model2, instead of a technical/software model
Mathematics - Set Theory
the code is very close to the mathematical theory. Purposefully crafted that way, of course. It means we can actually use mathematical operators (some of the time).
Behaviour Driven Development
you can write tests that read more naturally
Test Driven Development
assignments had to pass certain tests (that are unknown), so your own tests had better be complete/sufficient
Recursion
we used a lot of recursion, you do not see that in "normal" programming languages.
It was a huge amount of fun to do, both to learn a new Programming Language1 and to learn a new Programming Paradigm.

References

[1] Coursera - Functional Programming Principles in Scala, by Martin Odersky
https://class.coursera.org/progfun-004
[2] Wikipedia - Domain Model
http://en.wikipedia.org/wiki/Domain_model