Systems | Development | Analytics | API | Testing

February 2022

Patterns and Anti-patterns in Node.js

Node.js is a backend JavaScript runtime built on Chrome's V8 engine that's asynchronous and event-driven by nature. It's relatively simple to create a REST API with Node.js and use frameworks like Express.js. With this simplicity comes a lot of flexibility. However, you can get side-tracked on what patterns to follow when building scalable network-driven applications. This article focuses on some of the patterns and best practices to follow when building Node.js applications.

Dependency Injection in JavaScript: Write Testable Code Easily

I struggled with two aspects of software development as a junior engineer: structuring large codebases and writing testable code. Test-driven development is such a common technique that is often taken for granted, but it's not always clear how code can be made fully testable. I remember reading examples where an author would cleanly unit test a function, and in principle, it made sense. But real code doesn't look like those examples.

Delayed Job vs. Sidekiq: Which Is Better?

Most applications need background jobs for mailers, regular clean-ups, or any other time-consuming operation that doesn't require a user to be present. Several gems support job queues and background processing in the Rails world — Delayed Job and Sidekiq being the two most popular ones. In this post, we will take a detailed look at Delayed Job and Sidekiq, including how they fare against each other. Let's go!

An Introduction to Deno: Is It Better than Node.js?

Deno is a JavaScript and TypeScript runtime similar to Node.js, built on Rust and the V8 JavaScript engine. It was created by Ryan Dahl, the original inventor of Node.js, to counter mistakes he made when he originally designed and released Node.js back in 2009. Ryan's regrets about Node.js are well documented in his famous'10 Things I Regret About Node.js' talk at JSConf EU in 2018.

Functional Programming in Elixir with Witchcraft

While Elixir is a functional programming language, it is different from most of the other popular functional languages like Haskell, Scala, OCaml, and F#. Elixir pragmatically handles concurrent systems with high fault tolerance. In other words, Elixir is an FP language because this naturally fits it, and not for its own sake. So, porting idioms blindly from Haskell to Elixir can lead to undesired results.

How to Keep Database Table Sizes Down and Prevent Data Bloat

Most web applications use a data store of some kind, often a relational database. When a web app becomes successful, it can become all too easy to start "hoarding" data in the database. But hoarding data leads to the unbounded growth of database tables (both row count and stored data size). While this works fine to a certain point, it is very useful to prevent some data bloat — or, if you cannot prevent it, to plan for your infrastructure ahead of time to adequately manage growth.

Use Streams to Build High-Performing Node.js Applications

The moment you type something on a keyboard, read a file from a disk or download a file over the internet, a stream of information (bits) flows through different devices and applications. If you learn to work with these streams of bits, you'll be able to build performant and valuable applications. For example, think of when you watch a video on YouTube. You don't have to wait until the full video downloads.