Ask HN: Tips to become a great programmer
31 points| chimmychonga | 11 years ago | reply
I'm coming up on my sophomore year in college as a cs major. I feel as though I understand a good bit more than majority of other people in my classes but I still feel as if I'm only an "okay" programmer. I understand it takes writing a lot of code to get better but other than that are there any tips you might be willing to share to help me on my journey to becoming a great developer?
[+] [-] Jemaclus|11 years ago|reply
1) Find problems first, then solve them. It sounds obvious, but so many programmers find solutions and then go look for a problem. That's backwards. Problems, then solutions.
2) Test your solutions as much as you can. Does it actually solve the problem? Is it too slow? Is it confusing or cumbersome? Nine times out of ten, it's better to take an extra hour to test something than to rush it through. There are very, very, very few instances in which you legitimately do not have time to test. For all practical purposes, you ALWAYS have time -- you just aren't making it a priority if you don't test. Make it one. It's far more important to deliver solid code that works than it is to be the first one to submit your code.
3) Don't reinvent the wheel. Stand upon the shoulders of giants. Use what others have done and get ahead. There are two major exceptions to this tip, imo: 1) if you're reinventing it as a learning exercise, or b) you are absolutely, positively, 100% convinced you can bring something new to the table.
Also, just for kicks: tabs, not spaces. runs away
[+] [-] valarauca1|11 years ago|reply
1) Solve the problem before you write the code.
2) Figure out what data structures to use and the code will follow.
3) Debugging is your fault, you screwed up. The language or the compiler didn't (true 99.999% of the time).
4) The difference between genius and insanity is if the algorithm runs faster.
The biggest general tip is learn data structures. They are the fundamentals, you will always use them, get used to them.
[+] [-] greenyoda|11 years ago|reply
Sometimes the problem is difficult or huge (or both) and you don't know how to solve it. By starting to write some exploratory code, like a solution to a small part of the problem that you do understand, you can frequently get ideas about how to solve the bigger problem. Even if you end up ultimately throwing this code away, it could still be a useful learning experience and help you make progress toward understanding the real solution.
[+] [-] walterbell|11 years ago|reply
Yes. E-R data modelling is worth learning early and well, http://www.aw-bc.com/info/riccardi/database/Riccardi_ch4.PDF
[+] [-] brudgers|11 years ago|reply
[affiliate link] http://www.amazon.com/gp/product/0735619670/ref=as_li_tl?ie=...
[non-affiliate link] http://www.amazon.com/Code-Complete-Practical-Handbook-Const...
[+] [-] abhinavgujjar|11 years ago|reply
[+] [-] walterbell|11 years ago|reply
http://www.amazon.com/Programmers-Work-Interviews-Computer-I... & http://www.amazon.com/Programmers-at-Work-Susan-Lammers/dp/0...
Some (all?) interviews free here: http://programmersatwork.wordpress.com/
[+] [-] greenyoda|11 years ago|reply
http://codersatwork.com
[+] [-] glenda|11 years ago|reply
The real way to get better is to pick an area of study and research the shit out of it, even non-technical aspects if applicable. Go back as far as you can and read every canonical book you can find on the subject. Even if it's outdated information, it will help you see how we arrived where we are now (as long as it's not a purely technical reference).
Read those things until you feel some things click in your head. Then go back and try to write some code.
This might be difficult to do while in school though. I'm sure you're doing a lot of reading already.
[+] [-] nostrademons|11 years ago|reply
Write code first. Write code until your programs collapse under their own weight. Then go out and read what the masters have written. You'll understand it much better when you have personally faced the problems that they were facing.
[+] [-] orionblastar|11 years ago|reply
Learn from your mistakes and failures.
Don't be afraid to make a mistake or fail.
Fixing your mistakes and failures is called debugging, learn how to debug.
Communication is 80% of the job, develop your social and people skills to avoid acting like a jerk, treat others with empathy and compassion.
Learn to work with others on a team, don't be a Lone Ranger, sometimes you get stuck and need another pair of eyes to look things over.
Learn how to manage stress better so you can get a good night's sleep. If you cannot get 8 hours of sleep at night, consider seeking help for that. If your stress levels make it so you cannot even get sleep, something is wrong.
[+] [-] logn|11 years ago|reply
[+] [-] bobfirestone|11 years ago|reply
1) Keep your code as simple as possible. In the real world if you can call your code complex or clever it is probably bad.
2) When presented with a problem don't immediately reach for the keyboard. Take some time to make sure you understand the actual problem that you are solving.
3) Good enough and working beats perfect and not working. Perfectionists make horrible co-workers and usually end up with horrible code.
[+] [-] couchand|11 years ago|reply
This principle is often called "kill your darlings".
http://c2.com/cgi/wiki?KillYourDarlings
[+] [-] julesaus|11 years ago|reply
Seriously, listen to the talk and/or check out the slides.
But 90% won't, so here's her actionable steps:
* These are the two points you'll need to adapt to your choice of language[+] [-] notduncansmith|11 years ago|reply
[+] [-] abhinavgujjar|11 years ago|reply
Next, do not fixate on languages and frameworks. Aspire to make this irrelevant to you. Great developers often can work with multiple languages and frameworks.
Be prepared and excited to learn every single day of your life as a programmer. The best programmers I know are always learning. This is an investment you will need to make regardless of work pressures and schedules. I've seen far too many developers have their skills atrophy because they've not invested in improving.
Use the Rubber Duck debugging model - http://en.wikipedia.org/wiki/Rubber_duck_debugging.
One simple way to do this is that whenever you get stuck, go to stackoverflow and start explaining the problem.
I have found my solution innumerable number of times by forcing myself to explain it to someone else with no context. It makes you confront your assumptions and understanding.
[+] [-] elyrly|11 years ago|reply
[+] [-] AnimalMuppet|11 years ago|reply
Programming well requires judgment and taste. It takes years to develop these well (at least, it did for me), but it helps to have people who have more than you explain why they wouldn't have made the same choices you did.
(Note well: Not everyone with more experience than you has better judgment. You need someone with good coding judgment, not just someone older.)
[+] [-] Nowaker|11 years ago|reply
I'm aware you expect some quick tips from HN though. Have a look at my old blog posts that summarize these books. While 3 years old and written in Polish, Google translated it very well. Direct links to the translations: https://bit.ly/1oZiidn and https://bit.ly/1w8ELhY.
[+] [-] josephschmoe|11 years ago|reply
Not even software engineers necessarily. And I don't mean acquaintances. I mean friends. They can give you real perspective - no piece of generic advice I can give you will come even close to the advice of someone who both knows you well and has been in your shoes. Having perspective is better than any specific programming skill you could ever learn.
[+] [-] teh_klev|11 years ago|reply
[+] [-] prostoalex|11 years ago|reply
― Steve Martin
[+] [-] ozuvedi|11 years ago|reply
[+] [-] motyar|11 years ago|reply
[+] [-] adultSwim|11 years ago|reply
A lot of being a good programmer doesn't have to do with technical skills.
Take a compilers course. This was required at my school and I figured it would be boring (I mostly likely the theory classes). I was wrong! Writing a compiler really made me understand what they do. I had seen a lot of people who were trying to appease the compiler. Instead, the compiler is now my slave.
[+] [-] Spoom|11 years ago|reply
[+] [-] sgy|11 years ago|reply
- read this: http://www.paulgraham.com/gba.html