News for hackers. Stuff that matters.
Re:Ask HN: How fast do you code? by edw519 on Saturday July 24, 2010 @05:50PM (#1544453)
Very fast. Let me explain.

I work in 2 modes: (A) At the computer and (B) Away from the computer.

When I'm in Mode A at the computer, I'm cranking out lines of code, testing, revising, testing, revising, etc. This process must be very fast. Several hundred lines of code (or whatever) in less than an hour. A complete cycle in less than a couple of hours. My guideline is that if I'm not working that fast, then I must not be prepared to work that fast, so I don't deserve to be at the computer. I should be in mode (B).

Mode B is generally much slower. Reviewing code, specs, or notes. Refactoring code. Laying things out with pen and paper. When I have enough work clearly laid out, I know it's time to get back to the computer and return to Mode A.

The most important thing for me in Mode A is to see results, any results, quickly and often. It doesn't matter how correct anything is, just as long as it's progress (or sometimes, reverse progress). I like to think of programming as making incremental progress in micro jumps, evaluate where I'm at, and go for the next micro jump.

Some of the best advice I ever got was from a prolific artist friend of mine who claimed, "I paint every day." So I started coding every day. But that wasn't enough. Now I make progress every day.

There are many definitions of progress. Sometimes I copy a few hundred lines of code, make a few changes, spit out a new app, and then start applying micro changes. Other times I decide that I need to see <x> today and find a way to get there. Things don't always work out as planned, but that's OK. As long as tomorrow's starting point is beyond today's, I'm satisfied.

That's my definition of fast. Not sure that was what you were asking, but I hope that paints you an accurate picture.

Re:Ask HN: How fast do you code? by invertedlambda on Saturday July 24, 2010 @07:29PM (#1544615)
'Some of the best advice I ever got was from a prolific artist friend of mine who claimed, "I paint every day." So I started coding every day. But that wasn't enough. Now I make progress every day.'

Agree. While he's not everyone's favorite, I enjoy Stephen King's books very much. His recipe for success?

King's formula for learning to write well is: "Read and write four to six hours a day. If you cannot find the time for that, you can't expect to become a good writer." He sets out each day with a quota of 2000 words and will not stop writing until it is met. He also has a simple definition for talent in writing: "If you wrote something for which someone sent you a check, if you cashed the check and it didn't bounce, and if you then paid the light bill with the money, I consider you talented." (http://en.wikipedia.org/wiki/Stephen_King#Writing_style)

Notice how he says both reading and writing are keys to success. :)

Re:Ask HN: How fast do you code? by mishmash on Saturday July 24, 2010 @08:23PM (#1544671)
Love that quote and this one too, from your link:

"He is also often asked why he writes such terrifying stories and he answers with another question "Why do you assume I have a choice?""

Many of us probably feel the same way about programming. :)

Re:Ask HN: How fast do you code? by viraptor on Saturday July 24, 2010 @06:21PM (#1544516)
What kind of code / environment do you mean? Are you writing to a spec, or design from scratch? To be honest, I've never seen anyone working this way, meaning - I've never seen anyone able to design something away from keyboard that doesn't change significantly once it's written (unless they have a strict interface to fill, or something similar).

Also, do you actually write out pseudo code on paper (regarding "reviewing code", "Refactoring code")?

Re:Ask HN: How fast do you code? by edw519 on Saturday July 24, 2010 @07:03PM (#1544573)
I've never seen anyone able to design something away from keyboard that doesn't change significantly once it's written

It does change once it's written.

The idea is to get a clear work plan on a "close enough" design. I estimate that my first cut of anything is maybe 50% or so.

The idea is also to avoid sitting at the computer all day and then being disappointed with how little I accomplished. Activity != accomplishment.

A little more background...

First term freshman year, 90% of science students took Chemistry I. On Mondays and Wednesdays, only 50% of the seats in the dining room were taken for dinner. Chem Lab started at 1:00 p.m. and dinner was at 6:00 p.m. So, most freshman chemistry students took more than 5 hours to complete their lab work.

This never made sense to me. I took Chemistry I second term freshman year. My lab partner and I made a pact to never miss dinner. We did everything we possibility could to expedite lab time. We did all the reading, planning, and reviewing other people's results before we entered the lab. We even wrote our reports in advance, filling in the results as we went. Our longest lab took 2 1/2 hours. Our shortest took 1 1/4 hour. (We also both got A+.)

I still practice that methodology today. My computer is my lab and my bed or sofa is my lab prep. Preparation takes as long as it needs. Labs go fast. If they don't it's because I wasn't prepared enough when I started.

Re:Ask HN: How fast do you code? by derefr on Saturday July 24, 2010 @08:25PM (#1544673)
> My computer is my lab and my bed or sofa is my lab prep.

Reminds me of programming in 1972. Think about the problem on your sofa, then buy an hour on the mainframe terminal to test out a solution. Science of all sorts seems to be done most rigorously (and thus successfully) when it's expensive to do the actual experiments.

Re:Ask HN: How fast do you code? by benatkin on Saturday July 24, 2010 @08:03PM (#1544656)
This, and your earlier comment, are great food for thought! I'm trying to overcome distractions when I get stuck coding, and have been trying to establish a habit switching to paper at that point. The problem is, when I'm at that point, I'm usually frustrated and find it hard to fend off the urge to check out Boing Boing or HN. Having things planned out on paper beforehand could help me avoid reaching that point in the first place.

Also, thanks for posting some highlights of your activity on HN to your blog. I looked at the archives and found more good content there. I certainly think the points you made in this thread are worthy of being featured there.

Re:Ask HN: How fast do you code? by IgorPartola on Saturday July 24, 2010 @11:51PM (#1544919)
I do something similar. I actually often spell out code that I want to write while away from a computer. To me it also feels wrong to go through what you call mode A and not have the project working (unless it is in really early stages). So I get the basic structure set up, refactoring 3-10 times in the process, then write a list of features. Each time I get to code I knock put at least one feature and commit to the VC repo. Of course sometimes I add new features so the list gets longer. I know I am wrapping things up when it starts getting shorter (knocking out more features than inventing new ones). It doesn't always work so I end up leaving the code base without the feature completed. If this happens I end up being obsessed with the unfinished feature to the point where I spell out code in my sleep. Good to see that someone else is using this pattern.
Re:Ask HN: How fast do you code? by olliesaunders on Saturday July 24, 2010 @05:56PM (#1544459)
What language do you use?
Re:Ask HN: How fast do you code? by edw519 on Saturday July 24, 2010 @06:53PM (#1544564)
BASIC, php, and javascript
Re:Ask HN: How fast do you code? by mmaunder on Saturday July 24, 2010 @11:05PM (#1544876)
edw is obviously a smart guy and I too have not heard of BASIC used in production or for anything recently for that matter, so I find myself very curious and would love to know more about how you're using it.

I'm a Perl developer btw and many here consider that on a par with BASIC and might ask the same question of me.

Re:Ask HN: How fast do you code? by makeramen on Saturday July 24, 2010 @09:10PM (#1544730)
woah, where are you using BASIC? excuse the naivety but I’m not sure I’ve heard anyone use that professionaly in... ever.
Re:Ask HN: How fast do you code? by donw on Saturday July 24, 2010 @09:27PM (#1544750)
I don't knw what edw does, but there are a lot of small businesses that need small one-off desktop apps, for which VB is perfect.
Re:Ask HN: How fast do you code? by logic on Saturday July 24, 2010 @10:15PM (#1544807)
Agreed here; I've seen that a lot with in-house stuff. At my wife's former employer, almost all of the internally-developed stuff that she supported was a mashup of VB, Access, PowerShell, and third-party tools that they glued together.
Re:Ask HN: How fast do you code? by ramchip on Sunday July 25, 2010 @12:33AM (#1544979)
I could understand this, but I've never heard of the all-capital BASIC referring to Visual Basic.
Re:Ask HN: How fast do you code? by jpr on Sunday July 25, 2010 @03:01AM (#1545126)
Modern VB is certainly good for that. But calling it BASIC is like calling Common Lisp LISP.
Re:Ask HN: How fast do you code? by axod on Sunday July 25, 2010 @05:51AM (#1545289)
The 'b' still stands for "beginners" whatever you call it.
Re:Ask HN: How fast do you code? by mkramlich on Saturday July 24, 2010 @09:53PM (#1544784)
assuming you're serious.... why that mix? why BASIC today in a world where Python exists, Java, Ruby, Lisps, C, etc.?
Re:Ask HN: How fast do you code? by shasta on Saturday July 24, 2010 @06:11PM (#1544494)
This is pretty much the system that I use, but (B) is often at the computer, e.g. open to a text file that contains design notes.
Re:Ask HN: How fast do you code? by bugsy on Saturday July 24, 2010 @08:15PM (#1544665)
You write several hundred lines of code per hour? Excluding comments, no doubt. What language?
Re:Ask HN: How fast do you code? by mkramlich on Saturday July 24, 2010 @10:13PM (#1544805)
I've done that many times. It's not hard if you're "in the zone": you know exactly what you want to do and how, the language nuances and the application structure/state are all fresh in your mind, no interruptions, etc.
Re:Ask HN: How fast do you code? by ramchip on Sunday July 25, 2010 @12:41AM (#1544984)
I'm sure it's quite language- and project-dependent though. Considering xmonad weighs 1200 LOCS, at this speed you could write a full-fledged window manager in a few hours.
Re:Ask HN: How fast do you code? by bugsy on Sunday July 25, 2010 @02:07AM (#1545073)
When you say you also write several hundred lines of code an hour, how many hundreds of lines do you mean by several? 200? 300? 600? 900? Are you including white space? Are you including comments? What language are you coding in?
Re:Ask HN: How fast do you code? by melling on Saturday July 24, 2010 @11:49PM (#1544916)
Try working out the amount of code you write in an average day, or week. If you're writing, say 500 lines per hour, for 4 hours a day. At 5 days a week for 50 weeks, you've written 500,000 lines of code in one year.