Concerns in Ruby: Part 1: Concerning Concerns

I recently wrote a post for the Maxwell Engineering blog regarding best practices around using concerns (aka. modules or mix-ins) in Ruby. You can check out part one of the four-part series at the following link:

Concerns in Ruby: Part 1: Concerning Concerns

Enjoy!

Best Practice: Code Like No One’s Watching

When writing code, it’s often easy to trigger the “freeze” response from the “fight, flight, freeze, or fawn” list of trauma responses.

“I bet I could make this SQL query more performant…”

“It feels like I could use a design pattern here…”

“This variable needs a better name…”

There are multiple issues at play here:

Continue reading “Best Practice: Code Like No One’s Watching”

Ruby Paper Cuts

I love programming in Ruby and (especially) the Ruby on Rails framework. That said, they both have some oddities and conventions that leave me scratching my head, making me wonder what such smart people are thinking, and questioning the very nature of reality…you know, much like an episode of a Disney+ or CW show.

Continue reading “Ruby Paper Cuts”

“Tests” are Not “Code Quality”

“Tests” and “code quality” – two concepts that I’ve seen conflated by developers, team leads, and CTOs alike:

Our codebase has a lot of tests and great test coverage.
Our codebase is high-quality!

No, not necessarily. All that having a lot of tests means is that you’ve, you know, tested your code. Having 100% test coverage says nothing about the quality of the code being tested.

Tests don’t atone for bad architecture. Tests don’t absolve you of design pattern violations. Tests don’t repay tech debt.

You can test good code. And you can test bad code.

Using Story Points in Agile

There are two possible ways to use story points in Agile. One is toxic, demoralizing, and will probably drive your developers to look for employment elsewhere, while the other is mildly helpful, which is about all you can hope for from story points in Agile.

Can you tell which is which?

Approach #1

“This [story / issue / ticket / whatever] was estimated as only 2 points (about one day’s worth of work) but it took a whole week to complete!

“Why did it take so long?!”

Approach #2

“We estimated this [story / issue / ticket / whatever] as being 2 points (about one day’s worth of work) but it ended up taking an entire week.

“What did we miss in estimating that could have told us that this task was more than 2 points worth of work? How can we improve our process?”

Responding to “Beware of ‘service objects’ in Rails”

I recently stumbled across Jason Swett’s “Beware of ‘service objects’ in Rails” blog post. While I appreciate the perspective, I think it gets a number of things wrong. I replied to this post in a comment, but wanted to post my thoughts here as well in the hopes of encouraging more dialog about this important topic.

If so inclined, please feel free to comment below with your take on this subject.

Continue reading “Responding to “Beware of ‘service objects’ in Rails””

Best Practice: Use Long-Format Flags in Shell Scripts

When working on the command line, it’s perfectly fine to use short-format flags. For example:

$ ls -al

This is memorable, easy to type, and helps you focus on accomplishing the task at hand.

However, when writing shell scripts that will be used over and over, it’s tempting to write in the same, comfortable short-flag style. However, compare the following:

Continue reading “Best Practice: Use Long-Format Flags in Shell Scripts”