When you inherit a legacy app with no tests, your first step should be to add them. But that can be a huge task! How do you even start? In this article, José will introduce us to a testing workflow called test-commit-revert (TCR) that is particularly useful for adding tests to legacy systems. He'll show us practical examples and help us set up our tooling for minimal friction.
You're doing some currency calculations in your app. It seems to be working well. But after a while, strange discrepancies emerge. The books stop balancing. People get mad. All because the code treated currency like any other number. In this article, Julio Sampaio shows us which of Ruby's number classes are unsuitable for currency, and walks us through better options.
When you're deciding on a technology to use for your project, it helps to have a broad understanding of your options. You may be tempted to build a web service in Go for performance reasons - but what would that code actually look like? How would it compare to languages like Ruby or JS? In this article, Ayooluwa Isaiah gives us a guided tour through the building blocks of go web services so you'll be well-informed.
Sometimes when your app is slow, it's not your fault. Your code might be optimized to the teeth, but it won't matter if it has to perform intrinsically slow tasks, like fetching data from an external API. In these situations, Rails' low-level caching can be a life-saver. But caching is infamously tricky. It's dangerous to go alone. In this article, Jonathan Miles guides us through the landscape of low-level caching. He covers the basics, but more importantly, digs into essential details of cache invalidation and points out common pitfalls.
If I asked you to sit down right now and sort a list of numbers, there's a good chance that you'd intuitively rediscover the selection sort algorithm. It's a simple approach that can have significant performance implications. That's why it shows up so frequently in technical interviews - even though most developers never implement sorting from scratch. In this article, Julie Kent walks us through the selection sort algorithm, builds a working implementation in Ruby, and discusses its performance characteristics.
Few things are scarier than a database slowly losing integrity over weeks or years. For a while, nobody notices anything. Then users start reporting bugs, yet you can't find any code that's broken. By the time you realize the problem, it may be happening for so long that your backups are unusable. We can avoid problems like these with skillful use of transactions. In this article, Kingsley Silas introduces us to transactions at the database level, discusses when they should be considered, and shows us how to use them in Rails.
Let me know if this feels familiar. Your users want to "login with GitHub," so you install a gem, follow the setup instructions, then pray it never needs maintenance because you have no real idea how OAuth2 works. Let's fix that. In this article, Diogo Souza shows us the fundamental concepts behind OAuth2 and how to implement them using Devise and Doorkeeper.
Few things are more frustrating than slow, flaky test suites. You're ready to deploy, wait 20 minutes for CI to run, only to find that a test failure in code you've never touched is blocking you. You dig into the source and find the problem: an external API call. It works (slowly) most of the time. But sometimes the network glitches and it fails. What do you do? In this article, José Manuel shows us several techniques for removing external API dependencies from our tests.
Links are so fundamental to web development that they're almost invisible. When we link to a third-party page, we hardly ever consider how it could become an opportunity to exploit our users. In this article, Julien Cretel introduces us to three techniques that bad actors can use to target our users and discusses how to avoid them.
Lexers are magical. They take your messy, hand-typed, human text, and convert it into a clean data structure that the computer can process. Every time you run a ruby program, use structured search or type in a date by hand, you'll find a lexer hard at work. In this article, Alex Braha Stoll pulls back the curtain to show us how lexers work and how to implement one for a simple programming language.