1

In some computer master program online application, it says:

Please list the programming languages in which you have written programs. For each language, indicate the length in lines of the longest working program you have written in that language. You may approximate, but only count those parts of the program that you wrote yourself.

  1. I don't quite remember that, and I have never counted the lines of each program. Do programmers always know approximately how many lines in each of his programs, and keep record of them?
  2. What is the relation between " lines of the longest working program " in a language and familiarity with it? Typically, how many lines will indicate the programmer being excellent, good, fair, or unfamiliar with the language?

    Is knowing "lines of the longest working program" really helpful?

gnat
  • 21,442
  • 29
  • 112
  • 288
Tim
  • 5,405
  • 7
  • 48
  • 84
  • 4
    LOC is generally not a very good measurement. Limited to the single largest program it makes not much sense anyway. I may have written 200 very small but complicated Ruby on Rails sites and be a far better RoR programmer who has written one extremely large site that only uses very basic Rails features all over the place. Some people like LOC just because it is one of the few IT measurements that can be used in numerical fashion. – thorsten müller Nov 07 '13 at 09:20
  • So do you know approximately how many lines means being excellent, good, fair, or unfamiliar with a language? I don't count my programs, but I would like to have some sense of how many in order to fill out the application. – Tim Nov 07 '13 at 09:38
  • 'Measuring programming progress by lines of code is like measuring aircraft building progress by weight.' --Bill Gates – Neil Nov 07 '13 at 10:13
  • It really makes not much sense. And in addition it is totally different between programming languages and styles. There are more 'verbose' languages and there are projects that require a lot of code that does tiny details very optimized where you may use a hundred LOC for something that could be done in one line under different circumstances. In Rails 7500 LOC project may be a lot while C or C++ programmers would see this as nothing. – thorsten müller Nov 07 '13 at 10:19
  • 1
    Further to what @thorstenmüller said, you could build lots of small, reasonably simple 'programs' (or 'websites' or 'web services', depending on what you're doing) which are designed to work as a suite. Where do you draw the lines here? – JohnL Nov 07 '13 at 11:31
  • What is a "working program" supposed to be? If I developed a 100kLOC game engine that counts for nothing? – Cephalopod Nov 07 '13 at 11:50
  • @JohnL Indeed, that's _all_ I do in the language I'm most familiar and experienced with. It tends to work rather well... – Izkata Nov 07 '13 at 12:02
  • 3
    it is "really helpful", although maybe not in the sense expected by those who wrote that funny stuff - it gives a fairly strong indication that their "computer master program" is a total waste – gnat Nov 07 '13 at 12:11
  • 1
    Everyone here is overthinking this... there's no value judgement proposed on number of lines. I think they're just trying to figure out if you've mostly just done class/tutorial assignments in languages or used them in a "real" program. – Nate Nov 07 '13 at 13:48

2 Answers2

4

It all depends how they intend to use your answer. One person might "bucket" responses as follows:

  • 100 lines or less: all you have written is demos or school assignments. Unless it's a language designed for little scripts, you probably don't know it thoroughly or work with it regularly.
  • 100,00 lines or less: you write normal sized programs and probably understand them all, and there's a good chance you've met all the features of the language, know how to debug in it, and know at least one framework
  • more than 100,000 lines: you are exaggerating or we need to discuss this in the interview

I would be ok with that. But another person might have a far more granular approach where they distinguish between having claimed a 2000 line program and a 10,000 line program. That's silly. It doesn't mean that there's no difference between writing ten programs, each less than a hundred lines, and one thousand line program, because there is, and if you've written a thousand line program (or 100,000 line) you know this.

Kate Gregory
  • 17,465
  • 2
  • 50
  • 84
3

There are three issues with this question.

1. LOC

Lines of code is a terrible measure, especially with the assumption that more lines is better than less.

Imagine two students who are asked to solve the same problem.

  • One starts writing code, and during the entire exercise, writes more and more of it, never reading it. At the end of the exercise, the code base is full of:

    1. Dead code (code which is not used at any point),
    2. Code duplication due to Ctrl+C/Ctrl+V abuse (one of the most important issues in software development),
    3. Plain duplication because of the lack of organization (the method is written from scratch, while the pretty same one exists in an other class),
    4. Stupid comments such as:

      // Concatenate the first and the last name.
      string displayName = this.firstName + " " + this.lastName;
      
    5. Pieces of code which should have been inlined, such as:

      int age = this.Age;
      int threshold = this.Threshold;
      int temp = age - threshold;
      int limit = 3;
      
      if (temp == limit)
      {
          return true;
      }
      
      bool tmp = temp > limit;
      if (tmp == true)
      {
          return true;
      }
      else
      {
          return false;
      }
      

      which should have been as simple as:

      int ageWithoutThreshold = this.Age - this.Threshold;
      return ageWithoutThreshold >= MIN_AGE_TO_APPLY;
      
  • Another one adds new lines of code carefully: more code means more sources of errors. He regularly refactors the code, architectures it properly to be able to find very easily which method should be put in which class, avoids code duplication, and, in general, tries to do what is required to solve a given problem, and nothing more.

Which one should have a better grade?

2. Working program

What is a working program? How to determine whether it works or not?

If a working program is a program which has no bugs, then there are practically no working programs in the world (a few use formal proof to be able to guarantee that the code doesn't have bugs, but I can hardly find an example of such program).

If a working program is a program for which no bugs are known, then the spaghetti code I urgently wrote this morning is a working program. I haven't compiled it yet, so I'm unaware of any bugs, even if I'm pretty sure that such terrible mess would take weeks to correct.

If a working program is a program for which every requirement has a functional test which passes, then what do you do with most code base which is grown organically, often with no written functional and non-functional requirements, and no functional tests?

If a working program is a program that is assumed to work by the author, then the answer to the question is pretty irrelevant. I assume that an app of 5 000 LOC might work. So what?

3. Program ≠ system

Most large systems are assembled from smaller programs, often presented as web services. For example, a CRM may rely on a REST API for authentication of users, or on another API for the management of documents, or on a third API for the upload of the documents.

Those systems are not programs.

For a web developer, for example, it makes no sense to talk about a large program. It would even be alarming to see a web developer being proud of creating a single large program: a set of small services would need much less maintenance.

Measuring familiarity

Using metrics to have an idea of a familiarity of a developer with a language doesn't make sense. I've already explained why LOC measure is wrong. Let's consider a few other measurements.

  1. Years of professional experience

    I've spent two days working on a C# project doing work so basic that a monkey could do it. Does it make me more experienced in C# than somebody who haven't spent two days doing the same thing?

    Take a young, not very smart coder who have spent five years doing e-commerce websites again and again using Ruby. Now take a talented software developer who, until now, worked only with Assembler, C, C++, Java, Haskell and Python. Two weeks ago, he started to learn Ruby. Who is more valuable for a company looking for a developer for a Ruby project?

    Years of professional experience is a meaningless measure; the fact that HR department loves it so much makes it extremely dangerous.

  2. Number of projects

    The same arguments apply here. I can spend a year doing e-commerce websites, again and again. Or I can spend a year working on a technically-challenging project where I do learn stuff.

    Sadly, this metric is popular among HR people a lot too.

So, how to measure the experience of a developer in a given language? Through a systemic approach, by considering multiple factors, without transforming them into metrics:

  • Implication of the person in the community, including contribution to open source projects,
  • Projects which were actually sold,
  • Open source projects which became popular,
  • Writings (publications, blogs, etc.),
  • Participation to the conferences,
  • Personal motivation,
  • Ease of speech when it comes to explaining language quirks and dark sides,
  • Awareness of language pitfalls and drawbacks compared to other languages,
  • Knowledge of tools related to the language or ecosystem (debugging tools, testing, continuous integration, continuous delivery, etc.),
  • etc.
Arseni Mourzenko
  • 134,780
  • 31
  • 343
  • 513