Happiness is a Choice

Blog


There are many things I believe my dad gets wrong. I also believe my dad believes there are many things I get wrong.

Today's trophy

Blog

"How was the run today?"

"Really not good. Intrusive thoughts. Ended up stopping after about a mile, walked for a bit, ran some more. I ended up running a bit farther to make up for stopping, but that didn't go well either. So, when I finished, I sat down and started crying because everything hurt so much. And as I was crying, a bunch of ants crawled on me and on cue, all bit me at the same time. So now I'm tired, in pain, and itchy all over."

"But you did it."

"Yes, I went for a run."

"Well, then, the participation trophy is the only one that matters today!"

win!

Feet to the flames

Blog

Mike: "I need to find someone to hold my feet to the flames to get things done."

Me: "I think it is less about finding someone to hold your feet to the flames, and more about finding someone to help you hold your own feet to the flame."

Semi-retirement can be difficult to navigate if you're previously a high-productivity professional.

IDD

Blog

Okay, so, you've heard of Test Driven Development, where tests (unit, functional, system, integration, and contract) are written first, then the code that passes the tests is written to that test's specifications, as a way to write good, efficient, tested code.

There are also Acceptance test-driven development (ATDD), behavior-driven development (BDD), example-driven development (EDD) and story test-driven development (SDD) styles of code writing. I'm most familiar with the last.

We have (mostly because I wanted) a tech-debt sprint every 4th sprint on my main project at work. These are sprints where we do not introduce new features, but rather fix bugs, improve infrastructure, increase performance, or refactor that write-once-to-learn-copy-once-and-shit-copy-again code into a don't repeat yourself (DRY) bit of code. When feature development is blocked, for whatever reason, we continue developing, but the priority order is often unclear.

Until today.

Find the bug, Rails edition

Blog

I have this code in a model in a Rails project.

  validates :name, presence: true, on: :create
  validates :email, presence: true, format: { with: URI::MailTo::EMAIL_REGEXP }, on: create

Let's put it in an Author model:

class Author 

When retrieving a list of all of the authors without email addresses (because, well, we are cleaning up these things) with this line of code:

  authors = Author.where(:email: nil)

... two new blank authors are created at the WHERE query. Both of their names and emails are blank. This is absurd!

Find the bug.

Pages