Declarative & Imperative code paradigms, are common buzz-words in the tech industry. In this post we’ll discuss these programming paradigms, what’s so good/bad about them and most important: a simple practical suggestion that can turn imperative code into declarative. Ready? Let’s start with the more intuitive paradigm: Imperative. Imagine you want to get from point […]| Just Another Programmer
Say you had to implement a class that takes as an argument (in the constructor) Iterator<Iterator<E>> iterator and returns an iterator that can iterate all the elements under Iterator<Iterator<E>> iterator in a round-robin manner, meaning, according to the order of the numbers in the following screenshot: I searched online and found implementations such as this, this and even Guava […]| Just Another Programmer
Over the past week I went through some Python code in Stackstorm (hosted in GitHub), and by doing so I learned a few cool new things. Maybe ‘new’ is not the right term, but these things were new to me and I wanted to share them with you. The code I am referring to resides in a […]| Just Another Programmer
The other day I ran into a question in Stackoverflow asking how to implement square-root calculation. I started googling it up and some implementations seemed to me very cumbersome but then I found Newton’s method which is pretty easy to implement. Translating it to Java was a matter of a few lines of code: class Sqrt […]| Just Another Programmer
A while back, I wrote a simple calculator in Ruby. A few minutes ago I ran into a similar question in Stackoverflow, and decided to implement the Python version: def is_number(s): try: float(s) return True except ValueError: return False def calc(expr): if is_number(expr): return float(expr) arr = expr.split('+') if len(arr) > 1: return sum(map(calc, arr)) […]| Just Another Programmer
Alfred I would recommend using Alfred, even without buying the power-pack it has very useful clipboard snippets: This way you can save commands that you’re using frequently and find them by typing “keywords” and when you press “enter” it’s paste into your clipboard/terminal. Very useful – especially when you work remotely on nodes in […]| Just Another Programmer
Last week I wrote about the code challenge foo.bar: Peculiar balance. Today I’ll tease you with another one: Rusty calculator ================ Lab minion Rusty works for Professor Boolean, a mad scientist. He’s been stuck in this dead-end job crunching numbers all day since 1969. And it’s not even the cool type of number-crunching – all […]| Just Another Programmer
In the past few months Google pulled “Matrix” on many Python and Java engineers: if you google terms like “python lambda” you might get pulled into “The Matrix” as well… To me it happened on a Saturday around midnight, I googled something related to Python and suddenly the search page collapsed and became dark. There was […]| Just Another Programmer
Last week a friend asked me to help him prepare for a job-interview at FB. The first thing I did was pointing him to Cracking the Coding Interview which provides an excellent overview of all the ma…| Just Another Programmer
There’s a term in drawing called “negative space”. The idea is very simple: you don’t draw what’s there – you draw what’s not there. Credit: NEGATIVE SPAC…| Just Another Programmer