Home » Software Development » How Many Lines Of Code Do You Write Every Day?

About Bear Giles

How Many Lines Of Code Do You Write Every Day?

I was recently asked a bizarre question in an interview – “how many lines of code do you write every day?”

I’ve been thinking about that question for a week and realized that it makes sense since she was a C person before migrating to other work a few years ago, not a contemporary java person.

To explain, I can fold my career into three major stages.

Ancient – computers were resource-limited (memory < 1 MB) and no third-party libraries to speak of. Our “internet” was journals (esp. “Programming Pearls”), magazines (e.g., “Dr. Dobbs”) and books. You wrote everything you used and you needed to use efficient algorithms and data structures if you didn’t want it to crawl. SLOC could be considered a fair measure of productivity, subject to various well-known limitations. (E.g., you needed to be comparing comparable work using the same definition of SLOC, etc.)

(Sidenote: on several occasions I improved performance of existing code by several orders of magnitude – literally hours to minutes or minutes to seconds – by simply recognizing that the code was now running on computers with more memory and I could cache values instead of constantly rereading files or the database, recomputing values, etc.)

Mature C – computers had decent resources (memory < 100 MB) and a wide variety of quality third-party libraries. We could get those libraries via the internet but it was years before Google or blogs and we still depended on journals, magazines and books. SLOC was starting to lose its value since you could have one person who still wrote everything himself (including bugs) and another person who took less time and wrote fewer SLOC but had better results since he used a third-party library. Knowing good third-party libraries was important but not critical and you still spent most of your time writing code (excluding meetings, etc.).

Mature Java – computers have ample resources (memory > 4 GB, multicore processors) and a number of quality deep libraries. The standard API, Apache, Spring Framework, etc. We can get libraries by adding a few lines of text to a configuration file and we can learn about them by reading blogs and Google searches. We’re often more productive with a day of research than a week of coding.

There is no “right answer” here since it depends on the ecosystem. Some languages have deeper third-party libraries than others. Some shops require highly specialized needs that they must write themselves. But it really struck me just how different my world has become over the last few years when she asked that question and my first thought was how much time I spent in research vs. coding and how that affects the raw SLOC numbers.
 

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

and many more ....

 

2 comments

  1. Lines of code metric was never useful, you could always write the same code in different number of lines and the efficiency and clarity of the code was always most important quality.

  2. I too was asked this question in a phone interview, and I objected to the question as ‘lines of code per day’ is a poor measure of a programmers ability.
    One of the highlights in my last job was spending two weeks investigating a performance bug. The result was changing two lines of code and a dramitic improvement in performance.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.