I came across this framework, ok lets just call it plugin, because there are no words to describe what lombok is. For some might just be some nice plugin for IntelliJ (come on, no one is using eclipse nowadays!), for others some sort of auto generation wizardry, and for others (like me) a really neat way of keeping the code clean and avoid some nasty boilerplate code.

I am gonna keep this post short, because well, lombok is quite simple actually. Do you know every time you write a POJO in Java? Do you remember every time you have to auto generate those nasty getters and setters? And you end up with a file full of methods, that just fill up your screen? Yeah, those days are over… let me (quickly) introduce you to lombok.

Do you see this class:

import lombok.Data;

public class Person {

    private long id;
    private String name;
    private int age;


Lombok works through annotations, you just mark your POJO and the getters and setters will be generated. Or in other cases where lombok can help, for example @SneakyThrows allows to bypass a checked exceptions.
To tell you the truth, the @Data annotation generates you more than just getters and setters, also redefines the equals and hashcode method, and the toString as well. But you can specify each one of these by using @Getter, @Setter, @EqualsAndHashCode, @ToString respectably.
For cases where you need to avoid cyclic dependencies, you can specifically choose to ignore a particular field from being used in this auto-generation.

Now for this to work you have a nice IntelliJ plugin, and you guessed it right, also works in Android Studio.

I will leave you with some links but please feel free to ask me any questions.
IntelliJ Plugin: https://plugins.jetbrains.com/plugin/6317
Project Lombok: http://jnb.ociweb.com/jnb/jnbJan2010.html
Lombok dependencies (maven/gradle): https://projectlombok.org/mavenrepo/


Tags , ,

A lot advanced programmers certainly have heard of this two big words, Dependency Injection (DI) & Inversion of Control (IoC). Mainly known as very desirable pattern for solutions on software projects because they enable a nice and clean architecture and loosely cloupling between the various software components.

But before I start giving a big speech about DI & IoC, first I’ll start with a pratical example, using C# (because Ninject was implemented for .NET), to explain what really are this big two words. Then I’ll talk about the practical application of Ninject, and the importance of these two patterns, and also give a little example on how to use the Ninject Extension MVC, to allow the usage of this two patterns on your ASP.NET MVC application. So let’s start with the example…

Tags , , , , , ,