How many lines of code do you have in your project?

Just want to get an idea of the complexity people have in there projects.

To count I am using CTRL+SHIFT+F. Enter \n as the search parameter and enable ‘use - regular expression’. This does include some of the non-user designer code, but this will probably be about the same for everyone.

My project is currently at 3551 lines.

@ hagster - a few projects with an average of 15000 lines

1 Like

@ Robvan Wow, that seems like a lot. I can imagine my code doubling in size, but I doubt it will get that big.


1 Like

Most complex app so far is 10,800+ lines.

1 Like

Current project 14900 lines and counting…

i have a look when i’m at the office but let me say a phrase i use at my job :wink:

It’s easy to create a complex solution for a simple problem but real talent floats when you are able to create a simple solution for a complex problem…

so bellow 10.000 lines should be good :smiley:

I also noticed that it includes all the blank lines and if you are a neat coder, you tend to use them to make the code more readable.

Trying to explain to new coders that spaces and blank lines don’t make your programme bigger and to use them to make it clearer to understand is the first thing they should learn. I’ve seen so many new coders ignore indents and boy is it hard work trying to see where all the blocks start and end. :slight_smile:

1 Like

I can’t believe VS doesn’t have a line count feature built in.

I do agree this is not a perfect measure. I often put multiple statements on the same line. I find this can make the code more readable . For instance in a nested loop keeping the code mote compact helps me to keep the loop structure on screen.

On the other hand if I create a multiline string I will stretch this one statement out over many lines.

There is a ‘format document’ command in the edit of view menu that sorts out all the indentation nicely. I use this a lot.

10.500 but not finished yet… have to simplify some things :think:

Searching for new lines is not a good solution to get lines of code but here are my numbers.

Out core library has 24991 lines (lots of blank and comment lines included)
My biggest project so far (which uses the core library) has 14838 lines

Calculating the code metrics give better results I think:
Core Library: 7073 lines of code
Project: 4619 lines of code

I’m not sure if code metrics are build in VS or if it comes from ReSharper)

This project runs fine on a custom G120 with ENC28, SD, Char display and a couple of digital IO’s.

Code Metrics appears to only be in the Professional Versions of VS.

A slightly better method using Find is given here :- Line Counting Trickery within Visual Studio | rionscode

//Visual Studio 2012 Version

//Versions prior to 2012

I also limit my file types to &.cs

This brings my code down to a measly 2747. That is talking to 2 UARTs, 1 SD card, 1ADC, 10 GPIO inputs and 10 GPIO outputs.

For comparison 3 of my completed full fat .NET apps come in at 15,676, 10,094 and 8,247. The first is heavy on GUI; second is heavy on comms/state machine; third is heavy on maths.

Ok with this (^(?([^\r\n])\s)[^\s+?/]+[^\n]$) expression and only .cs files I get:

core library: 19477
huge project: 12477

Still nearly 3x as much as code metrics, but a bit closer.
I think ‘lines of code’ usually does not include curly brackets.

1 Like

This shrinks me to only 9000 lines :frowning:

1 Like

Matching lines: 8247 :smiley:

I have one that’s 17000.

Why the sad face? less is more :wink: think about my design rule :whistle:

"It’s easy to create a complex solution for a simple problem but real talent floats when you are able to create a simple solution for a complex problem… "

I have a complete event driven interpreter running in my 8000 lines supporting IO in out analog in out PWM CAN RS232 SD USB host and client Ethernet Bluetooth Wi-Fi and FTP client… Size does not matter in code :naughty:

8973 lines for me. Nice line counting trick.

I’m not good at regex, but if it would exclude
"{\n" and “}\n” as well, then it would be even more accurate.

Nor me. With a bit of trial and error this seems to work in VS2010

Excludes comments and single line { , }