ob's notebook

This is my blog. It contains my ideas, insights, or other stuff of software development that I believe are worth to be written down. I hope these notes will be helpful for others as well. As software developers we discover exciting features and new possibilities of coding almost every day. And this blog aims to make the things that I have discovered open source.


True Lazy Sequences
25 Nov 2015

Lately I have read two very inspiring articles about sequences in Swift. Both articles use the sequence of Fibonacci numbers as an example of an unlimited and lazily evaluated sequence. In a lazy sequence its elements are not generated until their processing. However, there are some pitfalls that need to be avoided when working with such sequences.

Read more ...


How Many Ways To Find A Way?
04 Nov 2015

Recently I had to explain recursive functions to my students. One of the examples was the recursive formula for Binomial Coefficients which can be visualized as Pascal's triangle. Looking for a real world problem that can be solved by using Pascal's triangle I found the shortest grid path problem. Since I'm currently trying to get familiar with programming in Swift, I thought to myself, why not coding something in Swift that computes these paths?

Read more ...


Testing Of Enumerations Made Easy
31 Oct 2015

Have you ever wondered how to test enumerations with associated values easily in Swift? The point is that you can do all sorts of pattern matching with enums, but you cannot express a simple expectation in a single line. Well, with a little help from a function, you actually can.

Read more ...


Optional Chaining Oddities
24 Oct 2015

Optional chaining in Swift is a means to safely access properties of potential nil values using the ?. operator. This concept is also known in other languages, particularly in Groovy or Spring EL which provide the Ā«safe navigation operatorĀ». However, there is a subtle difference between Groovy's and Swift's implementation.

Read more ...