And when are they not?

A team working
A team working
Photo by Annie Spratt on Unsplash

Some people say that interfaces are useless. Actually, I hear it in my current job (a lot). Some of my teammates kind of hate interfaces… I’m not joking. Whenever they see interfaces in my code, some of them start summoning a battery of arguments against them… they think interfaces are useless or unnecessary.

I don’t believe that, but I won’t deny that some of their arguments are interesting. …


Are they the same?

Since the release of Java 8, the language now supports Functional Programming, and we can write things like this:

Lambda Expressions

So, what are Lambda Expressions? Lambda Expressions are functions that don’t need a name and can be defined right in place. They are also known as lambda functions.

We can recognize a Lambda Expression because it contains an arrow “->” that separates the arguments and the function body.

But, how does the compiler understands that? Well, it is because of the Functional Interfaces.

Functional Interfaces

A functional interface is just a Java Interface that has one and only one abstract method. It can be annotated with @FunctionalInterface, but that’s just for the reader, it has no implications at all. …


Ventajas y desventajas, y algún que otro insight respecto a esta práctica.

Read this article in English here

Image for post
Image for post

Primero lo primero. ¿Qué es el Strategy Pattern?

El Strategy Pattern es uno de los 23 patrones de diseño presentados por el grupo Gang of Four (GoF), y se encuentra dentro de la categoría de patrones de comportamiento.

“El Strategy Pattern define una familia de algoritmos y los hace intercambiables”

Este patrón de diseño nos permite aplicar un concepto importante en la programación orientada a objetos que es favorecer la composición por sobre la herencia, lo que se traduce a poder modificar el comportamiento de un objeto en tiempo de ejecución.


Pros and cons, and some others insights about this practice.

Read this article in Spanish here

Image for post
Image for post

First of all. What is the Strategy Pattern?

The Strategy Pattern is one of the 23 design patterns presented by the Gang of Four (GoF) group, and it belongs to the Behavioral Patterns category.

“The Strategy Pattern defines a family of algorithms, and makes them interchangeable”

This pattern allow us to apply an important concept of object oriented programming: favor composition over inheritance, which we can translate as the ability to change an object’s behavior on runtime.

With this small introduction about the Strategy Design Pattern, let’s see some code. …

About

Marcelo Valls

Just another Software Engineer who loves programming, reading and teaching

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