Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. stupid question ?

stupid question ?

Scheduled Pinned Locked Moved The Lounge
questionc++designalgorithmstutorial
26 Posts 20 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Rocky Moore

    I think you have answered your own question. There are too many variants to allow for an estimate. You can write thousands of printf lines while you might only have a few hundred lines if you are extending functionality to an object. Then of course, you might only write one line in an entire day if you are debugging and trying to track something down. Rocky <>< www.HintsAndTips.com - Now with RSS Feed www.JokesTricksAndStuff.com www.MyQuickPoll.com - Now with RSS Feed and Prizes www.GotTheAnswerToSpam.com - Again :) Me Blog

    M Offline
    M Offline
    Matt Gerrans
    wrote on last edited by
    #3

    So the answer is: Yes. ;P Matt Gerrans

    P 1 Reply Last reply
    0
    • Z zoid

      Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

      D Offline
      D Offline
      DavidNohejl
      wrote on last edited by
      #4

      The less the better (unless they pay you for lines ;) ). Average programmer should first think and then code, what minimalizes "write and then delete this stupid thing" code. Average programmer should reuse as much code as he can. So 300-400 maybe? Average idiot write much more code :-D. best regards, David 'DNH' Nohejl Never forget: "Stay kul and happy" (I.A.)

      1 Reply Last reply
      0
      • Z zoid

        Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

        D Offline
        D Offline
        Daniel Turini
        wrote on last edited by
        #5

        ZoiD wrote: How many lines of code should a developer (c/c++) write on average each day ? Enough to keep the customer happy :) ZoiD wrote: So is there a good number ? Some programmers add so many bugs to the program that I'd prefer to keep it as zero. Yes, even I am blogging now!

        1 Reply Last reply
        0
        • Z zoid

          Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

          P Offline
          P Offline
          peterchen
          wrote on last edited by
          #6

          42? It really depends on the project, and some counting/coding guidelines. When judging "code size", I simply skip lines that have only a curly brace or curly brace and semicolon. I'd never introduce line count as an "evaluated measure". If you do it just for yourself, you should know quite well why you wrote only 12 yesterday, and 4000 today. But as soon as you know that your boss knows yours, the number becomes meaningless. For myself, I'm happier with removing 10 lines, than writing 100.


          we are here to help each other get through this thing, whatever it is Vonnegut jr.
          boost your code || Fold With Us! || sighist | doxygen

          Z A 2 Replies Last reply
          0
          • M Matt Gerrans

            So the answer is: Yes. ;P Matt Gerrans

            P Offline
            P Offline
            peterchen
            wrote on last edited by
            #7

            Actually, the answerr should be 'mu'. The question itselfis not stupid, it is a valid question to ask. But this question has no answer, and just for this outcome, it is a valid question to ask.


            we are here to help each other get through this thing, whatever it is Vonnegut jr.
            boost your code || Fold With Us! || sighist | doxygen

            1 Reply Last reply
            0
            • Z zoid

              Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

              J Offline
              J Offline
              jhaga
              wrote on last edited by
              #8

              For a large application (10.000 - 500.000 lines of code) you can¨ estimate that a coder writes 10-30 lines a day. --------------------------------- Every generation laughs at the old fashions, but follows religiously the new. Henry David Thoreau, "Walden", 1854

              1 Reply Last reply
              0
              • P peterchen

                42? It really depends on the project, and some counting/coding guidelines. When judging "code size", I simply skip lines that have only a curly brace or curly brace and semicolon. I'd never introduce line count as an "evaluated measure". If you do it just for yourself, you should know quite well why you wrote only 12 yesterday, and 4000 today. But as soon as you know that your boss knows yours, the number becomes meaningless. For myself, I'm happier with removing 10 lines, than writing 100.


                we are here to help each other get through this thing, whatever it is Vonnegut jr.
                boost your code || Fold With Us! || sighist | doxygen

                Z Offline
                Z Offline
                zoid
                wrote on last edited by
                #9

                I realize that the day to day numbers vary .. that's why asked about the average daily number ... Some people have mentioned that a 'bad' coder could just write 1000's of printf statements ... but I'm interested in what the daily average of an average/good programmer would be... A good programmer is one that wants to write well structured/resuable/correct/efficient/etc code ... One of the reason's I ask this is that when I started at the company I work for now I heard people say that the company average was something like 10 lines of code per day .. which I thought and still think is extremely low ... even given that there will be days when you write nothing or optimise, reorganize or remove existing code. Tom.

                P 1 Reply Last reply
                0
                • Z zoid

                  I realize that the day to day numbers vary .. that's why asked about the average daily number ... Some people have mentioned that a 'bad' coder could just write 1000's of printf statements ... but I'm interested in what the daily average of an average/good programmer would be... A good programmer is one that wants to write well structured/resuable/correct/efficient/etc code ... One of the reason's I ask this is that when I started at the company I work for now I heard people say that the company average was something like 10 lines of code per day .. which I thought and still think is extremely low ... even given that there will be days when you write nothing or optimise, reorganize or remove existing code. Tom.

                  P Offline
                  P Offline
                  peterchen
                  wrote on last edited by
                  #10

                  (I assume you replied to my post, and CP garbled it up) My first sentence was the second most important one - "it depends on the project". Lines per day and developer (lpdd?) decrease with size of the project, and (lesser) with the number of coders working on it. That's given. For the project I'm on, a day where I removed a few hundred lines, rearranged some headers, sorted out some code feels as productive as those days where you just crunch out code that you *know* it works. The per-day-variation (the 12..4000 is serious data) is so big that you'd have to sample over a few years for an reasonable average.


                  There was a much more important fact included in my original post: lince count is a measure for line count. It is not suitable for any measure beyond... line count. You could try to judge productivity by it. Or the skills of the team lead. Or the management. Or the sitability of the work environment. Or the climate of the region the developers are located in: When sampling large amounts of data, you will finds correlations. But the correlation is indirect and does not indicate a chain of reason. It is like judging the beauty of a garden by the length of it's trails. btw. I have no idea about my line count, but I know I've been over 4k raw lines on a few days and you can see my keypunches[^])


                  we are here to help each other get through this thing, whatever it is Vonnegut jr.
                  boost your code || Fold With Us! || sighist | doxygen

                  1 Reply Last reply
                  0
                  • Z zoid

                    Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

                    B Offline
                    B Offline
                    brianwelsch
                    wrote on last edited by
                    #11

                    It's almost like asking how many boards a decent carpenter can nail together in a normal day. It tells you nothing of the quality of what's being constructed. Also, you have to account for the structure of the company. Some programmers are involved through the entire lifecycle of a product, others only test a concept and pass the grunt work on to someone else. Still others are involved in support/training/admin roles and so have less time actually devoted to coding per day. BW The Biggest Loser


                    "Farm Donkey makes us laugh.
                    Farm Donkey hauls some ass."
                    -The Stoves

                    Z 1 Reply Last reply
                    0
                    • B brianwelsch

                      It's almost like asking how many boards a decent carpenter can nail together in a normal day. It tells you nothing of the quality of what's being constructed. Also, you have to account for the structure of the company. Some programmers are involved through the entire lifecycle of a product, others only test a concept and pass the grunt work on to someone else. Still others are involved in support/training/admin roles and so have less time actually devoted to coding per day. BW The Biggest Loser


                      "Farm Donkey makes us laugh.
                      Farm Donkey hauls some ass."
                      -The Stoves

                      Z Offline
                      Z Offline
                      zoid
                      wrote on last edited by
                      #12

                      Maybe I should narrow/restate my question a little ... I am well aware that a developer has many different responsibilities ... and that there are different developer positions ... and levels (junior, senior ...etc). By Developer I meaning someone who is dedicated to implementing/coding a specific module or even application. This means he/she already has been given the requirements and some initial conceptual design has been done. What remains to be done is the coding and possibly some mid to lower level design. I am also assuming that the developer is good. By good I mean that he/she follows good coding principles. I.E. readable/efficient/well structured/non-redundant/reuable/etc code. Based on the above I believe that a project of a large enough size will turn out to be similar size if counted in number of lines of code whether it's done by good programmer(s) A or good programmer(s) B. As a result I think that average line count per day can be valid stat... as it is certainly possible that programmer A could finish this project in half the time that B would. Anyways, as I can see from the responses that I have received, this is not a stat that is tracked ... probably because of the difficulties mentioned in the responses ...

                      R 1 Reply Last reply
                      0
                      • Z zoid

                        Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

                        T Offline
                        T Offline
                        Tim Smith
                        wrote on last edited by
                        #13

                        As per a study 10 years ago: Your average programmer writes 5 lines of debugged and functional code a day. Your best programmers write 100 lines of debugged and functional code a day. Now before everyone goes off and says "I must be GREAT, I write 400 lines of code a day." You really don't. You might write 300 lines one days but you spend the next 4 days working out all the bugs. Then in two months you spend another 4 hours trying to track down a bug in the code. On average, we produce a lot LESS code per day than we think. Tim Smith I'm going to patent thought. I have yet to see any prior art.

                        1 Reply Last reply
                        0
                        • Z zoid

                          Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

                          N Offline
                          N Offline
                          Nemanja Trifunovic
                          wrote on last edited by
                          #14

                          The real question is: How many problems should a developer solve in a day? Lines of code mean nothing.


                          My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

                          1 Reply Last reply
                          0
                          • Z zoid

                            Maybe I should narrow/restate my question a little ... I am well aware that a developer has many different responsibilities ... and that there are different developer positions ... and levels (junior, senior ...etc). By Developer I meaning someone who is dedicated to implementing/coding a specific module or even application. This means he/she already has been given the requirements and some initial conceptual design has been done. What remains to be done is the coding and possibly some mid to lower level design. I am also assuming that the developer is good. By good I mean that he/she follows good coding principles. I.E. readable/efficient/well structured/non-redundant/reuable/etc code. Based on the above I believe that a project of a large enough size will turn out to be similar size if counted in number of lines of code whether it's done by good programmer(s) A or good programmer(s) B. As a result I think that average line count per day can be valid stat... as it is certainly possible that programmer A could finish this project in half the time that B would. Anyways, as I can see from the responses that I have received, this is not a stat that is tracked ... probably because of the difficulties mentioned in the responses ...

                            R Offline
                            R Offline
                            rmorey
                            wrote on last edited by
                            #15

                            ZoiD: You ask an interesting and a somewhat controversial question. From what I recall from a couple of books I've read, the average lines of code per day is indeed somewhere around 10 lines. The number is surprisingly low, but probably accurate, especially for large projects. I was surprised too when I first read it. ZoiD wrote: Based on the above I believe that a project of a large enough size will turn out to be similar size if counted in number of lines of code whether it's done by good programmer(s) A or good programmer(s) B. As a result I think that average line count per day can be valid stat... as it is certainly possible that programmer A could finish this project in half the time that B would. This seems like a perfectly reasonable statement, but it is not accurate. As it turns out, given the exact same specs, two groups of programmers can produce programs of vastly different size. In one study, there was a 5 to 1 difference in the number of lines of code written for functionally equivalent programs. Lines of code is a way of measuring program size, and can only be done after the code is written. There is currently no accurate predictor for predicting the size of a program except to compare it with similar projects written by the same group. Lastly, even if you have a fair estimate of the project size in lines of code, and a reasonably accurate estimate of lines of code per day for each developer, and average that out over the project, there's a good chance you still won't end up with a realistic estimate because the time required to write a program is not a simple linear function. In other words, just because one programmer can write a 400 line program in 4 weeks, does not mean 4 programmers can finish the program in 1 week. There is an excellent book about this exact issue called, "The Mythical Man-Month" by Frederick Brooks. Steve McConnell also has several good books with lots of studies, facts, and background on software development planning, project estimates, etc. I highly recommend "Code Complete" and "Rapid Development".

                            1 Reply Last reply
                            0
                            • Z zoid

                              Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

                              J Offline
                              J Offline
                              John R Shaw
                              wrote on last edited by
                              #16

                              Late entry! As few lines as possible! Quality is more important than Quantity! Research, Write, Test, Rewrite, Test, Cuss, Research, Rewrite, etc... BELEIVE IT OR NOT: Once upon a time, some programers where paid by the number of lines of code they wrote. Therefor, some other programer had to write a program to count the number of lines of actual code. I still wonder what idiot came up with that idea! INTP

                              C 1 Reply Last reply
                              0
                              • Z zoid

                                Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

                                E Offline
                                E Offline
                                ElCachubrey
                                wrote on last edited by
                                #17

                                Its depend on speed typing of particular programmer

                                1 Reply Last reply
                                0
                                • P peterchen

                                  42? It really depends on the project, and some counting/coding guidelines. When judging "code size", I simply skip lines that have only a curly brace or curly brace and semicolon. I'd never introduce line count as an "evaluated measure". If you do it just for yourself, you should know quite well why you wrote only 12 yesterday, and 4000 today. But as soon as you know that your boss knows yours, the number becomes meaningless. For myself, I'm happier with removing 10 lines, than writing 100.


                                  we are here to help each other get through this thing, whatever it is Vonnegut jr.
                                  boost your code || Fold With Us! || sighist | doxygen

                                  A Offline
                                  A Offline
                                  Alsvha
                                  wrote on last edited by
                                  #18

                                  peterchen wrote: For myself, I'm happier with removing 10 lines, than writing 100. Only if the functionality improves or stays the same, I'd wager :-D Edit: Seems CP board somehow has placed this reply somewhere wrong --------------------------- 127.0.0.1 - Sweet 127.0.0.1

                                  1 Reply Last reply
                                  0
                                  • J John R Shaw

                                    Late entry! As few lines as possible! Quality is more important than Quantity! Research, Write, Test, Rewrite, Test, Cuss, Research, Rewrite, etc... BELEIVE IT OR NOT: Once upon a time, some programers where paid by the number of lines of code they wrote. Therefor, some other programer had to write a program to count the number of lines of actual code. I still wonder what idiot came up with that idea! INTP

                                    C Offline
                                    C Offline
                                    ColinDavies
                                    wrote on last edited by
                                    #19

                                    John R. Shaw wrote: As few lines as possible! Quality is more important than Quantity! AGREED, John R. Shaw wrote: Research, Write, Test, Rewrite, Test, Cuss, Research, Rewrite, etc... whatabout, Research, test research, write ... Typing out code is given too much emphasis, Regardz Colin J Davies Attention: It's finally arrived, The worlds first DSP.

                                    1 Reply Last reply
                                    0
                                    • Z zoid

                                      Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

                                      M Offline
                                      M Offline
                                      Mike Dimmick
                                      wrote on last edited by
                                      #20

                                      Yesterday, I was debugging a database problem - a timeout occurring when executing a DELETE statement in a batch data update. I needed a representative amount of data so I wrote a data generator. In my coding style, that's 68 lines of non-generated C# code, although some of those lines are blank. I made one mistake which caused it to generate 500,000 records rather than the 50,000 records I needed (which caused the import program to report an overflow!) so I had to change the loop construct, affecting three lines. My immediate solution was to drop two indexes not used by any of the queries which were simply overhead for inserts, updates and deletes. I generated a script using Query Analyzer that worked out at 6 lines. This is a get-you-going fix - the ultimate solution will be to set the CommandTimeout property to something larger than the default of 30 seconds. I spent a long time trying to work out why the same application was reading barcodes of an incorrect length - an application that covers several modules, some of which run on the server and some on a hand-held terminal. I determined that the application module (the server and hand-held software are a product) was setting an incorrect parameter value which allowed any length, rather than just 8 digits. This will be a one-line fix in the application, but the application is scheduled to be rewritten in the near future. A barcode of the wrong length is rejected by the application but it's causing an unnecessary round-trip to the server. When I got home I bowed to the pressure of three users wanting the ToUniversalTime method on the TimeZoneInformation class in my WorldClock[^] application. I wrote an additional 100 non-blank lines in that class (although a number of them are comment lines) and extended the application to allow the user to specify the local time zone (a further 37 lines written by me and 37 generated by the VS.NET designer). Since the underlying function is only available on Windows XP and 2003, I installed Windows 2000 in a VM to test that I'd got the exception handling right, which I hadn't - I'd tried to catch MissingMethodException where I needed to catch EntryPointNotFoundException. I needed to modify 10 lines to get that right and then to report the error cleanly and disable the unsupported options. (Note

                                      1 Reply Last reply
                                      0
                                      • Z zoid

                                        Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

                                        N Offline
                                        N Offline
                                        Nirav Doshi
                                        wrote on last edited by
                                        #21

                                        ZoiD wrote: How many lines of code should a developer (c/c++) write on average each day ? Our CTO once told us that Motorola has done some internal study and it seems the lines per day of a programmer is about 130 (regardless of the language and logic/algorithm). This is an average calculation for a month's work or so! A similar benchmark is used by some companies for getting to some productivity metrics of their programming team. These lines are supposed to be complete (as per the requirement specs), optimized (no redundant code) & bug-free (as per the requirement specs) lines of code. - Nirav - * Artificial intelligence is no match for natural stupidity! *

                                        V 1 Reply Last reply
                                        0
                                        • Z zoid

                                          Just wandering what every thinks about this and what the industry expects... How many lines of code should a developer (c/c++) write on average each day ? I know that this is a very general and vague statistic ... Someone designing an algorithm won't write many lines of code ... but will spend a lot of time thinking about how to write them ... Still, I am assuming that the average developer will perform all sorts of programming tasks, algorithm design being one of them. So is there a good number ? :confused: Tom.

                                          A Offline
                                          A Offline
                                          Andrew Torrance
                                          wrote on last edited by
                                          #22

                                          What is a line of code ? I have in the past produced more in 1 hour than I have in one month. I wrote more working code in the month , but the few well thought out lines I generated in an hour had a much bigger business impact. But perhaps my environment is different to yours . If you have zombies coding to a well defined spec then you are comparing their typing speed , not their thinking speed .

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups