“What if I had” vs “As I have” – “observables” on data streams before the kid falls asleep

It has just struck me when I was putting my 2-year kid to bed…

My professional career as a software developer was mainly zoomed in on what I’ve already had here and now with little to no use cases where I’d have had to compose computations that’d be realised at a moment in the future when I’d have what I wish I had. It was back then when I was a mere Java software developer (and thought that the only right programming approach/paradigm is imperative, object-oriented one).

These times went by and am now more often exposed to a variety of problems that are considered the domain of functional languages like Scala, Clojure or F#. The concepts of the languages are often in opposition to what I already learnt and are causing severe mental pains that only the moments of putting my kid to bed can offer relief to.

I know what I can do in my program here and now, but had no idea what I’m gonna do when an event occurs or when a thing gets available in the future, say a task completes.

In other words, I can easily develop an application that would process a sequence of elements, but am short of experience with use cases where I’ve got an infinite stream of elements that I may or may not want to process at some point in time not necessarily at the exact line the expression is defined. I got used to the procedural/imperative thinking a lot. It became me.

It doesn’t then help me much when I face use cases with streams where you compose functions lazily and only when you call a function that does the processing they all get called and have their effect on the stream. I tend to consider streams (= infinite and lazy sequences) eager ones. I tend to consider problems as working with bits already in my memory space.

The idea behind composing computations lazily and be able to apply them to infinite and lazy data streams is to think what you’d do with them once the right moment occurs that is quite often not the moment they’re composed together. I need to wait and observe, and that’s something I haven’t mastered yet. Time to change it (as the moment to make resolutions is approaching fast – a mere couple of days away – it however is one already).

Funny enough, it appears that the blog post may’ve been an example of an infinite stream of loosely coupled thoughts that have been passing through my head while putting my kid to sleep. One of the very few moments where I can tune in to a steady continuous sound of his breath and…think harder. Thanks, kid!

Be Sociable, Share!
This entry was posted in Languages.

Leave a Reply

%d bloggers like this: