Live data from Hacker News

Ask HN: I think My code isn't Good enough

news.ycombinator.com

21–30 of 97 posts

Re: Ask HN: I think My code isn't Good enough

#21
If you're using it for a start-up - it's much more important to deliver usable software than quality code - you can always go back and clean up the code - but if you don't get traction it's all over.

Also - consider buying code reviews from developers you respect - even a couple of hours a week can make significant difference to your quality.

Re: Ask HN: I think My code isn't Good enough

#22
I know my code isn't good enough, and I've been programming for about 30 years! Not only that, my code isn't good enough, but I'm a great programmer.

I might be making some wrong assumptions, but I think the people whose code is really bad are the ones who think their code is good enough, or the ones who just code quickly without thinking. (I tend to think quite a bit and then code. In fact for the particular project I'm on right now, I'm doing a lot of thinking because I know the current architecture is not good enough. IT would be pointless to start writing code and then try to bash into shape- like building a stone bridge and then realizing you need a 57 chevy. No matter how much you take a hammer to that bridge it is never going to look like a 57 chevy.)

When I go back and look at code I did in the past, without having looked at it awhile, I see that it is really quite brilliant. I bet you'll see this in your code to. The thing is, the other person-- other's code, or your past code- is written when they have the full context of whats' being written in mind at the time they're writing it, and in the process of understanding their code you're going to see how their solution is more elegant than the naive solution you might have tried if you tried to write it just now.

Code takes thinking and refinement... and doing either will make code look better, and may be the source of your insecurity.

But, if your code really isn't "good enough", then maybe the issue is that your idea of "good enough" is too good. If its never going to be re-used, does it need to be reusable? If its not going to need constant maintenance, does it need to be beautiful? I have some code that I look at very, very rarely. Its in production, being used by customers every day, lots of customers. I know it is junk because at the time I wrote it, I was attempting to pull off a massive effort to get a product done. But the code isn't' throwing exceptions, it doesn't have bugs, and the customers are asking for new features, not fixes. So, I know its is ugly, I remember how ugly it was at the time, and every time I do have to go in I clean up bits and pieces of it. But it is working great... it is doing everything it should be.

And so, that code really shouldn't be good enough... because the time making it "good enough" is wasted time. If I wasn't the solo programmer on that project, then other programmers would likely work with me to clean it up... that's natural... but in startup land, sometimes ugly code that is solid is going to remain ugly code, because the point here is building a company.

Do you want a cathedral of very pretty code? Or do you want to build a startup?

I don't mean to denigrate your feelings... I think that your desire to improve is a good thing. I think the best thing you could do is to learn another language. (I'm just guessing that at 4-5 years you've probably really used one language a lot and 1-2 others a little bit.) Learning something radically different can improve you a lot. I'd recommend erlang (but I always recommend erlang.. it is the manly language that will make you a man (or woman))... or maybe you could use some scripting chops or whatever. Pick something out of your comfort zone, even if your'e going to be writing in your main language for a long time coming.

Knowing that other language will help you write better in your current language, and I think it will make you appreciate what you're writing in your current language better as well. I could be completely wrong here, but the best bang for the buck for me has been when I went outside my comfort zone and learned a very different language.

Finally, humans are bred, via natural selection, to have a certain amount of insecurity. We're supposed to fear that we're inadequate as it produces a wariness that helped keep us from being eaten by predators in the past.

Use it to keep you motivated to do better, but always make sure you're focusing on the right "Better". EG: IF you're in a startup, better is faster growth for the startup, not pretty code, though the latter can help the former.

Worse is when you worry too much about not being good enough and really end up not being good enough.

Re: Ask HN: I think My code isn't Good enough

#24
I think that nearly all good developers feel their code isn't "good enough", so its nothing to worry about! This search for perfection will drive you to constantly improve and practice, which can only be a good thing!

Keep coding, and as always ask the developer community for help and advice, stackoverflow has certainly helped me a lot.

Re: Ask HN: I think My code isn't Good enough

#25
I think if you're shipping and it works, and you find you can revisit it in a few months without being completely lost, you're in pretty good shape.

I have the opposite problem where I'm generally happy with what I write, it works and is usually well-factored, but it seems to take me fucking forever to get it to that point. So count your blessings :-)

Re: Ask HN: I think My code isn't Good enough

#26
post #6

You do want to improve, but just relax and do your best work. Continue to learn and read other people's code that you respect. But don't let your desire to improve and impress others stress you out. Also, consider the rule of threes on reusability: http://www.rimmkaufman.com/rkgblog/2007/10/16/rule-of-three/ It seems possible you are being exposed to mentors that are being too harsh on you. Certainly you're being too…

Do you have a link to _why's philosophy on coding and making mistakes? A quick Google search did not yield anything. Thanks.

This letter from him[1] came up on HN a week or two ago.

[1] http://aberant.tumblr.com/post/167375099/a-letter-from-why

Re: Ask HN: I think My code isn't Good enough

#27
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.

Re: Ask HN: I think My code isn't Good enough

#28

I felt like this with my code for the first 5 years that I was coding as well. My code now isn't pristine or perfect, but I'm consistently satisfied with the quality of my final products. Here's what I did to get to the point where I'm happy with my code: 1. Debug and refactor. Early on, I'd stumble through creating a script. It was usually write three lines, see if that worked, repeat. I didn't plan ahead enough, an…

I really like your "clarity over cleverness" rule. It seems to incorporate so many good practices: premature optimization, over-design/second system syndrome, and doing the most obvious thing.

Re: Ask HN: I think My code isn't Good enough

#30

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…

+1 for the having to maintain your own code. I remember looking back at my own code and swearing "what the *$$# was i thinking.."
Post reply on HN