I'm a junior developer from the Philippines and I'm currently hired in a start up company. When I'm coding at my work I can solve most of the problems, but behind my mind I always overthink that maybe the way I was coding is not good even if it solves the problem.
"How easily can your code be removed or changed?" - that's how I would go about it in a broader sense.
I donʼt. And thatʼs good. But…
See also the programmers oath.
That's every good!
Always believe that your code is a piece of crap.
This is why you will keep improving. You never become good, you are eternal student.
As soon as you will say to yourself how good you are, you will stop learning.
Never say or think how bad or good you are. Just keep doing ACTION. Keep practicing, keep developing habits. Real world results of your actions and how people use them determines how good or bad you are, not what you think about yourself or what other people say.
The most interesting part of this approach is that you always will be 100% honest with yourself and others even when your code really will be piece of crap.
First of all, you aren't overthinking. If anyone blames you of that, besides yourself, they're underthinking.
There isn't a day that goes by that I'm not picking at my own code. I'm a 20+ year pro, and I still take introductory HTML5 courses - and guess what - I still learn at least one thing I either forgot, didn't feel the need to remember, or never knew in an ever-changing industry.
CSS Grid is a wonderful example of what I chose to embrace immediately after learning it, but am very hesitant to use it on certain projects. Flexbox was never added to my list of something I'd end up using for any project, but at least I know how to use it correctly.
One of the best sites to browse through, would be Codepen.io. Not everything there is perfect, or even completed, but there are some pens that you will want to fork and sandbox yourself. Check it out when you have a chance.
Here's my collection of pens, which i'll poke around with often, without worrying about getting it perfect. It's a sandbox, so have fun experimenting like I have.
I personally don't think it's really possible to write good code. it's many factors.
And every developer will pick his favorites. The main thing you have to to do is to argue why you did it in that particular way.
And in a company maintainability usually is one of the most important parts.
But yes clean code, clean coder, the pragmatic programmer are good starting points. Just don't get religious :)
Like Mirko said, you’re asking the right questions and have the right attitude to the job. Only when you’re questioning your own code then you’re getting better.
People who think they actually wrote the most lit’ code ever ever... well it’s the fastest way to get outperformed by others.
First, I like the way you think. I'd like I had more developers asking that question. Then, just a 2 short suggestions that are by no means a complete answer:
Less is more.
Ujjwal Kanth
Search @Unbxd
I think everyone has covered pretty much every aspect of it, so I am not going to tell you what to do, or how to think about code etc. I will share an anecdote though.
Back in the days when I was just starting off as a developer, I used to lurk around in IRCs. I was always on the lookout for polite experienced developers who would help me.
One time, I wrote a small todo list app in Go. Everything was working as expected, however I had no idea it had major SQL injection issues. I asked a guy on #go-nuts IRC to review my code. Lo and behold he gave me advice starting from modules in code to SQL injection possibilities to variable naming etc.
He helped me where I was wrong and what I should do to make things better.
To this day, I follow that practice. I find people who won't mind helping me, and ask them to review my code. There is still tons of things we can learn simply by sharing ideas and helping each other.
Moral of the story: Just ask. We will help you.