Day 23: day in the life of

Saturday mornings usually mean an extended walk to the cafe for breakfast. I took some photos of my route today. This is probably my favourite one. #mbsept

Road curving to the right, shaded by eucalyptus trees, with a playground on the right.

Day 22: road #mbsept

Dirt road travelling through a forest.

It would be nice if there was an option in Mastodon’s web-app to turn off displaying alt text as a popup when mousing over an image. Some alt test descriptions are quite comprehensive, and while I’m browsing the feed, my mouse cursor lands naturally in the centre of an image if the post has one. I start looking at the image and then the popup appears and blocks a significant part of the it.

Screenshot of the timeline in the Mastodon web-app with an image of text, and the alt text displayed as a title popup blocking a large part of the image, obscuring the text itself

I’m perfectly fine with having the popup show up by default, but having the option to turn it off would be nice. An even better option would be to position the alt text below the image, so that it appears without obscuring the image at all. That would also be welcomed.

Day 21: fall

This shed hasn’t fallen down yet, but it’s in a bit of a precarious state. #mbsept

A shed in a forest leaning on a tree with some graffiti on the side and the door fallen off it's hinges

Day 20: disruption

Going to take this opportunity to say that I like the design of our road works signs. They have a standard frame from which you can swap out the sign panels based on what you need to convey. Beautiful modularity. #mbsept

A road works sign with a 40 km/h speed limit, a man holding a stop sign, and the lower portion saying Prepare to Stop

🎵 Pippin, the New Broadway Cast Recording, by Stephen Schwartz.

One of the defining memories of my life was in Year 10, playing the viola in the pit orchestra of our high-school production of Pippin. Good times.

🎵 Stages, by Elaine Page

One of a handfull of albums I use to play constantly on the record player when I was a kid.

Day 19: edge #mbsept

The edge of a train station platform showing part of the rail line and the message Mind the Gap

I was designing something for work a couple of months back. I got a little fancy and added a domain-specific language to the first draft, thinking that it could be useful for handling some special case requirements from the business that we haven’t considered for. I pulled it out in a later revision, thinking to myself “nah, you’re not going to need that anytime soon.”

Well, some changes came through from the business today, and now I wish I kept in that DSL. It hasn’t even been a week. 😛

P.S. I tend to add DLSs into every single project I build so don’t take this post as justification to add a scripting language to your next project just because “it could be useful”. 😉

About Mocks In Unit Tests (Again)

How can one gain confidence that what they’re testing works if one is using mocks?

I’m grappling with this now as I go through making changes in one of the services I’m working on. So much of the logic requires rework, which means the tests will need to change. And yes, the tests use mocks, meaning that the changes are significant.

But do they have to be? We’re effectively mocking things that can easily run as part of the test. Things like a DynamoDB store — which can run within a Docker container — or even services from other packages. Sure they’re not part of the “unit”, so using them in a unit test won’t make it a “unit test” anymore. But I’d argue that using “real” implementation of dependent systems would produce more confidence in the changes I’m making. I’m able to change the logic without changing much of the test itself. Surely this is worth the “unit test” purity price.

And even if the outcome is meant to change, that intention is made clear by simply changing that in the test, without touching any of the setup code. Nice and readable in the MR: the function was expected to do this, now it does that.

That said, I would concede that there’re legitimate cases for mocking. Namely, if it takes a significant amount of time to setup the dependencies, or you can setup the dependencies within the test itself, mocking is probably the best option. A slow test or, even worse, a test that won’t run if dependent services are unavailable, is worse than a bunch of mocks.

Maybe a good compromise is recognising that excessive mocking in a unit tests is a sign that a module has too many dependencies.

Day 18: fabric

My woollen blanket, knitted by my nonna. #mbsept

Red blanket draped on the arm of a burgundy couch

Getting to the point in the photo blogging challenge where I’m saying to myself: “have I posted this photo before?” One of the candidates I had for today, the answer is actually yes. Fortunately I do have an alternative.

Day 17: intense

Didn’t time this photo well. There’s usually an intense game of soccer on this pitch most Saturdays. The Sunday crowds are a little more serene. #mbsept

An empty soccer pitch with a couple of people playing with their dogs

Spent some time today building a site for my Go utility packages. A feature I’ve decided to add is a Go template playground, where you can test out Go templates in the browser. Not something I’ll use everyday but I’ve occasionally wished for something like this before. Could be useful.

The template playground, with a field for the template saying 'hello what', the data which has 'what' equal to 'world' in Json, and the output which is 'Hello, world'

Still waiting for the dream to be able to write code on an iPad. There are some good native apps out there for checking out Git repos and editing files with syntax highlighting, but I never use them because there’s nothing in the OS that integrates them all. You’re left with switching between them to do something in your workflow, which is disorientating as each one will take up the whole screen and throw away your context. I suppose there might be Shortcuts — I haven’t explored what it’s capable of — but what I really want is a shell.

The closest that worked for me is a Code Server web-app running in a chromeless browser. It works for me mainly because there is a shell. If the editor doesn’t support a feature, I can use a command to do what I need. I don’t have to switch between apps either: I can see what I’m doing and the files I’m doing it to. I can also build and run them code I’m writing. Fancy that!

Day 16: oof!

I can’t understand people that stay up until midnight most nights. It’s only 9:00 and I’m already exhausted. #mbsept

A digital oven clock that reads 20:59.

Day 15: red

Red mailboxes means the post will go faster. 😉 #mbsept

A red Australian Post mailbox

Day 14: statue #mbsept

Statue of a winged lion on a brick pedestal

Enjoying coffee and breakfast after a really early start and several weeks of hard work, with the satisfaction that the work is now done. Good feeling. 😌

Day 13: glowing #mbsept

Sun rising on a road with buildings on the sides and tram lines down the center