How do you count your lines of code?
codelitically_incorrect

codelitically_incorrect @codelitically_incorrect

About: The wisdom of architecture

Location:
U.S.A
Joined:
Dec 26, 2018

How do you count your lines of code?

Publish Date: Sep 24 '19
7 4

As Javascript developers, we have to wield several technologies to get a UI built. How do you go about counting your lines of code on a per screen basis?

Do you factor in css line-count and html line-count or do you look at your line-count as being pure Javascript logic?

Comments 4 total

  • Zohar Peled
    Zohar PeledSep 24, 2019

    Question is, why would you even bother to count them in the first place? that number is almost meaningless anyway...

    • codelitically_incorrect
      codelitically_incorrectSep 30, 2019

      Hi Zohar,
      LoC is a high-level human benchmark in front-end UI development that tells a story, an important one and it began in the days of 14.4 modems when we just had to deliver highly optimized code.

      I wrote C# and Java and write NodeJS, we never count LoC, it's compiled and is delivered as software unto servers, but you know all this.

      Besides optimization, there are bigger issues in LoC at the browser side, as this article today points out:
      medium.com/@sakthishanmugam02/look...

    • Brian Loomis
      Brian LoomisJul 20, 2021

      It's also a metric that under due diligence investors will ask for.

  • Brad
    BradSep 24, 2019

    I use sloc when I'm curious about the amount of lines and TODO's are in the project/folder/whatever.

    I work on web projects, so npm and thus this package is right at my finger-tips with: npx sloc src

    Here's an example output for an old project I did a while back:

    
    ---------- Result ------------
    
                Physical :  2723
                  Source :  1935
                 Comment :  816
     Single-line comment :  152
           Block comment :  664
                   Mixed :  107
     Empty block comment :  0
                   Empty :  79
                   To Do :  7
    
    Number of files read :  37
    
    ----------------------------
    
    Enter fullscreen mode Exit fullscreen mode

    I don't believe line-count means that much. I usually abuse formatting for extra lines. Its a "nice-to-know", something to brag to your friends about, but that's about it. I'd consider it like writing a good novel. More pages doesn't mean its a better book, it could be, or it could be not.

Add comment