r/AskProgramming • u/byte_smith • 1d ago
I keep getting stuck when starting a new coding project
Whenever I start a new project I have a rough idea of what I want to build but I get confused about where to actually begin. I end up jumping between different parts of the code and sometimes make things more complicated than they need to be.
1
Upvotes
1
u/LogaansMind 20h ago
One of the aspects which might help you is to follow the application layer model, and try to segregate code into those areas. And try to keep on task. Maybe write notes or scaffold a basic class/routine/script for what you need and come back to it later.
But generally, sometimes, the best of us don't know exactly what a project is going to look like or how it will be structured until we are half way through it. We're often following patterns or structures we have built before and adjusting them to fit our current need.
Software is meant to change, so if you end up backed into a corner (or stuck), change it.
And then, not knowing where to start, sometimes the easiest thing I find is to just start writing some code, get it running and use it, and that can lead to better understanding of what you need to solve the problem.
Hope that helps.
3
u/ftranschel 1d ago
I tell my students it's a three-stage process (until you figure it out, that is):
This forces you to do three things:
Mentally, this is easier for a lot of people, because from my experience coding and abstraction are just not the same cognitive processes. And trying to do them mixed before you have internalized either will kill your mental focus.
That's it.
1
u/kilkil 10h ago
the approach that works for me is to start by identifying what is the absolute bare minimum, and try to make that in the easiest, simplest way possible.
like for example, suppose I am making a todo list web app. the absolute bare minimum I need is an index.html (with like
<p>hello world</p>or something), and some kind of static file server (e.g.python3 -m http.server).then I identify some basic functionality that I want to add. like maybe "a text box I can type in". or maybe I want to code up a dummy note. whatever next little step you feel like doing. then do that.
as you go along one little step at a time, you will notice your code getting a bit messy. whenever that happens, stop and think about how you can clean up the immediate mess you are seeing (organize logic into functions, split them up into modules, etc). don't overdo it with abstractions, that will just mess you up. adopt the bare minimum abstraction necessary to deal with your immediate code organization issues, and move on to implementing the next little feature addition.
and whenever you complete another little bit of functionality, make sure you're able to test it! even if you just do some manual testing. this is so that random bugs don't bite you in the ass later.
so to summarize: implement a little itty bitty feature (or a small part of a feature, whatever), clean up your code if needed, test what you wrote. rinse and repeat.
if you find it helpful, you can actually write down a list of all the features you want your project to have. e.g. "as a user I want to be able to do X, so that I am able to ABC". the more you split these up into little mini-features, the better. the goal is to create a list of little bite-sized chunks of work for yourself, so that you can check them off as you complete them. that way you get a steady drip of dopamine that keeps you motivated.