Archive stories

L for Liskov Substitution Principle

Coding

Derived classes must be substitutable for their base classes. Robert C. Martin Welcome back to the series on SOLID. By now, I’ll assume you’ve read my earlier post on the Open/Closed Principle. This principle is quite an obvious principle. I’m going to use the time-and-time-again Duck example below. Think: If it looks like a duck, swims […]

O for Open/Closed Principle

Coding

You should be able to extend the behavior of a system without having to modify that system. Robert C. Martin Welcome back to the series on SOLID. By now, I’ll assume you’ve read my first post on the Single Responsibility Principle. That is, each class should only have one responsibility (or a class should have […]

S for Single Responsibility Principle

Coding

A class should have only one reason to change. Robert C. Martin I’m going to start a five blog post journey about the five principles behind SOLID. I’ll describe these in my own words and give examples of what breaks the rule and how to fix it. Now, what I’m not going to prescribe, is […]

What IDE Do You Use?

Coding Strategy

I’m curious to know what IDEs people out there use. But before anyone tell me what their IDE of choice is, I’ll give you mine and how I work. An IDE is a very personal choice, I think. I mean, at my current company we have people who use wildly different IDEs even for the […]

Using Swagger to Auto Generate Your JSON Objects

Coding

The title is a lie. You need Swagger to be able to generate your JSON objects, but it’s not what will generate your objects. At Agoda, we use autorest, but our package (autorest) to generate our API calls. That’s because we wanted to use a library called SuperAgent in our client-side code. This generates our API […]

Using React-Redux-Forms

Coding

The main reason you could say we moved to Redux was validation. We didn’t want to add a whole lot of code to our page components to validate every child component. In some components, we had up to ten fields, and all of them had to be validated. Can you imagine the size of the […]

Migrating to React-Redux

Coding

You don’t need Redux Repeat after me, “I don’t need Redux”. Seriously, you probably don’t. We didn’t need Redux in our SPA until we started adding more complicated forms with complicated validation. You can easily get away writing a React SPA without Redux. The state can be managed at a page level (or higher if you […]

Jest, React, and Mocking

Coding

Are you stuck with Proxyquire or Sinon? Before we moved to Jest, we used Karma with Mocha/Chai. These come with no built-in mocking capabilities (as far as I’m aware). If you’re a C# developer, you know all about the different Mock frameworks (e.g. Moq), and you want to be able to do the same with […]

Starting with React

Coding

This isn’t meant to be a guide on how-to React. I just want to share some of what I’ve learnt during my time working on a Single Page App (SPA) for my current company. We’ve made a lot of mistakes, and we’ve learnt from them. So, this post may not be perfect. If you find […]