While learning scala/clojure and functional programming I have come across a very familiar concept: pure functions. It reminds me of an interactor, but I feel that is much more valuable as a concept. The wikipedia says that a function may be considered pure if:
Pratical Object-Oriented Design in Ruby by Sandi Metz
This is one of my favorite Ruby books ever. It is very well written and a joy to read. I highly recommend this book.
So, why is software design so important?
When starting a new software application you have certain requirements. You analise these requirements, build your software and it works. As time goes by, those requirements will change and you will need to refactor your code. If you have a good design architecture, with loosely coupled classes, refactoring your code to meet the new requirements is easy. Otherwise, it will be very painful to make changes.
Some time ago our team started to write code differently. Inspired by Architecture: The Lost Years, we started using interactors and presenters, greatly improving our code base. We also started writting rails-free unit tests. It’s good to know that we are not alone on this process. The Objects on Rails book shows a step by step process to build this kind of code.
In Paulo’s post about presenters and views, he talked about how to make the view free of business logic. This is confident coding. The following talk shows this in a wider perspective. Not only for views/presenters, but for all code.
I believe that development by copy paste is the worst work process that a programmer may have. I’m talking about having a piece of software working, and copying it fully to another location on the same project, and performing some changes.
Most people still think that the office is the best place to get work done. They think that a bunch of people need to be in the same room for great things to happen. Well, let me tell you that the office is full of distractions. In this short video, Jason Fried will tell you why work doesn’t happen at work. I guarantee you that these will be the best 15 minutes of your day. Enjoy!
The concept of the interactor is the biggest breakthrough that I have experienced in my evolution as a programmer. It’s simple, and it has always been right beside me. But I have only acknowledged it when I saw Arquitecthure: the lost years.
The concept is very simple. An interactor is:
In a Ruby on Rails application, views can get really messy over time. They tend to grow into large files with if else blocks scattered all over the place.
Lately I’ve been working on an existing application with views like these. My goal was to remove all the logic from the views into presenters, making the views smaller, more readable and easier to maintain.