The One with Rails
I did some programming in Rails today. On my own, even!
We (almost) finished our implementation and testing for handling the “published” event and talked briefly about what should happen for the revoked event before their team’s refinement meeting. After the meeting, my buddy had another meeting and I used this time to start implementing the rest.
I was actually quite surprised how well it went. I had some test as a basis to work off from, my notes from us talking about this earlier, our commits from yesterday and this morning, and a code base that I was vaguely familiar with from years ago. So I started by copying the specs from the other event and changing initial states and assertions and worked my way through the application from there. They have built a structure for very easily processing external domain events, building and handling internal commands and building test data that made it quite easy for me.
I felt like although I did a lot of copying, I understood most of what I was doing there. I’m just a bit confused by calling lots of functions without any arguments because the objects I need are just lying around for me to use wherever I need them. And it took me a while to be able to interact with their state machine but once I got it, I was amazed by how cool the syntax of its helper functions is.
Another thing I noticed was how used I am to formatting on save. When we started using the formatter in our projects, it always confused me when my code jumped around when I hit save. But now it’s just really weird to me when I have to properly indent my lines and things like that. Which brings me back to the fact that it really annoys me that VS Code doesn’t show the syntax errors when it can’t format on save. How times change …
In the afternoon we refactored my code a bit to make better use of some of their standards and then we were done. That was quick. I wonder why that was so much quicker and easier than most of the things we do in our team. Was I just lucky with a very simple ticket? Do they have lots more configured already than we have? Is it because Rails has some better helper functions than the kind-of-young Phoenix? Is it because I mainly changed state and that’s the main purpose of object-oriented languages? I guess that’s some things we can talk about tomorrow (and then later with my team mates).