All posts tagged with 'ruby'

Type checking in Ruby – Part 1
Over the course of a career in software engineering, we learn to love elements of our tooling and dislike others - that’s perfectly natural. As requirements change, including our own need to improve as engineers, so does what appeals to us when reaching for a new framework, language or library. A common path for lots of engineers will have been to learn something like C or C++, both strongly typed… Continue reading

An introduction to object-oriented programming
Object-oriented programming, or OOP, is a programming paradigm centred around the concept of objects. This article will aim to provide a basic understanding of objects, classes, OOP principles and various other concepts within the paradigm. Code examples will be mediated in the Ruby programming language, which is an example of an object-oriented language. In Ruby, any value is an object, even data types like String and Integer, which are often… Continue reading
Titlecase, underscore and laser guns
Not so long ago, I had an opportunity to peek under the hood of titlecase and underscore methods, the tiny cogs of the “Rails magic” machine. The latter turned out to be a very interesting function—a lot of hard-to-follow transformations, secret injections and the like. All of these bits significantly contributed to an odd-looking bug I’ve been working on. Today, we’ll unravel the implementation of both methods and look in… Continue reading

Timecop vs Rails TimeHelpers
TL;DR - You probably can’t replace Timecop with Rails' built in TimeHelpers, as TimeHelpers only recreates Timecop’s freeze method, and can’t handle nested travelling. Timecop is the go-to gem for testing time-dependent code, as it allows you to manipulate the current time during test runs. This is important because without control over the time, flakey tests can emerge in your codebase. A very simple example is testing the created_at attribute… Continue reading

Testing Child Processes in Ruby
I was recently writing a piece of code that we wanted to act as a supervisor of child processes. We wanted to ask this supervisor the following “Hello there, would you mind running this task in a child process? Thanks!”. From here the supervisor would create a process, keep track of it so we can stop it if necessary, and run the given piece of code in it. This supervisor… Continue reading

Breathing New Life into Dormant Code
In the Tax Engineering team at FreeAgent we’re currently working on adding Corporation Tax and Final Accounts filing to our application as we continue our mission to help our customers relax about tax. We’ve been working on these features since June and recently released the Final Accounts report and the CT600 form, but what you might not know is that work on this project originally began back in 2017. So… Continue reading
Down the Ruby Mine, Part III: Splat and splat again
Hello and welcome to another Down the Ruby Mine. I’m Sam, one of the Engineering Interns working at FreeAgent over the Summer and I am here to shed some light on a Ruby language feature. If you’re out of the loop, you may have missed my previous posts which can be found here and here. Today we’ll be diving into the most questionably named Ruby feature out there: splat. Functions… Continue reading
Down the Ruby Mine, Part II: Ruby’s seemingly illogical logical operators
Hello there, my name’s Sam and I’m one of the Summer 2019 Engineering Interns at FreeAgent. As part of my time here I’m writing a series of blog posts on Ruby language features. If you’re a first time Down the Ruby Mine reader then don’t fret, because the posts aren’t dependant on each other. However, if you are interested, you can find the first post here. Today we’ll be exploring… Continue reading
Down the Ruby Mine, Part I: The code insertion trinity
Hey there, my name’s Sam and I am one of four software engineering interns working at FreeAgent over the summer. This is my first time writing in Ruby and I’ve had a great time exploring the language. As developers I believe it’s important to develop a fundamental understanding of the core of a language, even when its supplemented by a feature-rich framework like Rails. Over the next few weeks I’ll… Continue reading
What We Value – Writing Code At FreeAgent
Writing software is hard. The problems we’re trying to solve are generally not trivial. They will have caveats and edge cases. They will rely on unreliable dependencies. The problem may evolve and the solution may need to be tweaked. The solution we’ve carefully crafted might not have taken into consideration something that later seems obvious. The problem might even change entirely. Continue reading