Should I Focus on Code Structure While Learning?

0
2
Asked By TechExplorer42 On

Hey everyone! I've just started the CS50x course for 2025 and I'm really enjoying it so far. I've just wrapped up week 2, where we worked on a project involving an encryption program using substitution. However, I've noticed that my source code for this and other assignments looks pretty messy – it's kind of a spaghetti code situation. It works, but the organization of the code, the variable placements, and my functions feel scattered. I wonder if I should be concerned about how messy my code looks at this point since I'm still figuring things out. Should I prioritize making things work over structuring my code well? I think learning to write better code is a habit that should start now. By the way, could anyone suggest some resources about architectural conventions in coding in case I should start worrying about this?

4 Answers

Answered By DevSavant101 On

All code gets messy naturally over time, and part of being a good programmer is recognizing when it’s time to tidy things up. Take the time to clean up your code when it starts to feel messy. Also, challenge yourself to minimize the number of lines – make it more readable and concise!

Answered By RefactorRanger On

The idea of perfectly structured code is a bit of a myth. It's often better to just get things done and then refactor later. Start with small projects, but plan on refactoring at different stages instead of overcomplicating it too soon. Learning the right architectural practices is good, but sometimes just practicing by refactoring existing code is the best way to understand it!

CodeCritic234 -

True, but don't feel pressured to get it perfect. Just keep experimenting as you learn!

Answered By CodeWhisperer99 On

Nah, you should focus on getting your code to work first. You can always refactor and clean up later based on whatever architecture you want to use.

Answered By SimplicitySeeker On

I think it's fine! If you understand your code and can clean it up a little for your own sake, don’t stress too much. It's normal to be a bit disorganized at this stage.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.