Why I always start with interfaces

2025-04-28

Front end or backend, Working alone or in a team, I start everything by defining interfaces. I think of this as the shape of the code. It’s the surface area that other pieces will interact with, and it’s the first thing I want to get right. In my experience, I've found that overwhelmingly the most important first step is to get this right.

It's all too easy to get straight into a project and start working on the implementation. It's also the single biggest mistake I've seen happen amongst my peers time and time again. If you were to approach something else, such as building a house. You wouldn't just stat laying bricks. Keeping this analogy, I've seen people start by fitting the kitchen! It sounds foolish, but it happens all the time. Developers get so caught up in the functionality itself that very little thought goes into the bgger picture, then it all falls apart and becomes a nightmare for implementation. If you want to ship code fast and saley, designing clear interfaces is critical.

So, what do I even mean when I talk about interfaces? I like to think of them in a similar way to an API. In the case of front end and backend work, that's exactly what they are. Lets assume for a moment that you have two teams of developers working together ona project. One team for the client dacing front end and another creating the backend functionality to make it all work. Rather than jumoing straight into it. The best thing to do would be to have the teams sit together and look over the project as a whole. They discuss what the requirements are and the expectations that they have of one another. The outcome of this meeting should be an API spec. It's not functional, but both teams have something to work from. The front end team can mock the API and assume that once everything is done, they can plug in the real API directly. The backend team can get to work building functionlity, comfortable that they won't get a last minute curveball requirung drastic re-works. This might seem obvious, but I've seen plenty of times where this hasn't been done and once the time comes to integrate them with one another, chaos.

This same process can be applied internally too. The best teams work together on a single set of features. If the interfaces are clearly defined ahead of time, even if the data itself is fake. Everyone is working towards the same targets and there aren't any nasty surprises when it comes time to do pull requests and merge down branches. This is especially important when working with a large team. If you have a team of 10 developers, and each one is working on their own thing, the chances are that at least one of them is going to be doing something that will cause issues for someone else. If you have a clear set of interfaces, then it's much easier to spot these issues before they become a problem.

My biggest piece of advice, especially to any developer looking to move up to the next level, is to always start with the interfaces. It doesn't matter if you're working on a small project or a large one, it's always worth taking the time to define the interfaces first. It will save you time in the long run and make your life a lot easier. If you're working with a team, it's even more important. Take the time to sit down with your team and discuss the interfaces before you start coding. It will make a world of difference. I promise!