Hacker News new | ask | show | jobs
by georgieporgie 5398 days ago
Assuming you mean programming professionally (i.e. most of every day), then five years is around the point where you become self-aware and realize your code isn't as awesome as you thought. Also, remember that if you see code published on the Internet, it was probably extremely polished, and likely written by someone who has had quite a lot of experience in a particular area.

By having to maintain my code, I learned to write simple, concise, well-documented code. Nothing teaches you about bad programming practices better than having to maintain your own code after six months or a year away from it. I've also learned that iteration is key to quality. The first time I create something, it's basically crap. By about the third time I've tackled the same sort of problem, I have some pretty good insights, and come up with vastly improved solutions. Of course, people see the output of the 3rd iteration and think I'm a brilliant, insightful programmer, not realizing that -- like everyone -- it didn't happen on my first try.

3 comments

The third iteration thing is exactly what I was thinking when I read this thread. First attempt works, but it's pretty shoddy. Do it again and you get something better but still has room for improvement. By the third it's still not perfect but it's good enough to make you happy you did a good job.

My other benchmark of bad code is that you know it's bad when you have to hack it to add a new feature, and the only way to remedy that is to re-factor most, if not all, of your codebase.

I've had to do this a lot lately because I've not had chance to iterate. I know full well the code is bad. It works but it's not easily maintainable, and since it's in the context of a REST API there's a shitload of code we now have to duplicate - with minor differences - to add functionality I didn't have the foresight to plan from the start.

That of course is also the side effect of being given an entire project to do by yourself while the rest of your team does other things. The insight and assistance from colleagues or team-mates, or even friends if it comes to it, is just as valuable for writing good code. Knowledge has to come from somewhere.

+1 for the having to maintain your own code. I remember looking back at my own code and swearing "what the *$$# was i thinking.."
This is what my boss looks for on résumés. Not loyalty so much as whether you've worked anywhere long enough to have to clean up and rearchitect after your own mistakes, rather than leave an ever-growing trail of (presumably) smoking craters.
I know what I was thinking most of the time: I want to get this thing working and out there as quickly as possible.

Deadlines are probably the root cause of most of the world's most horrific hacks.

Also, I've never once had a boss turn to me and say "you know what, forget about writing any new features for now - just refactor the code that is working just fine but looks horrible."

>Deadlines are probably the root cause of most of the world's most horrific hacks.

I definitely agree with this. I've written some absolutely terrible code in marathon sessions with an impending deadline -- in the worst case, I copy-pasted code in six or seven locations for something that could have and definitely should have been factored out into a function. I just didn't have any time to spare, I had to finish it for a demo in X hours. That whole project was a mess.

100% agreed. Deadlines made me write code that stinks really really bad
"programming professionally (i.e. most of every day), then five years is around the point where you become self-aware and realize your code isn't as awesome as you thought"

yes i have programmed almost every day for the last 4-5 years. and it has been an year or so that i started feeling like this.. may be one reason is that that's exactly the time when i started looking a lot into well written open source code.. starting browsing open sources repo's and trying to understand how they have written code.. and when i understood I was like.. Aaahhhhh!!! that is awesome.. the best way to tackle this problem..