Latest Posts (10 found)
tekin.co.uk 3 weeks ago

The Ruby community has a DHH problem

David Celis recently published a thoughtful piece on Rails governance in response to the latest troubling blog post from DHH, the creator of Rails. Like David, I’ve also been troubled by DHH’s recent output and the harm it is causing to the Ruby community. I think it’s worth taking a moment to analyse DHH’s post in more detail and make it clear exactly why it’s so problematic. In his post, DHH complains that London is no longer a city he wants to live in because it is now only a third “native Brit”. His use of “native Brit” is as a proxy for “White British”. The implication is clear: if you are not White, you are not British. In the same post he praises Tommy Robinson (actual name Stephen Christopher Yaxley-Lennon), a right-wing agitator with several convictions for violent offences and a long history of association with far-right groups such as the English Defence League and the British Nationalist Party . He then goes on to describe those that attended last weekend’s far-right rally in London as “perfectly normal, peaceful Brits” protesting against the “demographic nightmare” that has enveloped London, despite the violence and disorder they caused . To all of that he ads a dash of Islamophobia, citing “Pakistani rape gangs” as one of the reasons for the unrest, repeating a weaponised trope borne from a long since discredited report from the Quilliam Foundation, an organisation with ties to both the the US Tea Party , and Tommy Robinson himself. A trope that exists despite the fact that the overwhelming majority of convicted child sex offenders are white men , with Asian men in fact under-represented.

0 views
tekin.co.uk 9 months ago

Yearnotes 2024

After a four year absence it’s time to get back on the yearnotes train! 2024 was a good year for Join Together . Our main focus was a chunky project for the National Education Union (NEU). As well as replacing their online join process, we also built them a bespoke service for upgrading existing student members to full membership after graduation. The NEU are one of the largest (and more tech-savvy) unions in the UK, so it was a pretty big deal for us to win the project. And despite a fair amount of complexity and esoteric requirements, we totally nailed it, leaving the folks at the NEU over the moon with what we delivered. We also shipped projects and updates of varying sizes for a good number of our existing union clients. It’s become clear that updates and ongoing development with existing clients will make up a healthy chunk of our revenue, which is helpful, as bringing new unions onboard can be a long and arduous process (it took a whole year from first contact to signed contract with NEU). By the tail end of the year Join Together’s projects were wrapping up and a previous client of mine got in touch asking if I’d be available for a short contract. They needed urgent help shipping some major updates in a short space of time. With no new Join Together projects starting until the new year I was able to take them up on their offer, and spent the last couple months of 2024 working on their mission. It turned into quite an intense project, working mostly solo to make significant changes to their user modelling (primarily separating admin-related code/authentication from their generic model (1) ). In the end it all went smoothly, which was very pleasing, and I was wrapped up in time for Christmas.

0 views
tekin.co.uk 1 years ago

Different ways to use “–patch” in Git

I’ve written previously about using to interactively stage changes . But did you know that you can use (aka ) to similar effect with other Git commands? Let’s take a look… is great for temporarily stashing changes that you want to apply later, and handily it also supports selectively stashing changes with the flag: Bonus tip: you can also selectively stash entire files using to disambiguate the command from the paths you want stashing: You can use the command to discard local changes and restore files to their last committed state. It can also be called with the flag to interactively select specific hunks to discard: Note the different phrasing of the prompt on the last line: Here we are choosing the changes we want to discard . Be careful, this is a destructive change, and because these are unstaged and uncommitted changes git won’t be able to help you recover the changes once they’ve been discarded!

0 views
tekin.co.uk 1 years ago

Appearance on the Maintainable Software podcast

I recently appeared on the Maintainable Software podcast with Robby Russell. It was fun chatting with Robby about some of the things that help keep software maintainable. Check it out !

0 views
tekin.co.uk 2 years ago

How to use introspection to discover what is exhausting your ActiveRecord connection pool

This week I wrote about the reasons why you might need an ActiveRecord connection pool larger than the number of configured Puma threads . Since then Ben Sheldon has pointed out that apps running embedded job workers (for example Sidekiq in embedded mode , GoodJob in async mode or Sucker Punch ) will also be creating extra threads and therefor may need a larger thread pool. In this follow-up post I’m going to describe the technique I used to uncover the source of the connection pool contention for the app I’m working on, and how you can do the same if your seeing mysterious exceptions and don’t know where they’re coming from. These connection timeouts were a long-standing mystery in our app. Although they didn’t happen with great frequency, they were happening often enough to warrant some further digging rather than letting them become another broken window. To figure out what was going on I employed some introspection on the connection pool. Whenever a thread asks for a connection from ActiveRecord, it is assigned one from the connection pool. The connection itself stores a reference to the assigned thread as its . We can inspect the assigned threads in the connection pool to learn a bit more about them:

0 views
tekin.co.uk 2 years ago

Why the advice to have a connection pool the same size as your Puma threads is (probably) wrong for you

The standard advice goes: set your Rails database’s connection pool to have as many connections as you have Puma threads . The idea being that you should only need as many connections as you have concurrent threads. This advice is coming from a good place, as most of the time you will be constrained on the number of connections you have available to your database. The nuance missing from that advice is that it assumes no additional threads are ever spawned during your apps operation! Now although you might know your code inside and out and be 100% certain that you don’t create additional threads anywhere in your code, chances are Rails is creating additional threads without you realising it… On a basic level, the way ActiveRecord’s connection pool works is that it assigns each thread that asks for a connection its own separate connection , which the thread then releases once it’s finished. Using a pool like this means that many threads can be querying the database at the same time, so many more requests can be processed in parallel. If your app’s Puma config sets the maximum number of threads to 5, then you can normally expect there to be at most 5 threads asking for their own database connection, hence the advice to set the pool size to the same as size as the number of threads.

0 views
tekin.co.uk 3 years ago

List your Git branches by recent activity

Even if you’re diligent and regularly delete merged and stale branches you may still find it hard to pick out a particular branch from the alphabetically-sorted output of . How about something more useful, like seeing them listed based on their freshness? The command accepts a option which we can use to list our branches based on the last committer date: We can also use the option to include the exact time and see just how fresh each branch is: Or for something more friendly and easy-to-parse we can ask for a relative date: That’s better! Let’s add this as a alias to our Git config:

0 views
tekin.co.uk 4 years ago

How focused commits make you a better coder

One of the core practices I encourage in developers when joining a new team is shaping changes into small, focused, atomic commits. For folks that are used to committing code in a haphazard, laissez faire manner this is sometimes dismissed as pedantic fussiness: if the code works, it works and that’s what’s important! Well I strongly disagree. Here I want to present a few of the ways taking the time to shape small focused commits help you to be a more effective developer and ship better software. First things first, let’s acknowledge the fact that doing this well does take a certain level of tooling knowledge and practice. That means getting comfortable selectively staging changes ( ) and revising your working history as you go ( ). But once you get the hang of it, it becomes second nature and not doing it will start to feel a bit icky, like skipping test coverage for a new piece of code, or not brushing your teeth before bed. As well as tooling and practice, it also take a level of discipline. That’s because to understand how a piece of work might be delivered as small focused changes, you have to slow down and think about how it could be sliced up and delivered iteratively. This is actually the first benefit in disguise! Figuring out a plan for the work that breaks it down in terms of small, iterative steps is a useful strategy for making a large or difficult problem manageable. I personally do this with a checklist of tasks that I write down before starting a piece of work. I then update and adjust the list as I progress through the work and my understanding grows and changes. The tasks don’t always map one-to-one to commits, but they often do. @tomstuart talks more about this and other strategies for breaking down large and difficult problems in his talk Get Off the Tightrope .

0 views
tekin.co.uk 4 years ago

Why Git blame sucks for understanding WTF code (and what to use instead)

You’re happily working your way through a codebase when you happen upon some code that makes you stop and think: What the…!? Maybe it’s a method that’s doing something surprising. Or perhaps it’s doing something completely unsurprising, it’s just doing it in a surprising way. When this happens you might instinctively reach for to help you figure out what’s going on. After all, gives you the commit that most recently touched the line, and often that’s enough to point you in the right direction. But often it isn’t and you’re none the wiser. That’s because: If you only use you’re limiting yourself to a one-dimensional perspective of the code you’re trying to understand. Wouldn’t it be better to view things in 3D!? Thankfully Git has some pretty powerful search tools built right in. Let’s take a closer look at some of the tools at our disposal. If is entry-level history search, (also known as “the pickaxe”) is how you take things to the next level. It lets you search for all commits that contain a given string:

0 views
tekin.co.uk 5 years ago

Better Git diff output for Ruby, Python, Elixir, Go and more

The regular Git users amongst you will be familiar with the diff output that breaks down into “hunks” like so: The first line (starting ) is known as the hunk header, and is there to help orientate the change. It gives us the line numbers for the change (the numbers between the ), but also a textual description for the enclosing context where the change happened, in this example . Git tries to figure out this enclosing context, whether it’s a function, module or class definition. For C-like languages it’s pretty good at this. But for the Ruby example above it’s failed to show us the immediate context, which is actually a method called . That’s because out of the box Git isn’t able to recognise the Ruby syntax for a method definition, which would be . What we really want to see is: And it’s not just Ruby where Git struggles to figure out the correct enclosing context. Many other programming languages and file formats also get short-changed when it comes to the hunk header context. Thankfully, it’s not only possible to configure a custom regex specific to your language to help Git better orient itself, there’s even a pre-defined set of patterns for many languages and formats right there in Git . All we have to do is tell Git which patterns to use for our file extensions.

0 views