Posts

  • Supervision and Monitoring in Akka

    The reactive manifesto, the guideline for all reactive systems, states that a distributed application should be resilient. To achieve resiliency, we must develop systems that treat failure as a first-class citizen in the architecture. The Akka library, through the mechanism of supervision, provides the primitives to implement resilient systems. In this tutorial, we’re going to show how to use Akka and supervision to improve the resiliency of distributed systems. [continue...]
  • Akka Interaction Patterns: Request-Response

    After having introduced the Tell Pattern, it’s time to make an overview of some interaction that is more frequent in real-world scenarios: the request-response pattern. [continue...]
  • Akka Interaction Patterns: The Tell Pattern

    After the introduction to the library Akka Typed, it’s time to go deeper and describe one of the main interaction patterns between actors: the Tell Pattern, also known as fire and forget. [continue...]
  • The Cake Pattern

    In our tutorial on Scala’s Self-Type Annotation, we saw how to use self-type annotations to declare dependencies among types. Now, it’s time to go further. Let’s talk about the Cake Pattern, an idiomatic implementation of the Dependency Injection pattern in Scala. [continue...]
  • Self-Type Annotation in Scala

    The Scala programming language has many ways to handle dependencies among types. The so-called “self-type” annotation allows us to declare dependencies using traits and the concept of mixins. In this tutorial, we build a small test execution framework using the self-type annotation. [continue...]
  • Typed Akka: The Actor Model Done Right

    The Actor Model is a very promising concurrent programming model. One of its most successful implementations is Akka, which is the reference implementation on the JVM. In this tutorial, we’ll discuss the actor model’s main features and how Akka implements them in its last version, the Akka Typed library. [continue...]
  • Variances in Scala

    In this tutorial, we will be looking at Scala variances. Variance tells us if a type constructor (equivalent to a generic type in Java) is a subtype of another type constructor. We’ll also take a look at the three main types of variance – invariance, covariance, and contravariance – and how they differ. [continue...]
  • A Comprehensive Guide to For-Comprehension in Scala

    In imperative programming languages, we use loops such as for-loop and while-loop to iterate over collections. The Scala programming language introduced a new kind of loop: the for-comprehension. Its use goes far beyond simply looping over collections, helping us to deal with the complexity of the syntax when using a functional approach to programming. [continue...]
  • To Trait, or not to Trait?

    Developers coming from object-oriented languages such as Java or C# know very well the difference between abstract classes and interfaces. The Scala programming language introduced a third contestant in the match: Traits. [continue...]
  • ...And Monads for (Almost) All: The Reader Monad

    I have already written of dependency injection mechanisms in modern programming languages. I wrote about the Cake Pattern and how to use Scala self types to resolve the problem of dependency injection. Then, I showed how to use Scala implicits to implement a dependency injection mechanism. Now its time to speak about how functional programming tries to solve the dependency management issue, using the Reader Monad. [continue...]
  • The Pimp My Library Pattern

    Which is the main problem you have as a developer when you use libraries that you don't own? You can't change them. If something is missing in the public API of a library, there is no chance to extend it. Using some excellent old object-oriented programming, you can overcome this problem by writing much boilerplate code. In the JVM ecosystem, modern programming languages, such as Scala, Kotlin or Groovy, try to give a solution to library extension, the Pimp My Library Pattern. [continue...]
  • Optional Is the New Mandatory

    Since the beginning of the 'computer programming era', developers had searched for a solution for one of the biggest mistake made in computer science, the invention of the null reference. Since functional programming became mainstream, a solution to this problem seems to arise, the use of the optional type. [continue...]
  • It's a Kind of Magic: Kinds in Type Theory

    I am not an expert of functional programming, nor type theory. I am currently trying to enter the world of Haskell after I mess around the Scala world for a while. When I read about Kinds, I remember I was surprised, and a little bit scared. Is it possible that types have types? So what does this mean? In this little introductory post, I will try to explain to myself what I understood during my journey through kinds in my Haskell travelling. [continue...]
  • ...And Monads for (Almost) All: The State Monad

    This article starts a series on a topic that is very hot among the developers' community: functional programming. In details, we will focus on monads. The main aim of monads is to make simpler the composition of pure functions, that are mathematical functions that cannot have any side effect. We start with a classic: The State Monad. As its name suggests, using this object, we will be able to manage the state of a program effectively, without breaking one of the main principles of the paradigm, immutability. [continue...]
  • The Secret Life of Objects: Inheritance

    This post is the second part of a series of posts concerning the basic concepts of Object-Oriented Programming. This time, I focus on the concept of Inheritance. Whereas most people think that it is easy to understand, the inheritance is a piece of knowledge that is very difficult to master correctly. It subtends a lot of other object-oriented programming principles that are not always directly related to it. Moreover, it is directly related to one of the most potent forms of dependency between objects. So, let's get this party started. [continue...]
  • The Secret Life of Objects: Information Hiding

    I've been in the software development world for a while, and if I understood a single thing is that programming is not a simple affair. Also, object-oriented programming is even less accessible. Last week I came across a blog post -Goodbye, Object Oriented Programming-. After having read it, I fully understand how easily object-oriented programming can be misunderstood at many levels. I am not saying that I have the last answer to the million dollar question, but I will try to give a different perspective of my understanding of object-oriented programming. [continue...]
  • Template Method Pattern Revised

    When I started programming, there was a design pattern among all the others that surprised me for its effectiveness. This pattern was the Template Method pattern. While I proceeded through my developer career, I began to understand that the inconsiderate use of this pattern could lead to a big headache. The problem was that this pattern promotes code reuse through class inheritance. With functional programming became mainstream, this pattern can be revised using lambda expressions, avoiding any inheritance panic. [continue...]
  • Single-Responsibility Principle done right

    I am a big fan of SOLID programming principles by Robert C. Martin. In particular, I thought that the Single-Responsibility Principle was one of the most powerful among these principles, yet one of the most misleading. Its definition does not give any rigorous detail on how to apply it. Every developer has left to his own experiences and knowledge to define what a responsibility is. Well, maybe I found a way to standardize the application of this principle during the development process. Let me explain how. [continue...]
  • A Cameo that is worth an Oscar

    Rarely, during my life as a developer, I found pre-packaged solutions that fit my problem so well. Design patterns are an abstraction of both problems and solutions. So, they often need some kind of customization on the specific problem. While I was developing my concrete instance of Actorbase specification, I came across the Cameo pattern. It enlighted my way and my vision about how to use Actors profitably. Let's see how and why. [continue...]
  • Resolve me, Implicitly

    Reading my posts you can easily find that there is a topic that cares about me a lot: Dependency management in the development process. There is a feature of the Scala programming language that I liked since the beginning. Without any external library, it is possible to successfully implement vary dependency injection mechanisms. In the past, I wrote about the Cake pattern. Now it's time to talk about dependency injection through the use of implicits. Let this race starts! [continue...]
  • Object-Oriented Programming strikes back!

    Recently I read the article "Beginning to Doubt Object-Oriented Programming" on DZone. It is not the first post that I find on a blog that praises functional programming with respect to object-oriented programming. For all of this posts, object-oriented programming is dead (more or less). I think that at the basis of all this posts there is a misunderstanding over what functional programming really is. Now it's time for me to give my two cents to the fight among different programming paradigms. [continue...]
  • Machine Learning: A gentle introduction

    Looking at the last Google and Apple conventions it was clear to all: if in the past years the main buzzwords in the information technology field were IoT and Big Data, the catch'em all word of this year is without any doubts Machine Learning. What does this word exactly means? Are we talking about artificial intelligence? Somebody is trying to build a Skynet to ruin the world? Machines will steal my job in the future? Know your enemy, they said. So let's try to understand what Machine Learning really means. [continue...]
  • Test Proven Design

    Just a couple of days ago, I was surfing through the code base of the project I am actually working on when I found something that disgusted myself a lot. I smelled that something was wrong. Then, I checked unit tests associated to the class. Bingo, tests were not complete. Tests' incompleteness did not highlight a problem in class design. Let's look how tests can improve the architecture of software that we develop everyday. [continue...]
  • Dependency.

    What does the concept of dependency mean in programming? Is it important in modern development process? Has the concept of dependency a different meaning when we speak about procedural programming, object oriented programming or functional programming? In this post I will try to sum up all the knowledge I gained during my life as a software developer. [continue...]
  • Implementing Time Series in MongoDB

    I came recently to design a solution for MongoDB to store information that has time as the main axis of analysis. This information should be stored in a way that is easy enough to query and aggregate using many different time granularity (monthly, weekly, daily, ...). Information should also be stored in a way that does not consume too much disk space and is optimal in performance for MongoDB to maintain. In a word, I need to transform MongoDB in a Time series database. [continue...]
  • Code looks like a Chain

    As Aerosmith sang many years ago, “Code looks like a Chain.” No? They didn't say that? Maybe I'm remembering it wrong. Well, as you might have guessed, in this post, we'll talk about the Chain of Responsibility design pattern. This pattern is not one of the more popular ones, at least among the patterns defined by the Gang of Four, but modern dependency injection frameworks give us the possibility to implement it in a smart, and fresh way. Let’s see how. [continue...]
  • Scala is dead, long live Scala!

    Recently I came across yet another post about the adoption of Scala in the IT world nowadays. The article is 'The Rise and Fall of Scala' on DZone. In that post the author describes the reasons of the failure of the Scala language in becoming the next big general purpose programming language. But, are we sure that authors of Scala ever pretend the language to be used by every developer on the Planet? I don't think so. [continue...]
  • Try again, Apache Spark!

    It's been more than a year since I've started working on my first Big Data project. In this project we chose Apache Spark as batch processing framework. Using Apache Spark throws you in a functional, distributed and asynchronous programming world. While you have not to worry about the distributed adjective, because Spark hides you every problem related to it, the functional and asynchronous adjectives make things more complex with respect to the error handling process. Let's explain why. [continue...]
  • Resolving your problems with Dependency Injection

    'No Silver Bullet' wrote Brooks in the far away 1986. The history of software engineering proved him right, there is no doubt. Through the past years, hundreds of theories, patterns, frameworks, technologies risen as fast as they successively fallen. Dependency injection broke down the developer community from its definition. In this post I will introduce the pattern, giving the basis for developing a discussion on pattern pros and cons in the next post of this series. [continue...]
  • A new way to err, Apache Spark

    Apache Spark is a library that let you write code that will be executed in a distributed fashion as a simple single threaded program. Spark will make the dirty job for you: it will distribute the code and the execution, manage remote objects for you, optimize the algorithm for you. However, be aware: there is no kind of magic behind Spark. If you do not deeply understand the logic behind it, you will discover new way to loss your time searching for incomprehensible bugs. [continue...]
  • Actorbase or "the persistence chaos"

    You know, everybody out there is talking about Big data, NoSQL databases, reactive programming and so on. There are a lot of buzzwords that are constantly used in this era and the above are some of these. What if someone decide to put some of those buzzword together? What if we couple NoSQL databases and the actor model? Actorbase is a NoSQL database that uses the actor model as its internal reference model. [continue...]
  • Immutability = Thread-safety

    No, there is not a typo in the title of this post. It is a distorted quotation from the Slipknot song 'People equal s**t'. And more or less this was my reaction when I discovered that in Java immutability is not equals to thread-safety. Not always. Let me explain why. [continue...]
  • You shall not comment!

    When I was attending the course of Computer Science at the University they told me that I have to document my code. In this way, the developers that would come after me could understand easily the code I had wrote. Writing good comments is an hard task, if it is possible at all. In this article I will try to explain you why. [continue...]
  • The Good, the Bad and the Singleton

    If you search for the word Singleton on Google, you will probably come up with a bunch of rants about the fact that this design pattern is the absolute evil on the earth. Is it true? Or is this design pattern totally misunderstood by developers? In this series of articles I will try to analyze the reasons that stay behind those rants and I will try to give my point of view on the issue. [continue...]
  • Handling dynamic id objects in Rational Functional Tester

    Functional testing is an discipline that is becoming more and more requested in software industry. In this article we will focus on Rational Functional Tester and on a problem that affects it: recognition of HTML objects with a dynamic id. [continue...]
  • A (too) short introduction to Scala

    I recently had an introductory talk on the Scala programming language. the aim of the talk was not to be a comprehensive presentation of the Scala programming language. The aim was to introduce the Scala language, putting a stress on the features that made it one of the heirs to the throne of programming. [continue...]
  • Eat that cake!

    We know it, managing dependencies between software components within a project of magnitude rather than trivial could become a hell if not planned properly Scala provides a mechanism to resolve dependencies similar to DI, the *cake pattern*. Unlike DI pattern in other languages, such as Java, C++, etc ... the cake pattern can be used directly with language constructs available in Scala. [continue...]
  • Introducing myself...

subscribe via RSS