Perfect code

As developers, there's this idea of writing "perfect code". Code that is self-explanatory, concise, maintainable, looks good, and has 0 bugs. I think this is something we all strive for on some level.

And as a beginner, it's especially easy to feel that the code you're writing is the opposite. You might be wondering about best practices, if you're doing things in the right way, and always having the feeling that your code could be better.

The problem is that perfect code doesn't exist.

Yes, some code is more maintainable and easier to read than other code. But as a beginner, this should not be your biggest worry. The code doesn't need to be maintainable if you're creating a TODO app as a learning exercise. Of course you should try your best to write readable code, but writing bad code is one of the ways we learn how to write good code.

As a beginner, it can be hard to judge a piece of code objectively, to decide if it's "good" or not. This is expected - you're still learning. The only way to realize what code is bad, is to actually face the problems that bad code creates. If you try to write your TODO app in a "perfect" way, you will get hung up on technicalities that are way less important than actually building and completing the project. You will get paralyzed with choices that don't actually make a difference right now.

Make the mistakes. Write "bad" code that is hard to read, or breaks in unexpected ways. These problems will make you realize what you need to do to improve your code in the future, and IF you even need to.

To round out, there's a famous tweet by digital nomad Pieter Levels, who's making $100k per month from a single index.php file (aka what most people would call "bad code practice"). Really puts things in perspective!

remoteok.io is a single PHP file called "index.php" generating $101,101 this month. No frameworks. No libraries (except jQuery)💖 (SGD 123.4k=USD 92k) + (USD 9.5k in ads)