r/learnprogramming • u/Alpha4R • 19d ago
When do I look at alternative solutions?
Hello guys, I'm currently just learning C for FUN, no AI, just giving myself a hobby to see how good I can become. My way of learning right now is just start to make projects from a C github repository.
So I finished the first project, no googling, just from sitting 10 minutes staring and thinking, and yes it's because I feel like AI and looking up an answer melts my brain and doesn't allow me to think.
MY QUESTION IS, I have now completed the most basic first project, it does what they want it to, and I'm following the rules of what they said I can't do, but do I look up the solution of it now to see the "correct" or clean way of doing it. Because I know my code isn't following best practice, or do I just go to the next project?
2
u/Rabbit_Brave 19d ago
Review and compare first. It's important to get feedback while it's still fresh in your head.
1
u/bird_feeder_bird 19d ago
Compare, note improvements, the move on to the next one. There’s no better feeling than figuring stuff out on your own, and realzing how to implement the improvements you learned.
1
u/Key_Storm_2273 19d ago
It’s up to you, you’re the one calling the shots.
I’ve been learning C and C++ too recently. Being an experienced programmer, I’m not really following any “must”s or “should”s besides one (being careful about memory-unsafe operations).
So far, I’ve found C is quite different from more modern programming languages, namely there being operating system specific preprocessor macros. But it’s also similar to Go, with structs, pointers, and no classes (but also no direct interfaces, unlike Go).
The hardest part appears to be actually understanding the build process. Because in Go, Java, JavaScript and many others, you have a very straightforward build system to handle your dependencies <script src=…, <dependency></dependency>, go mod tidy), whereas in C, you often need a Makefile or a CMakeLists.txt. That’s been the biggest new thing to learn for me, also I figured out how to do header-only in C/C++.
Having worked on a project for 1-2 weeks in C, it’s gotten more fun. I first try to learn how to do the thing, then rewrite it to be more tidy and understandable later.
1
u/Traditional_Vast9419 19d ago
Get feedback after you finish implementations yourself. Keep the feedback sparse enough to keep yourself problem solving. Your conscience will feel guilt when you request feedback before you're ready for it, but when you are ready, take it as a reward. Follow your conscience.
1
u/Available_Safe1818 17d ago
It's fine. Don't spaz out over it.