HM NayemHM Nayem
All blogs

Turning messy business logic into clean software

·8 min read

A lot of software work is not really about software. It is about taking a messy human process and turning it into something a computer can run reliably. That process usually lives in someone's head, or it sprawls across a chaotic spreadsheet. Turning it into clean software is one of the most valuable things an engineer can do for a business, and one of the least glamorous. I have done it enough times to know exactly where it goes wrong, and it is almost never in the code.

The real work is understanding, not coding

When people picture this kind of project, they picture the coding. The coding is the easy part. The hard part is understanding the process well enough to encode it. The process as described is never the process as it actually works. There is always a gap between what people say they do and what they really do, and that gap is where every failed version of this project lives. The engineer who rushes to build from the first explanation will build the wrong thing correctly. The one who takes the time to understand the true process will build the right thing, and the code will feel almost incidental.

Messy processes hide their real rules

A human process that has grown over years is full of hidden rules and quiet exceptions. Nobody thinks to mention them. To the people doing the work, they are just obvious.

When I rebuilt the quoting system for an outdoor lighting company, the process looked simple from a distance. Measure the job, produce a quote. Underneath, it was anything but. The pricing depended on slopes. It depended on different geometric shapes of roofline. It depended on many material variations, each with its own rules, and all of it lived in the experienced heads of the people who did it by hand. None of that complexity was in the original description of the task. It came out only through patient digging. The real rules of a messy process are always the ones nobody bothers to say out loud, because they are too obvious to the people who live inside them.

Talk to the people who actually do the work

You cannot learn the real process from the person who commissioned the software. You learn it from the people whose hands are on it every day. For the lighting company, that meant sitting with the installers, the manager, and the manufacturer. Each of them held a piece of the truth the others did not.

Another project made the same point. I rebuilt the operation of a manufacturer that ran its entire business on one enormous spreadsheet touched by fifty salespeople. Understanding the real process there meant understanding how those fifty people actually used the thing, including all the informal workarounds they had invented over the years. The people doing the work are the only reliable source of how it really works. Skip them, and you will build software for a process that exists only in a manager's imagination.

Model the truth, not the spreadsheet

Once you understand the real process, there is a temptation to simply recreate the existing mess in software. You build a nicer version of the spreadsheet with all its quirks intact. That is a mistake. The spreadsheet is not the process. It is one messy representation of the process, full of accidents and limitations that exist only because a spreadsheet was the tool available.

The job is to model the underlying truth of how the business works, cleanly, and then build the software around that truth. Sometimes understanding the real process reveals that half the complexity in the old system was never necessary, an artifact of the tool rather than the business. Modeling the truth instead of copying the artifact is what turns a migration into an improvement.

Ship the simple version of the complex thing

The final skill is restraint. Once you understand a genuinely complex process, you could build a genuinely complex system, and it is tempting to build all of it at once to prove you understood it. The better move is to ship the simplest version that solves the most painful part first.

For the spreadsheet-run manufacturer, the first release deliberately handled only the features that would make their daily life easier immediately. It left the rest for later, even though the full picture was far larger. Understanding the whole complexity is what lets you choose which slice to ship first. The goal is not to demonstrate how complicated the problem is. It is to make the complicated problem feel simple to the people living it.

Trial and error is part of the work

Shipping the simple version does not mean you are done. It means the real testing can begin. Every implementation goes through a long trial-and-error session before anyone should trust it. You run the actual business through the system, watch where it disagrees with reality, and correct it. Then you do it again.

This stage is not a sign that something went wrong. It is the normal, humbling part of the job. A messy process encoded slightly wrong can quietly cost money, and it will not announce itself. A quote that comes out a little low on one roofline shape looks fine on the screen and loses margin on every job that uses it. So you test the system hard against real cases before you rely on it, and you keep testing until it stops surprising you.

Trial and error is also how the last hidden rules finally surface. The rules nobody said out loud in the interviews tend to show up here, at the moment the system produces a number someone knows is wrong. When an experienced salesperson looks at an output and says that is not right, you have found another rule that lived only in their head. You encode it, run the business through again, and watch for the next disagreement. The system earns trust one corrected case at a time.

Tools and integrations, or custom code

There is a real choice in how you automate a business process, and it is worth making on purpose. Sometimes a single no-code workflow-automation tool can handle a large part of the business. When the workflow is standard, that is genuinely the right call. It is fast, it is cheap, and there is no code to maintain.

But sometimes it does not stay that simple. One tool becomes two, then a handful, each patching a gap the last one left. You end up with tool after tool and integration after integration, stitched together, brittle, and hard to reason about. When something breaks, the failure is spread across five services that were never designed to know about each other.

That same thing can often be solved more simply with custom code. Everything runs under one dashboard, with complete control, and the whole flow lives in one place you can reason about. Custom code can also reach down to a low level and automate things no off-the-shelf tool exposes. The parts a business considers too odd or too specific to automate are often exactly the parts custom code handles well.

Neither side is the rule. It is a trade-off. No-code tools win when the workflow is standard and you want speed. Custom code wins when you need control, when the integrations start to pile up, or when you want everything under one roof. The mistake is picking a side out of habit instead of looking at the actual workflow in front of you.

Why this is worth so much

This work is valuable precisely because it is hard in a way that does not look hard. Anyone can write code. Far fewer people can sit with a confusing, human, exception-riddled process, understand it more deeply than the people who run it, find the clean truth underneath the mess, and turn that into software that makes a business dramatically faster.

When I did this for the lighting company, hand-measured quoting that took real time became a few clicks. When I did it for the manufacturer, research that ate hours a day dropped to seconds. Neither result came from clever code. Both came from understanding the mess well enough to replace it with something clean. That translation, from human chaos to reliable software, is where a huge amount of the real value in this profession lives, and it is almost entirely a thinking problem wearing an engineering costume.

HM Nayem
Founder @ Stack Learner · Director of Engineering @ Toptal
Work with me
Newsletter

Notes on building things that last

Occasional writing on product, engineering, and building a company, sent when I have something worth saying. No noise.

No spam. Unsubscribe anytime.