Scala implicits are a great tool to remove code duplication and convert objects from different domains. However, we need to learn not to abuse them: by hiding code they can make the code more concise but more cryptic at the same time. In order to use implicits efficiently, we need to know how the compiler tries… Continue reading Implicits: Rules and Applications
REST APIs are becoming more and more popular: they allow horizontal scalability, they are flexible to change and easy to use without the need of detailed documentation. However, some APIs claim to be RESTful when they are not. This is mainly for two reasons: - We don’t always have a clear idea of what RESTful means, we just associate… Continue reading RESTful now more important than ever.
Sometimes we want to hide/protect our variables — the classic concept of encapsulation in object oriented programming. We’d like to write a Scala class to manage someone’s age. In particular, we’d like to: - lie on our age if we are not teens anymore (you never know!) - put some validation to avoid negative age values Our… Continue reading Stateful objects: use them to lie!