Posts

Mar 14 2020

Monkey Patching Modules

It is easy to get in the isolated TDD groove and implement a bunch of well-tested methods. Once it comes to utilizing these methods, we get excited and just go for it. We forget the bigger picture and proper decoupling principles.

Mar 10 2020

Lodash FP

Although an avid user of Lodash, I have not really touched the Lodash FP module. I thought that it was not too different than the set of original functions. After noticing an annoying amount of repetition in my code, I decided to peek into it.

Mar 07 2020

From Promises to Fluture

Today I was a little adventurous and decided to look into alternatives to JavaScript Promises. They are a fine pattern, but I thought it would be cool if I added some functional to the mix.

Mar 01 2020

Authentication with Higher Order Functions

I have a small Express.js side project that I occasionally pick up. I just got to the point where I need to enforce authentication over several routes. I implemented a simple higher order function (HOF) that loads an authenticated user into the req object.

Feb 13 2020

Isolated Testing in OOP

We’ve all seen it – heavy reliance database fixtures in unit tests. It’s not uncommon to find a unit test consisting of five or more fixtures as setting up for your “unit” test. While it is a good idea to have database transactions in some of your tests, surely they should not be in all of them. And surely not five or more fixtures in a single test. After writing one of these monstrosities, you may walk away with the feeling that this doesn’t seem very isolated. I know I do. After all, unit tests ought to be isolated right?

Jan 31 2020

Is it “Decoupled” or Decoupled?

When implementing separation of concerns, there are many ways to skin a cat. Code can be split, decoupled, and moved around in many different ways. However, not all decoupling is equal. Some can lead to great design, while others may lead to a good deal of technical debt.

Jan 11 2020

Emergency Shutdown Script

Here is a little script I wrote this morning. They’re probably a dime a dozen, but I wanted to share in case somebody needed it.