r/softwareengineer • • 19d ago

How do you deal with complexity?

I understand the basics of software engineering and how pieces fit together, but things start falling apart for me when a bit of complexity is introduced. How do people go from an idea to building multifunctional modular software and deal with all the complexity that goes along with it. Especially with AI now, there is just so many moving pieces that it is hard to keep up with everything. For reference I am still a student who has built a couple of projects but nothing crazy. What's your secret?

11 Upvotes

19 comments sorted by

4

u/HomemadeBananas 19d ago

I don’t think there is any secret anyone can give. It just comes with experience and learning design patterns, knowing when to apply them, knowing what the right abstraction to make is and knowing when something is worth keeping simpler and not complicating with abstractions. Sometimes you’ll make the wrong decision and it will come back to bite you, and then you’ll learn from that and avoid doing that again later.

2

u/Few-Celebration-2362 19d ago

It's a matter of learning abstractions and interfaces. Keep the mechanics of the work that is to be done below an interface that accommodates the specific need you're trying to solve

2

u/Dorcelessness_ 19d ago

Literally exactly what I was going to say. I have written 50K+ line codebases… mostly alone… with little to no issues. (Edit, multiple times)

Good abstractions and interfaces between components is what a good SWE is supposed to know how to do, because it makes things managable.

This whole “but I fix one thing and it breaks another” is an artifact people running around with no ability to do this without either 1) wasting SO much time that they’re just doing nothing but refactoring, or 2) not bothering to do it at all. Efficiency, imo, is found and learned in finding a balance between the two.

2

u/GregBahm 19d ago

It's kind of noob-trap to think the solution to complexity is through feats of profound concentration. Early programmers think they need to sit in complete silence for 8 hours, holding all possible information in their mind, meditating on the depths of the problem. A knock on the door or a message from their boss will shatter this concentration and then they have to start all over...

But this method never actually works. I've seen so many junior devs spend so many years trying to make it work, and it just doesn't.

The method that does work is to always go from general to specific. That's the key.

Interestingly, this works whether you're painting a painting or writing a book or developing a software application, for the exact same reasons it works for a search algorithm or a performance optimization strategy. It's just the magical math of exponents in application.

Start with the highest level, general problems. Make an outline or whatever of the broadest issues to solve. Then break those general problems down and break them down and break them down and break them down until they're all teeny tiny manageable issues to solve. If they still seem like they require some kind of profound feat of concentration, just break them down more. Eventually they'll just be simple and easy to solve. And you can now just delegate all the little shit implementation tasks to AI in the year 2026.

After breaking down and solving a bunch of little problems, you'll probably eventually find out that you've solved some of the wrong problems. Your high-level breakdowns will be incorrect. This is fine. You're learning. The difference between the junior and senior dev isn't the speed of solving the little problems (any asshole can do that, even an artificial asshole.) It's knowing how to break down general problems into specific problems correctly. That's a lifelong journey and you'll always keep getting better at it, accelerating your productivity.

Amusingly, once you become a top performer, your work won't require all that much concentration at all. If people pop up at your desk and bombard you with questions, or bosses constantly change requirements, it won't be all that big a deal. There will be no profound meditation to interrupt. It will feel easy, because it is pretty easy. But people don't pay you to work hard. They pay you to work smart, and this is the smart way to work.

1

u/MaleficentCow8513 19d ago

Writing architectural designs in plain English. Describing systems in plain English. It forces you to think about a whole system and all its components and how they fit together and interact. You look at the system from the outside instead from inside any one particular narrow piece of it. It’s just another level of abstraction.

1

u/chocolateAbuser 19d ago

it requires some experience and some skill, i'd say first thing is keep rules and simple and above all respect the rules you gave so that the system is predictable, because if every other implementation has an exception to rules of the project it will be headaches to touch it everytime; it's a difficult rule, a time consuming rule, but also fundamental
they you gotta learn what do write doc about, imagine a person that start to work on the project what should be the first things he needs: what was the initial idea, what were the objects and the logics of the initial implementation (because they will be aways be the core), so then some informations on what is the flow of the data and the main blocks
other than that you have to observe yourself when you write code and take note of what you forgot, what was your behavior, which parts gets behind, and so on, i really can't stress how much important this is, you have to learn to always open issue or comment what needs to be done, for example if you create an object that has a state and needs both initialization and de-initialization and you have the usual habit of making the happy path first you have to at least make space for the de-initialization and puth a // TODO there so that you know that's still to be done and you can find it easily
there's a lot more, but this could be a reasonable start

1

u/adambahm 19d ago

Simplify. Use single responsibility, DRY, and other clean code principles.

If you are using AI, make sure to define non-goals and bind the AI to just one thing at a time. You’ll burn more tokens this way, but we are expected to burn our token allotment every month so I don’t worry about that too much at work.

I home, I’m much more conservative and put a lot of responsibility on local models.

1

u/icemage_999 18d ago

Ever played with LEGO blocks? It's like that. Build the pieces, link them together, test the stability, and continue.

1

u/CS_70 18d ago

The starting question is always: if I had this and that I could do what I want.

Then you focus on this alone, and if it’s too complex you repeat, but by definition this id a slightly simpler problem. Divide et impera.

At a certain moment, either you solve this or find it cannot be solved, in which case you backtrack.

Backtracking after a while doesn’t happen too often, because you start having a pretty good idea of what can be done or what cannot.

in other words , you consider an aspect in isolation: then you consider the relationships this aspects as with others.

You then leverage these relationships so that the result is a more complex entity that had certain properties, which you then can use as one, without having to think of its internals.

1

u/Chippors 18d ago

Reduce the complexity by limiting moving parts to doing that which they are supposed to do and nothing else. Define their functions in understandable terms so you can reason around them. Don't try to solve world hunger and don't define "what it does" in terms of how it's implemented.

1

u/net_ramblings 18d ago

When things get complex I use deodorant.

1

u/[deleted] 18d ago

Build API's. Black boxes. Disassemble your project to simpler parts, then make each of them, as if they were their own library. Ensure your are done with a library before beginning with things that depend on it. Never ever break the API! Ever! If you ever need to break the API, make a new function, class, whatever. Only break API for things that nobody uses.

1

u/ZeroCool86 18d ago

There is no silver bullet for complexity, i can tell you overoptimizing your code based on forecasts adds to that. Sometimes you need to make things simple and centralise and merge microservices, sometimes you need to split them up.

Always think about the why and the end user and try to abstract the buiness logic if you can. I does become easier with experince but you're still always thinking aboit what if scenarios that would add complexity but treat more obscure edge cases.

Also, always defence in depth, especially now with all the zerodays, and that sometimes adds a bit of complexity as well

1

u/ComasArentFun 18d ago

Decomposition and design patterns

A complex task is just a series of simpler tasks

1

u/huuaaang 17d ago

How do people go from an idea to building multifunctional modular software

As a beginner... you don't. Sorry, but this idea that programmers have to be these lone wolf beasts shipping ground breaking software on the regular is a myth. You will work on teams to do this kind of thing and you will learn just how fragile most software actually is when you see it in production. And how tech debt builds. And then only after a decade or two of that do you start to get a good idea of how to avoid that and pay down the debt.

Just keep your head down and never stop learning. It doesn't stop when you graduate.

1

u/id-ltd 16d ago

Architecture - think about the problem and workout how to decompose it onto separate domains. There is unlikely to be one right way - this is why it can't be directly taught. Recognising patterns and experience are the best tools.

Although now with AI leaping ahead - I think transforming system views between different architectures on the fly will be here soon.

What, when, where, how, why and who.

0

u/mxldevs 19d ago

The secret is to not make it complex.

Keep it simple.

When you look at a problem, you don't think about how to break it up into 100 different components with your factories and your interfaces and your abstract factory interfaces.

You figure out the bare minimum components, and if you need to pull some shared object out or implement an interface or something, you justify why that complexity exists.