blog.pierrehenry.be

How to Solve Big Problems With Simple Code and AI

C plus plus code in an coloured editor square strongly foreshortened How to Solve Big Problems With Simple Code and AI - Photo by Patrick Martin on Unsplash

All right. So as a software engineer, knowing that the simplest path is usually the best is like wielding Occam’s razor. If you’re not familiar, that’s the principle about the complexity of an approach or a solution. Occam’s razor says that the simplest solution is usually the right one. And when we’re maintaining a codebase, or we need to scale a business, or an application, we’re always looking for different approaches and thinking, “Which one is better?” When we choose the simpler one, it’s easier to maintain, quicker to implement, and we can see with that simpler proof of concept if it actually works. If it does, then we can add more edge cases, more business logic on top. But starting with something simple is the key.

Let’s talk microservices for a second. When each microservice is simple and works perfectly, everything else will be fine. Because everything is simple enough for the business to work in the long term. That means, if you ever need to migrate to a different programming language—let’s say you’re using Python and you need to move to Rust—it’ll be easy enough. Your logic, your models, your libraries, your dependencies aren’t that big. Even if it doesn’t do everything, even if it could be more complete, you chose the simpler solution. The simpler path is always the most ideal one.

Less Is More: Performance, Reports, and User Experience

When you do a performance review, writing less is usually better. No one has the time to read everything. Same goes if you’re a data scientist writing a report with pie charts and business insights. If it’s too long, people will just ask you questions instead of reading it. Even if you wrote it in the report, they won’t read it because it’s just too long. So, something simple and the ability to summarize what you have to write—something concise—that’s the win game.

But here’s the thing: finding the simple path to the right solution is not easy. Simple doesn’t mean easy. It can be hard to find the simple UX for a user. User experience is important. When it’s simple, clear, and makes sense—when you don’t have too many options everywhere—you have to think twice. You don’t want to make the user think, because the more the user has to think, the harder it is. If you want to implement a super simple, elegant solution, something straightforward for the user, you have to think a lot for the implementation.

A Rubik Cube sat on top of a laptop How to Solve Big Problems With Simple Code and AI - Photo by Dean Pugh on Unsplash

And that’s really the beauty of our job as engineers. We have the ability to implement beautiful solutions—something elegant, where we decided to use a simple and elegant user interface and codebase.

Clean Code, AI, and the Cost of Complexity

I used to talk a lot about clean code. Now, with AI, maybe it makes less sense, but less code will always be easier for AI to understand your codebase. It’ll use fewer tokens, so it’ll be cheaper to maintain. The more code you have, the more files, the more tokens your Copilot or your AI-driven code editor will use, and the more expensive it gets.

So, when you choose a simple approach, it’s also about cost. If you have a lot of engineers working on a complex codebase, it’ll take more time for an engineer to understand the whole logic. Same with AI—an agent will have a harder time understanding your codebase if it’s longer and more complex.

That’s really what I want you to think about today. Otherwise, you’ll get stuck in a world where you think complexity is good, because at school you learned that for your essay, your capstone, your project, you need at least 2,000 words. You need something long, because when it’s complex, when you have a lot of writing, it’s good for your score. But in real life, it’s not the case.

The Simple Path Challenge

So, here’s a good exercise: take a fix you’ve already done for a given problem, and solve it again, but simpler. It might be completely different. This kind of exercise forces you to go out of your comfort zone and think out of the box. Even if you thought the solution was obvious, there are countless other ways to solve it. What if you choose something simpler, where you need to change fewer files, where the patch is much smaller? That’s your challenge for the day.

Happy coding, happy AI coding. Don’t hesitate to use an agent or AI to help you. And also, take a walk and think about it: how can you change your day-to-day life into something simpler? Less complexity, less stuff, less is more.

redpine co How to Solve Big Problems With Simple Code and AI - Photo by amin khorsand on Unsplash


Key Takeaways

“Simple doesn’t mean easy. It can be hard to find the simple UX for a user.”

“Less code will always be easier for AI to understand your codebase.”


Pierre-Henry Soria

GitHub · PierreHenry.Dev · YouTube

<< Previous Post

|

Next Post >>

#Ai Development #Entrepreneurship #Occam's Razor #Problem Solving #Simplicity #Software Engineering #Tech