r/learnprogramming • u/No_Ad7719 • 2d ago
How you plan and develop "complex" systems??
Well, I’m fed up with starting projects and leaving them unfinished, whenever things start to get complicated, I just give up.
Usually, when I work on a project, I don’t do any planning. I just start writing code until the pieces come together and make sense.
Just a moment ago, I was working on an inventory system for my game, but I started getting stuck on questions like "how will the inventory update when the server updates the player's inventory?" or "how will the inventory interact with the toolbar?". Things like this cause my brain to freeze up, and I end up giving up on the project, because implementing them at this stage would be a headache
Any tip is more than welcome.
13
u/rsham004 2d ago
You have to design the workflows and sequences. Before you code. Updating data continously and the strategy
18
u/rupertavery64 2d ago
First make it work. Then make it work better. Perfect is the enemy of good.
You'll make mistakes now, and hopefully you will learn from them.
6
u/builders6 2d ago
You hit a wall because you invented the architecture mid flight instead of sketching data flow before touching code. A simple diagram of server state to client state to toolbar UI saves hours of panic later.
5
u/regardedMAGAfascist 2d ago
Half ass the parts causing your brain to freeze up until you can no longer afford to leave them half-assed. Fake it til you make it. Your brain will work on these problems in the time between. Keep things in source control and focus on writing clean code at every step.
2
u/idkfawin32 2d ago
You get a sense for it after a while. The best way to learn is to look at how others have solved the problem before.
2
u/bird_feeder_bird 2d ago
Just make it exist first. You can make it good later.
2
u/aqua_regis 2d ago
Less than 24 hours ago: https://redd.it/1y0cjpb
Less than 48 hours ago: https://redd.it/1xzhj19
The first step would be to invest individual effort in doing your own research instead of just posting and waiting to be served and spoon fed.
2
u/JGhostThing 2d ago
First, plan the program requirements. Don't make them too difficult. Finish programming, then write new requirements.
After the requirements, I use pen and paper and write down data structures that I will need in this program. I use rectangles and lists, and lots of arrows. This is not meant to be seen by anybody else.
Then I use flow charting or pseudo code or diagrams to rough out the program.
Then I write code.
I do not stop. If I think of more requirements, I add them to a new document that will be used for the next version. I do not stop the current version, but I create a plan for the next version. It doesn't matter how much the changes would improve the program, it's still feature creep. Once this version is finished, then I can work on the new version.
All of this is to prevent me from falling into your traps. I'm not saying that I have a perfect work flow, but it works. Choose a work flow and do your best to stick to it. Tell yourself that you won't quit. Once you are employed, you will not have the option to quit at your decision. Finishing projects are important to your development.
2
u/kilkil 2d ago
there's a few things.
first, some upfront design is a good idea. when you get an idea for a feature, write it down. then try to think of edge cases, ways for the feature to break. does it depend on other features. do you know if XYZ is possible (or feasible) to implement with your chosen tech stack. etc.
second, you will run into these issues anyway, because you are not a fortune teller. giving some thought to the design upfront will save you headaches later, but you cannot predict everything. don't get stuck in design limbo, don't accidentally make the same mistakes of Waterfall. so instead, try to do your work in smaller "chunks", which you can later more easily revert if you realize you need to go back and rework something.
third, when you are in the design phase, it is a good idea to try and come up with something called "acceptance criteria". this is basically a checklist of what you want to see as an end result of implementing this new feature. like "when this feature is done, I should now be able to do XYZ". in the acceptance criteria, try not to be too specific about the exact approach you will use to achieve this — ideally, if later on your approach needs to change, your acceptance criteria should be able to stay the same.
fourth, once you have an idea of what the feature should do and what you want out of it (acceptance criteria), it is good for you to try and come up with some checks you can do. for example, say you wrote the feature. you need to try it out, to make sure it works the way you want/expect. try to anticipate what kind of things will you need to check, to see if the feature is working correctly. these are called "tests" (specifically functional tests, and more specifically what I am describing here are called "smoke" or "sanity" tests). this can be super basic, just write down a short list of tests you will need to do.
this is useful to do before coding, because then you will have a more clear idea of what the code should be doing. halfway through implementation you will always run into new edge cases, or come up with new questions and considerations. if you wrote down what the feature is, what it should do, and how it should be verified after completion, it will help guide your thinking during implementation and will help you stay on track. and it will help you think more clearly, when you need to hold multiple considerations in your mind.
2
u/UroborosJose 2d ago
You just described how php devs works
1
u/flawed_finch 2d ago
Architect it as best you can at the beginning. Try to make it modular and get one part working at a time. Stop and refactor frequently for check points.
1
u/roger_ducky 2d ago
It sounds more like you need to practice breaking stuff down.
Inventory system, as an example:
Simplest way is to make the sever track inventory only. All changes to inventory is a request for the server to do it. After that, ask sever what’s in the inventory rather than assume it’s still the same.
1
u/BitterSleep7368 2d ago
Write it down and walk through how each part works in theory before building it. Think about what affects what—for example, whether changes need to be restricted across tables/data, or if something is purely for display purposes. Drawing a quick visualization helps spot patterns and catch mismatched data formats early on. It also helps you think through reusing or copying existing data for another purpose, and how to limit access or writes so another part can't corrupt it. When you have the bigger picture in hand before creating tables, views, or structures, you don't have to rewrite as much when adding something new, and the pieces fit together better as a whole. It doesn't need to be perfect, but having a coherent plan that accounts for add-ons and shared uses makes building it much easier.
1
u/Below-Average-528 2d ago
Break it down into components that each have a clear role, then think about how they have to interact with each other and how data is stored.
1
u/Mango-Fuel 2d ago edited 2d ago
I design the data model as the core of the whole system. that is actually relatively "easy" most of the time. in real-world you may need interviews/meetings to assemble all the requirements and know what the model needs to look like. always keep in mind that it will change and grow later.
once that is captured, implement in code, and provide persistence. (ORM/EF Core makes this a lot easier.)
once that is implemented, start designing CRUD UI for it, and once CRUD is in place, start designing more advanced parts of the UI.
then release to users, get feedback, add new features, fix issues, etc.
well you're bumping into the edge of your knowledge and experience, which is ok, that line is always there somewhere. if you keep your data and UI separate and your code otherwise decoupled, things like this will be easier to manage. it's not easy but you will get better at organizing things like this over time.
if this is game dev then business application design (what I mentioned above) may not apply quite the same. look up Entity/Component/System (ECS) for handing data management in game programming. (Including Data Driven Design. Also recommend following Casey Muratori.)
1
u/Crisn232 2d ago
You should start planning that out. learn how to draw UML diagrams.
1
u/Reasonable_Slide6304 2d ago
there's only so much you can plan ahead and the less familiar the subject the more you just need to guess and be prepared to back track, that's why you should try to write code that isn't tightly coupled so if you need to change something it's not some long chain of stuff.
1
u/No_Report_4781 2d ago
Plan, design, develop, test, start over.
You would be surprised at the utter shitshow some highly complex high tech systems have behind the scenes
1
u/YouPeopleCantBeReal4 2d ago
Endless meetings about corner cases
1
u/Desperate_Dot9434 2d ago
try writing the question down before touching code, one sentence: 'when X happens, Y should do Z
1
u/BrohanGutenburg 1d ago
Same way you eat an elephant.
1
u/MoneySubstantial3391 22h ago
The freeze you're hitting is normal, and it's usually a sign the problem is still too big, not that you're bad at planning.
When I get stuck the same way, I shrink the first version until it has no server and no toolbar. For an inventory, that might be a list on one screen that you can add to and remove from, saved locally. Get that running, and actually finish a session with it. Then add one connection at a time. The toolbar can just be a second view of the same list. Server sync can be a later pass that writes that list out and back in.
I also write the scary questions down, then pick the cheapest v1 answer. "How does the toolbar talk to the inventory?" can be "it doesn't, it's the same data." You can change it once you have something you can play.
The other habit that helped me finish things is a hard cap: if a feature would take more than an evening, it doesn't go in this version. Shipping a small complete slice beats a half-built architecture.
1
u/Fine-Comparison-2949 2d ago
If there was a perfectly prepared solution to create a complex project from a plan, it would already exist. It would be a prompt and an AI could deploy this in 30 seconds, and it would be financialized as a commercial solution.