Ben-oni wrote:sourmìlk wrote:How do I know if I'm writing decent code? I think I am, because I understand it and can reuse it easily to do what I want, but that's remarkably subjective. Is there really a way to tell if you don't work in a team?
One simple test is to ask how hard it is to change the code. If the code needs to be altered to do something fairly close to what it currently does, well-structured code need only be altered in a few locations. The more invasive the changes need to be, the worse the code.
What Ben-oni said.
Also, if you can read your code a year or so after you wrote it without dying of embarrassment, it's probably decent code.
And you can always post code samples here and see what sort of criticism it gets.