¿Preferís los “boxed primitives”?

Photo by Christopher Bill on Unsplash

Aclaración

Cuando me refiera a tipo de datos primitivos, los voy a escribir en italic:
booleans, int, double
, etc.
Los Wrappers / Boxed Primitives los voy a escribir común y corriente.

TL; DR;

Estos cuatro puntos describen bastante bien la idea del artículo:

  • Es preferible usar booleans primitivos que los Booleans wrappers: de esta forma evitamos NullPointerExceptions, complejidad de autoboxing/unboxing y creación innecesaria de objetos.
  • Si estamos pensando en usar un objeto del tipo Boolean porque necesitamos un estado nulo, podemos usar, en cambio, un Enum. Esto nos dará mucha más información que un valor nulo.
  • En mi opinión…


Sometimes the number of technologies to know can be overwhelming. Do not panic!

Photo by Tim Gouw on Unsplash

that-is-not-a-full-stack-dev-meme.jpg

Very often I see claims about the tech stack requested for a Software Developer/Engineer position. Generally, these claims take the form of posts in social media and, why not, LinkedIn.

Also generally, these posts are made by programming/engineering students, although I’ve seen some active developers sharing the very same idea.

I’m talking about memes, or some aggressive or sarcastic reply screenshot referring that the requisites for a Software Engineer position are practically impossible to accomplish.


Do you prefer boxed primitives?

Photo by Christopher Bill on Unsplash

TL; DR;

These four bullets describe very well the idea of the article:

  • Prefer primitive booleans to wrapper Booleans. It is always the best choice as you avoid NPEs, autoboxing complexity, and unnecessary object creation.
  • If you are thinking about using a Boolean object because you need a null state, use an Enum instead, it will give you far more information than a null value.
  • IMHO Boolean wrappers are just a bad side-effect of the object-oriented approach of Java. They are there, but it doesn’t mean that we should use them ;)
  • There are two main special…


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 a lot. I know devs that kind of hate interfaces. Whenever they see interfaces in the 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. I will try to introduce some of them, and then I will try to explain the reason why I don’t think interfaces are useless and, even more, they are very important.

TL;DR

IMHO, this is…


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…


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 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…


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 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…

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