I was watching Bob Ross paint some "happy trees" tonight, and I've figured out what's been stressing me out about my code lately.
The community of folks here and on Stack Overflow seem to reject any whiff of imperfection. My goal is to write respectable (and therefore maintainable and functioning) code, by improving my skills. Yet, I code creatively.
Let me explain what I mean by "coding creatively":
- My first steps in a project are often to sit down and bash out some code. For bigger things, I plan a bit out here and there, but mostly I just dive in.
- I don't diagram any of my classes, unless I'm working with others who are creating other pieces in the project. Even then, it certainly isn't the first thing I do. I don't typically work on huge projects, and I don't find the visual very useful.
- The first round of code I write will get rewritten many, many times as I test, simplify, redo, and transform the original hack into something reusable, logical, and efficient.
During this process, I am always cleaning. I remove unused code, and comment anything that isn't obvious. I test constantly.
My process seems to go against the grain of what is acceptable in the professional developer community, and I would like to understand why.
I know that most of the griping about bad code is that someone got stuck with a former employee's mess, and it cost a lot of time and money to fix. That I understand. What I don't understand is how my process is wrong, given that the end result is similar to what you would get with planning everything from the start. (Or at least, that's what I have found.)
My anxiety over the issue has been so bad lately that I have stopped coding until I know everything there is about every method for solving the particular problem I am working on. In other words, I have mostly stopped coding altogether.
I sincerely appreciate your input, no matter what your opinions are on the issue.
Edit: Thank you all for your answers. I have learned something from each of them. You have all been most helpful.