Live data from Hacker News

Ask HN: What habits made you a better programmer?

news.ycombinator.com

11–20 of 103 posts

Re: Ask HN: What habits made you a better programmer?

#12
Noticing pain points. It takes time to develop a taste for good solutions. But when you modify or write code, and you say, "this is harder than it should be," this is a code smell and there is a better way to globally solve the problem.

Thinking first, writing later. When practicing for the ACM programming competitions in college, I discovered that when writing code before understanding the solution, I eventually needed to start over. I have never seen a counterexample.

Learning new things. Every year I try to learn a new major skill. Two years ago I learned Common Lisp, last year I hacked on some AI textbooks, and this year I'm teaching myself how to build websites in Python. Try for some variety - Alan Kay said "Perspective is worth 20 IQ points," and while I make no standardized testing claims, learning from multiple fields can connect the dots in interesting ways.

Reading code. Norvig's PAIP knocked me out of my Object-Oriented rut and changed how I think about coding problems.

Working with smart people. Surrounding yourself with motivated and effective workers has a great multiplying effect on your own productivity.

Re: Ask HN: What habits made you a better programmer?

#13
1. unplug. no chat, no web, no email, no phone.

2. Find a work flow that keeps you moving forward no matter how slowly. here is mine. Basically design, top down then code bottom up, testing each piece as you go. An example of when I finally get to coding. a. write the comment for the function b. write the signature c. write the tests d. write the internals of the function

It will never almost never work out that perfectly but you should have the goal that, when you are done with that function you should never have to look at it again*

* you will. I do. Being perfect would be nice, but it just isn't going to happen.

Re: Ask HN: What habits made you a better programmer?

#14
post #6
post #4

Learning. I'll probably be in the middle of learning something new and interesting the day I die. Some on here will disagree with me, but I'm a huge advocate of learning at the expense of doing. Spend time to learn how to not only do something, but do it well . After all, most programming tasks are only useful for a limited time. Knowledge is usually useful for much, much longer. Sometimes I'm surprised at how useful…

to add to that.. reading. I spend a lot of time reading, books, documentation, forums, and blogs

Good advice, but remember what Einstein said:

"Any man who reads too much and uses his own brain too little falls into lazy habits of thinking."

To me, the best readings aren't ones that I learn directly from. They're the ones that spark thought processes inside my head. I haven't read past Chapter 2 of pg's "On Lisp", but I still consider it one of the best books on programming languages because it changed how I think about them in a lot of ways.

Re: Ask HN: What habits made you a better programmer?

#15
post #3

I became a better programmer by writing a lot of programs.

This will definitely help, to a point. Reflecting on programs you've wrote and seeing the mistakes you made is also important.

I've had colleagues that had wrote hundreds of programs, but they were mostly the same boilerplate, same glue, with different business logic. Writing a lot of different, varied programs, is key.

Re: Ask HN: What habits made you a better programmer?

#16
Knowing when to stop.

When you reach a seemingly impassable problem, talking it over with other people and then sleeping on it will make everything clearer come morning.

If you work constantly you are a worse programmer than those who know to take breaks. These are the people who are thinking about what they're doing.

Re: Ask HN: What habits made you a better programmer?

#17
Really taking the time to learn your current framework really well. For example, my first rails site was written with a shallow understanding of both rails and ruby, and I ended up writing reams more code than I needed to, and the code I wrote was usually rolling my own when rails/ruby offered a cleaner simpler and more robust way of doing it.

In other words, don't go against the grain of whatever framework/library you are working in. Learn the path of least resistance.

Re: Ask HN: What habits made you a better programmer?

#19
Writing distributed code. Once your data is too large and your logic too distributed to run or debug locally, you are forced to become a much more careful programmer. I have to carefully read the code and think about what is going on, whereas before I often used debugging and stepping through the code as a crutch.

Re: Ask HN: What habits made you a better programmer?

#20
Taking a nap.

Seriously, the most difficult problems I've faced have been solved easily just after taking a quick nap (30 - 40 mins). Most of the time it comes to the point that there's no solutions in the horizon, I'm pulling my hair out and biting on my keyboard and then, a quick nap later most of the problem is solved in 20 mins when I sit in front of my computer again. It's got probably something to do with unconcscious mind.

But the problem is employers may not see this "sleeping to solve problems" act as productive as you do. I read that Google has "nap rooms", and I'll definitely have one of those when I start a company.

Post reply on HN