And when are they not?
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:
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.
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
Primero lo primero. ¿Qué es el Strategy Pattern?
“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
First of all. What is the Strategy Pattern?
“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. …