katafrakt’s garden

Just my website. Some Elixir, some Ruby, some more exotic languages and general thoughts on tech.
https://katafrakt.me (RSS)
visit blog
Booleans Are a Trap
8 Nov 2024 | original ↗

As developers, we love our booleans. They map perfectly into how computers work at a low level and play nicely with if statements, our primary control-flow tool. They are simple to reason about. What's not to like? We actually like them so much that we use them for domain modeling. And that's where things get problematic. I would like to show you...

Chekhov’s gun principle for testing
31 Oct 2024 | original ↗

It’s not an uncommon notion that writing tests is more of a storytelling task than a technical one. Most recently I encountered it in The Bike Shed podcast, but you can find blog posts and conference talks about it as well. And if it is a storytelling act, perhaps we should look into narrative principles to make our tests better? One of the first...

Mruby: Errors in Ruby code and how to find them
5 Oct 2024 | original ↗

In the article about using mrbgems we had a situation when ARGV constant was not defined, but referenced. As a result the code execution failed (the side-effects were not produced), however it did that completely silently. No error message was emitted. And even the exit code was zero. This is obviously bad. So I set to fix it. By examining mruby...

Mruby: Beyond “hello world”
4 Oct 2024 | original ↗

In the last article , I took an initial look at mruby: how to install it using asdf, how to execute a simple code and how to build a standalone binary from a Ruby source. Now it’s time to try to look further and build something more complex. But first, let me just acknowledge how really basic the mruby is. It supports almost all Ruby syntax...

Lightweight introduction to mruby
24 Sept 2024 | original ↗

I knew that mruby existed for a long time. I knew it’s a lightweight version of Ruby, designed mostly to be embedded in other programs. I knew that DragonRuby has some kind of relation to mruby - be it written in it or using some kind of fork of it. But that’s pretty much it. Prompted by a few discussions here and there lately, I decided to take...

This post is written in org
13 Sept 2024 | original ↗

Recently I found myself doing more and more things using org-mode. Not surprisingly, I also wanted to use it to write articles here. With some time on my hands this weekend, I decided to give it a try and see how hard would it be to add org support to BridgetownWhich this blog uses as an SSG.Even though Bridgetown supports adding own formats via...

Checking Efx - testable effects for Elixir
1 Jul 2024 | original ↗

Mocking in Elixir is always a hot topic, mainly because of people coming from different other technologies having different expectation. The most “cannonical” solution, Mox, gives a lot of security with regard to what the fake implementation returns, but requires a bit of a ceremony from the programmer. Other solutions like Mock, Rewire or Bypass...

Improving upserts in Ecto and PostgreSQL
3 Jun 2024 | original ↗

Upserting is a very useful technique for working with databases. One of the most common use cases is when you are mirroring data from a different data source (different database or an API, for example) in your application’s local database. Ecto supports it quite well and has a dedicated section of its documentation about it. However, I found this...

Reconfiguring your application live with dRuby
7 Jan 2024 | original ↗

dRuby is a pretty old but relatively unknown part of Ruby standard distribution. I first wrote about it here in 2018 and I have to admit that to this day I haven really found a production use case for it. However, I still think it a gem worth knowing, even if only to impress you Ruby friends on a conference afterparty. To demonstrate what dRuby...

Functional domain modeling in Elixir
23 Oct 2023 | original ↗

In this blog post I want to explore how using techniques from functional modeling can improve the code written in Elixir. We will see if this way we can avoid some common pitfalls often met in Elixir codebases that lead to convoluted code and, especially, to overly complex (and slow) tests. For the purpose of this, we will be implementing the...

↑ these items are from RSS. Visit the blog itself at https://katafrakt.me to find other articles and to appreciate the author's digital home.