Alexandru Simonescu
user

Alexandru Simonescu

Doing what i love, loving what i do


Featured

Java

Clean Java immutability

Posted on .

An immutable class is just a simple class whose instances cannot be modified. You provide all field values when creating the instance and they cannot be changed for the lifetime of the object. As you may probably know, Java already has some immutable types as String (string concatenations is not efficient, remember?), BigInteger, BigDecimal.

Some good reasons to design immutable classes:

  • Easier to design, implement and use.
  • Less prone to errors.
  • More secure. Can be freely shared.
  • Are inherently thread-safe; they require no synchronization.

This brief blog post aims to give you an overview of different approaches to build and auto generate immutable classes on Java in a cleaner way. It will talk about two popular libraries focused on generating code: Immutables and AutoValue, also a bit of Guava’s immutables collections.

It’s not a comparative between them, as i think they are both great and it’s you who must choose the one who better adapts to your codebase and needs.

Featured

Android

Mastering tools namespace on Android

Posted on .

You probably saw in lots of XML layout examples provided by Google, that sometimes appears the tools namespace. This namespace is useful when developing and doesn’t affect the user experience. Are just a set of handy attributes who help rendering layouts in Android’s Studio Design View.

All this tricky attributes can sometimes save us build time. I’m not saying your build will be faster, but your builds related to UI changes can be fewer.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

The tools namespace full URI is http://schemas.android.com/tools, usually bound to the tools prefix but you can use whatever you want.

Featured

Android

Delightful persistence on Android

Posted on .

Please let me begin this article with a quote of Bruce Lee, one of my favorites martial artists:

Before I studied the art, a punch to me was just like a punch, a kick just like a kick. After I learned the art, a punch was no longer a punch, a kick no longer a kick. Now that I’ve understood the art, a punch is just like a punch, a kick just like a kick. The height of cultivation is really nothing special. It is merely simplicity; the ability to express the outmost with the minimum. It is the halfway cultivation that leads to ornamentation.

In not a very different manner, that happened to me while using sqlite databases on Android, either using ORM libraries, like ORMLite, DBFlow and so on, or using alternative databases like Realm. A database, it became just that, a database, no abstraction layers, just a database.

Featured

Software Architecture

Clean Architecture (Spanish)

Posted on .

Article written in spanish, as exported from my old spanish blog. All new published articles are in english, as is the main language of the blog.

Este artículo es una mera interpretación del original del de “Uncle Bob”, por tanto la autoría no es mía aunque haga alguna observación personal. Muchos términos he preferido no traducirlos por no tener ningún sentido en español.

Featured

NoSQL

Introducción a MongoDB y NoSQL en C# (Spanish)

Posted on .

Article written in spanish, as exported from my old spanish blog. All new published articles are in english, as is the main language of the blog.

Este artículo no pretende ser ninguna guía definitiva para trabajar con MongoDB en C# pero si se quiere dar una visión introductoria para que cualquiera que no haya tocado nunca este tema, sepa por donde comenzar.

  • Conceptos básicos de NoSQL
  • Instalación de MongoDB en Windows
  • La consola de MongoDB
  • Operaciones CRUD en MongoDB
  • Identificador único MongoDB
  • Conexión desde C#
  • Manejo de datos desde C#
  • Recuperar colecciones desde C#
  • Enlaces de interés