Opinion

There is much more in a software company behind technologies

Image for post
Image for post
Photo by Huang Yingone on Unsplash

Developers look at the technologies that companies adopt as one main metric when evaluating a collaboration. A decision based on this is too superficial. Do we really fear the technology? Or maybe we associate the company culture with it?

I want to tell you my story and what I would have lost if I refused to work in COBOL back in 2010 when I was 25.

Big city life

After university, I started working in a big company in Milan. I was working on a private social network, using the most recent Java technology stack. …


The definitive solution to composability

How to compose independently computed Kotlin nullables, in an easy and clean way

Image for post
Image for post
Kotlin + Konad = 😁 (Image by author)

In Kotlin we have null safety.

There are many advantages to using nullables in Kotlin, even if they can’t be totally considered as monad. Your API can express optionality in a clean/compile-time-safe way. Also, they bring back your side-effectful function to the pure world.

This feature is one of the most exciting and idiomatic of this language. Anyway, there is one drawback. Composability!

I will propose a solution to this annoyance.

Have you ever tried to compose nullables?

Well… I can’t say that composing independently computed values really shines. Let’s figure out a real-world use-case.

Crypto exchange

Let’s think about a crypto exchange. Suppose that when registering, they ask…


“If it compiles, it works” with Valiktor and Konad

Image for post
Image for post
Photo by Georgy Rudakov on Unsplash

In Domain Driven Design there is a concept of ubiquitous language. Being trivial, this is usually related to the names you give to the entities in the domain model.

However, it’s possible to take it a step further. We can turn the code into an unequivocal expression of the domain.

For example, here it follows how an American domain expert may describe a “contact” and some business rules.

A contact has a name, a surname, and an email. The name can have a middle initial. The email must be verified. You can send password recovery only to verified emails.

A…


Builder functions, blocking, suspended, ‘Scope’… what?

Image for post
Image for post
Image source: Author

Kotlin coroutines are an efficient way to (re)use threads while the computation has been moved somewhere else. Coroutines are bound to the concept of Scope: to run one, you need before to declare a scope object. This is how they implement structured concurrency. To get a scope, you use the scope-builders functions, like coroutineScope{} or runBlocking{}. A scope suspends (or blocks) a thread until all of its coroutines are finished.

The following example will print “213.”

This prints 213

This means that you can’t just fire-and-forget an operation if you don’t have the plain control of your main (quite usual…


And receive the best happy birthday greeting ever from Dario

Image for post
Image for post

I Had an Idea

There is a colleague of mine, Dario, who gives great happy birthday greetings.

Everyone in the office is happy to receive an audio greeting from Dario. They say, “it is not a birthday until Dario sends you the greeting.”

So why not let everyone in the world be greeted by Dario on their birthday Do you want to try it out?

At the moment it is only in Italian (sorry).

Github repository here:

Ok. How?

I need an easy way for people to ask for greetings. Website? Who still uses a website in the platform era? Platform then. Which one? Facebook? Twitter…


Using the visitor pattern as a routing point (with Kotlin examples)

Image for post
Image for post
Photo by Aaron Burden on Unsplash

Functional programming gained a big momentum in the IT field; many things come and go, but FP is not one of them. It is much more expressive than OOP.

I started digging into it a few years ago, during the LambdaConf in Bologna, and the more insight I get, the more I love FP.

In June, I went to an applied functional programming workshop and the teacher went deep into algebraic data types and pattern matching. I also finally understood what a monad is, but this is another story.

I used to think of pattern matching as an interesting way…


Test-driven development is hard — here’s the untold truth

Image for post
Image for post
Image credits to https://testsigma.com/blog/ai-driven-test-automation/

These days you read a ton of articles about all the advantages of test-driven development (TDD), and hear a lot of talks at tech conferences that tell you to: “Do the tests!”, and how cool it is to do them.

And you know what? Unfortunately, they are right (not necessarily about the “cool” part, but about the useful part).

Tests are a must!

The typical advantages we list when it comes to talking about TDD are real:

  • You write better software.
  • You have protection from breaking the world when new features are introduced.
  • Your software is self-documented.
  • You avoid over-engineering.


Explaining a simple technique for barcode segmentation from images

Image for post
Image for post

In this piece, I’m going to explain a simple technique for barcode segmentation from images.

For the example code, I will adopt Python 2.7 in its Anaconda incarnation and OpenCV as image processing library.

I chose Python as it is a very practical choice for quickly writing examples, but the technique can be adopted in any language of your choice.

Anaconda is an interesting Python distribution that bundles a series of useful tools for scientific programming.

Segmentation is the process of identifying the position of one or more objects inside an image.

The technique that I’m going to present is…


Image for post
Image for post

In questo secondo articolo spiegherò come raddrizzare un’immagine che contenga elementi per i quali sia evidente una direzione comune e prevalente. Fanno parte di questa categoria le immagini contenenti testo.


This article is also available in english

Image for post
Image for post

In questo articolo vado a spiegare una tecnica di segmentazione di codici a barre da immagini. Per l’esempio utilizzerò Python 2.7 nella sua incarnazione Anaconda e OpenCV come libreria di image processing. La scelta ricade su python per comodità ma la tecnica illustrata è utilizzabile in qualsiasi altro linguaggio. Anaconda è un’interessante distribuzione di Python che racchiude in bundle una serie di strumenti e librerie molto utili in ambito di programmazione “scientifica” tra cui matplotlib, un’ ottima libreria per rappresentare i dati estratti tramite schemi e grafici. …

Luca Piccinelli

I’m a programmer. I love programming, any language, any paradigm

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store