Live data from Hacker News

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

news.ycombinator.com

41–50 of 97 posts

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

#41
I recommend settling down in your armchair by the fire with a good brandy ;) and reading code written by the masters. The Plan 9 code has some very clean code I'd love to hear others' recommended "classic" works..?

Conversely, ask other people to review your code. It's an opportunity to get feedback on your code, discover bugs, and earn brownie points flattering your reviewer. ;) You can read "The Humble Programmer" to prepare your ego for constructive criticism.

Also, dabbling in other programming languages can give you new perspective into your other work. Scheme and Haskell are good languages for waking up dormant brain cells. (I'm working through the "Learn You A Haskell" tutorial Noah

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

#42

I recommend settling down in your armchair by the fire with a good brandy ;) and reading code written by the masters. The Plan 9 code has some very clean code I'd love to hear others' recommended "classic" works..? Conversely, ask other people to review your code. It's an opportunity to get feedback on your code, discover bugs, and earn brownie points flattering your reviewer. ;) You can read "The Humble Programmer"…

> The Plan 9 code has some very clean code I'd love to hear others' recommended "classic" works..?

The lcc compiler. It's written as a literate program. Read A Retargetable C Compiler by Hanson and Fraser.

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

#43
never be afraid of refactoring, but only do it when you're changing a piece of code anyway (otherwise you'll drive yourself nuts)

get others to review your code whenever possible. for that matter, do code reviews yourself whenever possible, it'll make you better at writing code too

always write it the simplest way you can, especially the first time. code that's clever for the sake of cleverness is bad code. learn about compiler optimizations, there are plenty of things compilers will do to make it so you can write clear code that is still fast, and there are plenty of clever things you can do that won't make an iota of difference in the end.

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

#44

First and foremost, write your code so that it can be understood easily by someone that knows nothing about it. As you get older, you'll realize that this person is you! Anything written over 2 weeks ago is often like looking at new code, so make sure you have good comments and non-obscure variable names so that you can understand it easily. This also makes it easier on your coworkers. Second, write for readability a…

Extremely well put. Took me alot of humility to get to get to this conclusion.

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

#45
post #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…

Wanted to do more than just up vote the above comment; Nirvana hit it on the head. The best I can do, as another 29 year developer here, is say "What he said". Take it to heart, then take it to heart again..

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

#46
Yeah, I feel like that almost all the time.

You have to write a LOT of code before it flows perfectly from the fingertips. That's the key, write lots of code and be aware how you can improve.

Here's a few points that have been useful to me:

1. Write code to be used. If it's not useful, why are you bothering? If it's useful, other people will use it and demand changes and complain about bugs.

2. Great programmers code fast. Write code quickly and refactor whenever necessary. Get miles under your wheels. Great racing drivers drive. Practice, practice, practice. ABC - Always Be Coding.

3. Practice refactoring. If you see a better way to do something, implement it. Don't cry that you're scared to change it because it's 'working'. ALL your code should work.

4. Set small targets that you can accomplish in an hour of so of designing or coding. Always have a pile of these ready to work on. Work on them when you have an hour free. Code fast, test and commit.

5. Use git. Commit at a fine granularity so you can see your enjoy your progress.

6. Always ask yourself "Is this code clear? Do I trust it?" when reading a source file.

7. Don't fight your tools. If you constantly edit auto-completed text, STOP DOING that and fix it or disable it, or learn to write idiomatic code.

Thanks for the question, and I hope these are useful. It's fun for me to crystallize some of this stuff!

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

#49
My code's crap and I feel sorry for the people I'm going to hire to take over it - and a little bit embarrassed - they will probably be better programmers than me and I will probably learn how to write less crap code from them.

But oh well. Shit happens, and my code got me this far.

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

#50

I recommend settling down in your armchair by the fire with a good brandy ;) and reading code written by the masters. The Plan 9 code has some very clean code I'd love to hear others' recommended "classic" works..? Conversely, ask other people to review your code. It's an opportunity to get feedback on your code, discover bugs, and earn brownie points flattering your reviewer. ;) You can read "The Humble Programmer"…

> The Plan 9 code has some very clean code I'd love to hear others' recommended "classic" works..? The lcc compiler. It's written as a literate program. Read A Retargetable C Compiler by Hanson and Fraser.

The SQLite code has a stellar reputation.

http://www.sqlite.org/download.html

Post reply on HN