• Painting with a broomstick

    I have worked on several Java projects, both small and quite large ones. In all of them, one thing was common: secretly but clearly, we are procedural programmers.

  • Be the colleague you would like to have

    We easily recall those remarkable colleagues we admire. The challenge, though, is to follow their example.

  • Small is Beautiful

    Does size matter? It does and the conclusion is pretty clear: smaller is better. Small is beautiful.

  • This Is Not Object Oriented

    Look deeply into the principles of Object-Oriented programming. Then look into the code we are developing tagged as being Object-Oriented. Is it really Object-Oriented?

  • Meaningful Null and Other Principles

    The discussion around using Null is a long one. I wrote before about “Why Optional is better than Null”, but there is more to discuss regarding using Null as a way of expressing meaning.

  • The Craft of Typography

    Almost as much as I love the craft of programming, I love the craft of typography. Pretty much since I remember of starting using computers I cared about the fonts and had an interest in tweaking the styling settings to make it read and look nicer.

  • Encapsulating Try-Catch Statements

    One of the things I enjoy the most in programming is to identify patterns, understand in a high-level what is being done or what is intended, and to abstract that into a contained solution.

  • The Creative Power of Constraints

    This idea that constraints are something heavy and unwanted, an enemy for the creative, is just not true. Constraints have an enormous creativity power.

  • The Joy of Pattern Matching

    Pattern Matching is a beautiful way to specify the different behaviours a function has depending on its arguments.

  • Invest in Yourself For Great Good

    The responsibility for your education is not of your employer. In a pragmatic perspective, you are a product that your employer is investing in, looking for a profit.

  • One Year Remotely

    In the blink of an eye, one year working remotely has passed.

  • The Monad Pattern

    Monads were not the easiest concept for me to fully understand. There are endless QAs and tutorials about Monads and each one adds something more. And then I released that Monad is actually a design pattern and it all made sense.

  • Love the Lambda

    One of the main words to retain about lambda expressions is anonymous. A lambda expression is, basically, an anonymous function. Lambdas Expressions are a normal feature in functional languages but just few time ago arrived into the Java world. Better late than never though!

  • A Taste of Curry - An Apologetic

    What if your functions would only, actually, take a single argument? Currying is a very nice feature that Haskell offers that allows cleaner code to be written and leverages composition.

  • What Referential Transparency means

    When I think of referential transparency, I think that one reference to something is transparent, this is, there are no hidden parts involved.

  • Why Optional is better than Null

    null returning and checking is everywhere and it developed deep roots in the imperative programming world. It’s more than time to stop using it and to look into better ways to deal with fallible computation.

  • Dijkstra's letter to the council

    A while ago, when I started to learn Haskell more seriously, I found this beautiful piece of history. 15 years ago Dijkstra saw the Budget Council of his University giving steps to replace the CS introductory language Haskell by Java.

  • Don't try too much

    “To try” is an often used expression in the most different contexts. In some, it might make sense and have a useful presence but in other, it might be a dangerous tool.

  • But it works!

    “But it works!” is a small big excuse to avoid excellence and to show our attitude towards code: either we just don’t think it deserves all that much care or we think of if as a mystery box - so lucky we are that it is working!

  • Mini polyglot grep

    I wanted to write a little grep program that prints the lines of a given file that contain a given term.
    I choose to write it in Haskell, Ruby, Java, Scala and Python and see how different the thinking process and the result would be.

  • Comments

    When programming we are using some programming language to describe a solution for a problem, to define behaviour or the flow of a computation. And we do it using a language that is not human, and it’s not our mother language, therefore we inevitably feel the need to leave comments and make it as readable as possible. By other words, most of the times we comment to balance the unreadability of our code.

  • Languages

    To some people programming languages are no more than mere tools. We can say the same about Mathematics but we would be missing a lot.

  • Decorator Pattern

    This pattern is really a good choice to extend behavior without the drawbacks of inheritance. The example given in the Heads First Design Patterns is of a Coffee Shop, on how to design a flexible beverage selling system.

  • BDD vs TDD

    The difference between BDD and TDD is that BDD begins with a B and TDD begins with a T. But seriously, the gotcha with TDD is that too many developers focused on the “How” when writing their unit tests, so they ended up with very brittle tests that did nothing more than confirm that the system does what it does.
    BDD provides a new vocabulary and thus focus for writing a unit test. Basically it is a feature driven approach to TDD.

  • The Command Pattern

    I’ve used this pattern in a iOS project where a web page was to be loaded and the native app should handle javascript events. I encapsulated the “web page” into an EmbeddedWebApp object where the javascript<>native bridge was set. I had a factory class (client) where were defined the handled events/commands and their action upon the native side of the app. One of the events (command) was to request a camera capture, that needed to delegate the request to another object (receiver). Note the Single Responsibility principle and how important it is.

  • Code at Wrong Level of Abstraction

    Let’s abstract this class, let’s play with generics, inherithance, abstract classes and interfaces and make this code reusable in some other context or problem. Oh but wait… this is not quite well placed. Ok, let’s make an exception here or instead add an attribute to configure the behaviour of this particular case. Tadam, it works!

  • The Zone and interruptions

    Sometimes we get to feel this desperate need of getting into the zone. We know how of a geniuses we are and we are fully conscious that if we are let in our own world and dive in to the zone, oh boy, it will be incredible! Well… most of times it’s not true. I’m not confusing the preference for (enough) silence, a quite office and relaxed enviromnet with this need of getting into the zone. The zone most of the times leads us to go off-scope, to write more and think less and to be more an individual than a teammate.

  • Behaviour vs Data

    David West wrote Object Thinking where the main stressed point is that objects must be designed in terms of behaviour and not data.

  • Microservices

    Martin Fowler published this useful and interesting guide on microservices: Microservices Guide

  • Object Thinking – Behaviour vs Procedures

    Consider that we need to work with a list of numbers and find the need to encapsulate some methods to help us out.

  • Object Thinking – A Ball and A Dog

    A Ball and A Dog In true object-oriented programming, objects are living creatures, like you and me. They are living organisms, with their own behavior, properties and a life cycle.

  • Special Case Pattern

    Can we make the code that simple? It turns out that we can. We can change the ExpenseReportDAO so that it always returns a MealExpense object. If there are no meal expenses, it returns a MealExpense object that returns the per diem as its total: