How is the "weight" of a code measured? Topic is solved

Talk about anything
User avatar
Benny-D
Posts: 271
Joined: 12 Mar 2014, 10:09

How is the "weight" of a code measured?

05 Nov 2019, 03:54

Is there any convention in the programming community on how the weight of a piece of code must be measured?

I keep seeing in various places such phrases like "This code is 3000 lines!", "That game is already over 5000 lines!", etc.

What kind of lines are those precisely? Does that normally include empty lines and comment lines (in AHK it will be like lines that start with ";" or multiple lines between "/*" and "*/") or does that number account for only the valid working lines of the code (the ones that can perform some action)?

If empty lines and comment lines are included, than it seems like the phrase "A code that is consisted of 5000 lines!" can mean merely a code of, say, only a hundred of lines with the rest of the code being merely comments, in which case the phrase would be almost meaningless to me.
User avatar
TheDewd
Posts: 1391
Joined: 19 Dec 2013, 11:16
Location: USA

Re: How is the "weight" of a code measured?  Topic is solved

05 Nov 2019, 16:00

I count the total number of lines, including blank lines and lines containing comments.

In my opinion, the line count should not be used to define the worth/value of a project.

A SQL script can be written on multiple lines for better readability, however the same code can also be written on a single line. The code would produce the same result, yet one could be 30 lines while the other is only 1 line.

Clean code with proper indentation, formatting, and great readability should ultimately be the goal of a passionate developer.

Highly optimized code! Now that's something to boast about!

It's still impressive when a developer can optimize their code and use shortcuts to use the least amount of lines as possible.

"A full project, and it only took 55 lines of code! WOW! Awesome!"

If the code is already optimized, and still manages to be 5000+ lines, that's equally impressive!
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.
User avatar
Benny-D
Posts: 271
Joined: 12 Mar 2014, 10:09

Re: How is the "weight" of a code measured?

05 Nov 2019, 21:27

I see. Thank you for your reply!
User avatar
nnnik
Posts: 4461
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: How is the "weight" of a code measured?

11 Nov 2019, 03:42

I would also include other files you might have to carry around with your script in the definition.
Recommends AHK Studio

Return to “Offtopic”

Who is online

Users browsing this forum: No registered users and 3 guests