Don't worry, it's ... Probably Fine

Notes from the Week #23

14 Jun 2019

weeknotes gds ci

So it’s been about a fortnight and I think I’ve got my feet under the table now - I’m feeling more confident in my ability to do the what but I need to improve my why, which will come with time and I need to be more patient with myself. I got a nice bit of feedback at the end of the week which made me feel a lot better about how I’m doing. Surprise, surprise, I was being unrealistic with myself!

First impressions are important too, and I’ve classically been over-thinking about posting on our internal work Slack. “Is this actually useful?”, “Do people care?”, “Are you bringing signal or noise?”. They’re useful thoughts to have but I’m trying to stop them preventing me from interacting with our communities at all.

To this end, I volunteered to run my first tech lightning talk! Nothing like speaking in front of a load of new colleagues to blow those cobwebs away … right?

I’ve been fascinated with the micro-methodology of Test-Commit-Revert and have been experimenting with it on some code katas, so I’ll (hopefully!) do a small talk about the motivations behind TCR (and perhaps trick persuade some colleagues to join in!)

Building a fun refactoring, and why?

I’ve found that I learn best from messing around in codebases and making good friends with git stash. This week I stumbled across a bit of code I wanted to refactor, and had a bit of a think about why that bit of code called out to me like it did.

Why refactor in the first place?

Code is overwhelmingly read more than it is written - even in the case of a single person writing code and coming back to that same code later, it’s already been read more than written, so we can optimise for understandability.

This particular bit of code:

  • Had a Stream<T> that would benefit from decomposing a single .map() with method chaining into multiple .map() calls.
  • One of the filters was written as .filter(x -> foo (x) || bar(x)) which could be (a) extracted into two predicate methods (foo, bar) and rewritten as .filter(foo.or(bar))
  • Duplication between the foo and bar predicates could be extracted and composed.

P.S. The other reason I picked this part of the codebase is because Spotless, a linter we apply to our codebase, indented that block noticeably.

I couldn’t have done this without the codebase’s high-quality test-suite enabling me to feel safe to change the code.

Resolving some hiccups

I paired with one of my developer colleagues for a large chunk of this week, on integrating some changes into a different codebase. We thought one of our commits was fine as it was passing all the tests, but we spotted some issues in staging before it was rolled out to production.

These were caused by Dropwizard/Guice evaluating @Singleton lazily in development mode but eagerly in production.

We fixed this after some thought about how we were wiring our code, and he showed me some cool ways to test it that I wouldn’t have thought of.

I’m not used to having a test/staging environment - we deployed straight to Production at Unruly (with the ability to roll-back quickly), but in this case I’m glad we had this added layer of safety.

All in due (con)course

I dived head-first into our re-platforming work at the end of this week, trying to establish how we can run jobs in a Concourse CI instance that will be running in the new cluster.

I’m immediately attracted to the “no GUI” model that Concourse espouses - things like Jenkins, TeamCity, GoCD used to be a lot of work in the user interface, which turned me off in the past (along with other reasons).

It’s aesthetically pleasing too - although I am a sucker for scaled greys and “night-mode” in applications, and I love that it presents itself as a “thing-doer” rather than a “CI server”. The latter really rustles my jimmies around conflating practice with tooling.

I’m looking forward to dealing with it more in the future and seeing if it breaks down my misconceptions about continuous thing-doing.

(Some of) what I’m listening to

  • DeepMixNation - various: If I’m getting deep into some knowledge work or ‘flow’, I find it great to just put on some continuous deep house mixes as background music, so that I barely notice the track transitions that might pull me out of concentration.
  • Clubland Classix: Yeah, it’s been mostly dance-music this week, and this compilation is full of bangers.