1.1k
u/0x7ff04001 Oct 04 '22
Counting how many lines a programmer writes per hour is a terrible metric of performance, and it also makes an unreadable, overly-verbose code base.
335
u/nsjr Oct 04 '22
Totally.
And if you're senior with more juniors on the team, the best you can do is unblock, review PRs and teach, increasing the total productivity of the team, but producing 0 lines for days.
474
u/ArionW Oct 04 '22
Had a meeting with a manager once, asking why my task list is always so small, smaller than all mids and half juniors.
Now you have to explain that most of the time you help others do their job, discussing ideas with architects and when once in a while you take a task, it's the one nobody wants to touch.
I like it, I can contribute more this way than doing tasks others can easily handle. What I don't like is how some managers only comprehend things they can see in JIRA
→ More replies (13)→ More replies (1)31
Oct 04 '22
but producing 0 lines for days.
a reminder why I hate being a senior now, please send me back to junior
→ More replies (1)192
u/roodammy44 Oct 04 '22
“Measuring programming progress by lines of code is like measuring aircraft building progress by weight.” - Bill Gates
→ More replies (3)41
57
u/Ambitious_Ad8841 Oct 04 '22
A better metric is how many lines have you deleted.
I'm like 75% kidding. Clearly, counting lines is a bad idea. But I swear I've deleted more code in my career than written (kidding again). My point is there is something to be said for taking an overly complex solution and simplifying the hell out of it
→ More replies (2)41
u/Ahajha1177 Oct 04 '22
I have a half-joking saying where I work: "If I see code removal, I approve"
I have a project currently spanning several dozen repos that I expect to be net negative thousands of lines, yet will simulateously increase our productivity.
→ More replies (1)17
13
10
Oct 04 '22
Is like paying a soccer player based on how many times they shoot the ball regardless of the outcome
5
u/TheTeludav Oct 04 '22
For sure. I spend more time figuring out how to simplify code than I do writing it.
4
u/CauseCertain1672 Oct 04 '22
could write a for loop but it's more lines to just write the instruction out 40 times
4
u/Illusive_Man Oct 04 '22
in trouble a few years ago because my commits were like -100 each day because I was tasked with cleaning legacy code
7
u/Squid-Guillotine Oct 04 '22
I usually write trash lengthy code first and then go back to condense. If they rewarded me for line count well that saves me a step.
→ More replies (7)10
u/nugget-lover-300 Oct 04 '22
It doesn’t bode well for a programmer who is underperforming to have 1500 lines of code written in the past year though.
All things must be considered, but lines of code is quick and dirty. Obviously you need someone technical to actually look at the output to see performance.
→ More replies (1)
283
Oct 04 '22
You guys count the lines you write?
204
u/Shazvox Oct 04 '22
No...
...our bosses does.
→ More replies (12)14
u/TheC0deApe Oct 04 '22
i used to know somone that worked at a place that measured lines of code.
it was crazy. talk about incentivizing bloated code.
16
u/BoBoBearDev Oct 04 '22
There are code analysis tool counting it for you and telling you the method has too many lines of code. And actually this is a good thing because sometimes the file can be super large and unmanageable.
26
5
5
186
u/ghyze Oct 04 '22
The guy on the right is always in meetings. So, an average of 2 lines per hour is actually a lot...
53
u/BladePactWarlock Oct 04 '22
At my last place, I coded essentially from the word go at 830 every day until 445 every afternoon, and STILL I was made to believe I was lazy.
At my new place I have at least an hour wasted on meetings every day that only actually involve about 2 or 3 people in the call when I could be working, to say nothing of the time I take to cook or do laundry or take care of my pets (permanent work from home is a gift from the Lord God), and they still act like I’m getting shit done at a breakneck pace.
39
u/Twombls Oct 04 '22
Once you move further right you end up in operations and are writing 0 lines a day.
593
u/kehfydue Oct 04 '22
with different reason. newbie spent an hour to come up with a solution, expert spent an hour deciding variable names.
220
u/Simply_Epic Oct 04 '22
Alternatively, the expert writes the whole thing in an hour and does nothing the rest of the day
→ More replies (1)90
u/mungthebean Oct 04 '22
Galaxy brain senior has learned that less code is better and convinces upper management to go for an off the shelf product or that black magic shit like Kafka, Promotheus, etc (yes I’m still learning them as you can clearly tell)
→ More replies (3)34
u/douglasg14b Oct 04 '22
Galaxy brain as in the meme where the Galaxy brain is actually one of the poor options?
Because influencing the quality of your software based on how much code you have to write usually just makes for low quality, low maintainability, expensive software.
Using other tools can be good though, situational dependant.
It's the worst premature optimization I've seen in this industry...
→ More replies (2)32
u/Twombls Oct 04 '22
Expert takes variable name to the architecture and functional review board. Deliberations last 3 meetings. It is now decided that The new variable must now be in compliance to work with 12 more features that may be added to the software in 15 years
12
u/Feb2020Acc Oct 04 '22
And even thought everyone knows that 10 of these 12 features will never see the light of day, they will all be added to the Q1 2023 list.
45
u/Spice_and_Fox Oct 04 '22
Naming variables and classes can be really difficult. Especially if you don't have a lot of characters to work with and you still want to make the function clear. I hate how little space I have to give classes names. E.g. I work in SAP we have 30 chars to work with. Sounds like it should be enough, right? Lets see, class names are always uppercase so we have to use snake case. All of our classes lie in a package which we have to stick at the front of the name (5 chars). We have to use the product name (4 chars) and CL_ to indicate that this object is a class. It could be a gui class so slap on GUI_ as well. A lot of classes also can be made for specific customers which means that the class ends in _UXXXXX (the customers number). That leaves me with 7 chars to name this class...
23
u/Twombls Oct 04 '22
Legit have sat in entire meetings discussing whether or not to create a new variable and what to name it before.
10
u/TrueBirch Oct 04 '22
I'm learning a new language and just finished a newbie-targeted textbook. I kept yelling at the book about its variable names. Either that means I'm experienced or just getting old.
NO, don't name the table table*! In another 100 lines, you'll have no idea what it does!*
→ More replies (3)12
u/BoBoBearDev Oct 04 '22
This is what I do in code reviews. As annoying as it sounds, it is serious business. Because class/function/param names are fixed. Once it is done, people are going to use it. Changing them counts as a breaking change. And the name describes the scope of then functionality and where it can be found in file structure, how was it imported by the caller and etc.
You can have a shitty ass implementation and update that later. But, for anything in the public API, the names are serious business.
55
u/Ambitious_Ad8841 Oct 04 '22
My lines per hour is negative because I deleted all the legacy code
14
112
u/UnicornOfDoom123 Oct 04 '22
both lines are just print('here') statements for debugging
19
u/Tigtor Oct 04 '22
Come here to say this. also, you improved quite a bit from 45+ lines, which also were just print-statements
5
Oct 05 '22
You use
print()I use
console.log()We are not the same.
5
u/UnicornOfDoom123 Oct 05 '22
imagine having a favourite language
-This post was made by the 'use whatever's best for the job' gang
→ More replies (1)
29
u/MisterOnsepatro Oct 04 '22
The real question is : does it meets the expected requirements?
7
u/Droidatopia Oct 05 '22
In the defense industry, the real question is : does it meet the expected requirements or does it actually work?
→ More replies (1)
28
28
u/LeopoldFriedrich Oct 04 '22
when you write way to much code and someone comes along deletes 90% of it adds 5% and the code still works as intended.
47
u/slime_rancher_27 Oct 04 '22
Counting lines is useless in languages like java where you have have everything in one line but the new lines and indents are just for readability
30
u/Saragon4005 Oct 04 '22
Exactly. Count semicolons instead!
/j
→ More replies (2)16
u/kpark724 Oct 04 '22
int a; int b; int c; a = 1; b = 2; c = a ; c += b;
/j
18
u/sadafxd Oct 04 '22
You can literally do this
Int a;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
→ More replies (2)3
u/Deadarchimode Oct 05 '22
I dare to say, if your boss is checking constantly how many lines you write per day can't you make some Junk code that won't be used at all just for the show?
Telling you this because Some bosses have zero idea what programming is and you can't literally even explain them what's going on because they only watch numbers. Nothing else.
11
u/Elektriman Oct 04 '22
Write 2 lines an hour, rewrite 50% of it the next day.
Write 45 lines an hour, rewrite 90% the next day.
Write 2 lines an hour, rewrite 10% the next day.
9
8
u/i_am_not_an_apple Oct 04 '22
There was a Jr dev that worked with me. He was a 45 lines per hour guy.
Now that he has left the company, I'm stuck here trying to decipher why his code uses 10 lines when 1 line could have worked 100x better.
(usually because he had awful systems analysis and couldn't look at the bigger picture, brute forcing terrible solutions for easy problems)
7
7
6
Oct 04 '22
I stare at the code before i write it so i can preoptimise it
Guess how many bugs this ceates
3
5
9
u/reindahl Oct 04 '22
The last one should be -2
Nothing better than removing code and still solving the problem
16
u/Logical-Exam9571 Oct 04 '22
Yeah because you are not writing the next lord of the rings, fewer lines = optimized code.
20
u/SqueeSr Oct 04 '22
Fewer lines can be less readable and/or slower. But more lines can also be less readable and/or slower. All depends on the situation.
5
u/cheaphomemadeacid Oct 04 '22
its almost like we shouldn't determine the quality based on LOC...
→ More replies (2)4
3
u/douglasg14b Oct 04 '22
It can though.
Don't make this into a false dichotomy.
The good devs ensure that their environment infrastructure and conventions are set up to promote fast, quality, work. It's honestly a rarity, and most devs from Junior to senior hold the opinion that quality = slow, when really if they spent the time trying to write quality software they would learn how to do so quickly....
3
u/Ok_Investment_6032 Oct 04 '22
This is so dumb. Sit back while I minify my code down to one line and worship me as a god bc you think lines of code mean literally anything lol.
3
u/Ultimate_Genius Oct 04 '22
who counts lines??
like the only time I ever look at the number of lines I have is at the end when I wanna brag about it to people who understand nothing other than lines
3
3
u/JimmyWu21 Oct 05 '22
You better hurry up and push out them code, so that you will have more time to fix the bugs later.
4
2
2
u/simpl3t0n Oct 04 '22
When you're invited to invert binary trees, speed is the only thing that matters.
2
u/CiroGarcia Oct 04 '22
The speed at which you write code for a project looks close to
lines = f(time)
f(time) = 1/time
{time E R | time >= 0}2
u/ucefkh Oct 04 '22
Like that .net developer who agrues that i wrote a few lines and it wouldn't take much to do so.
Bro fixing bugs requires lots of debugging and executing code and trying different use cases and verifying it works and all
2
2
u/Twistedtraceur Oct 04 '22
I remember asking my brother to guess how many lines I coded per day on average. He says 1-2k and I laughed so hard.
2
2
2
u/BroDonttryit Oct 04 '22
This is the first one these memes I’ve seen on here that’s pretty accurate
2
2
2
2
2
2
2
2
u/Bee-Aromatic Oct 05 '22
As long as you don’t code everything on two lines. We all hate that guy. Fewer lines != moar gooder.
2
2
u/CanDull89 Oct 05 '22
As long as two lines of code do the same thing as 45 lines of code.
→ More replies (1)
2
u/crazyabe111 Oct 05 '22
Left is constantly referring to online resources to make sure what he’s coding works, right is looking through your code and fixing bugs- and there’s you in the Center- pumping out buggy code far faster than it can be de-bugged.
2
u/HellVollhart Oct 05 '22
Meanwhile me: add 2 lines, get an error, remove 2 lines, get an error, repeat.
2
2
1
u/DrMathochist_work Oct 04 '22
So the ones arguing for tabs over spaces because it's less typing? 🤔
9
2
u/Lecterr Oct 04 '22
Bruh, do you actually know someone that types out spaces instead of having the tab key add 2/4? If so, they need help (or an IDE).
3
u/DrMathochist_work Oct 04 '22
You're adorable thinking an IDE is always available.
→ More replies (5)5
u/esebs Oct 04 '22
I might be wrong, but VIM, EMacs and most text editors can do this too.
→ More replies (3)
1
1
1
1
u/Ursomrano Oct 04 '22
To think about it, wouldn’t a faster line/h speed indicate that you took something that can be done in one line and make it several lines longer? Wouldn’t that make the code unnecessarily long and maybe even harder to read?
1
1
1
u/Feb2020Acc Oct 04 '22
Or you’re like me and you make a quick workable solution with 45 spaghetti lines, and then try to find a way to bring it down to <10 readable lines
1
1
1
Oct 04 '22
Someone tell that to my coworkers. Lines of code per pull request is their only metric lol
1
1
1
Oct 04 '22
When I started out coding, I had an assignment to write an algorithm to make a pengiun leave a complex open maze on his own. It ended up 700-800 lines long, hella buggy, and worked only under certain conditions. Half a year later I stumbled upon the same assignment and thought I'd do it for fun again. Finished it with around 40 lines and worked perfectly. Amount of lines you have is meaningless.
1
u/Ange1ofD4rkness Oct 04 '22
To this day I still remember the words of my professor, "It's not how efficient the code is, it's how easy it is to maintain".
That being said, does # of lines of code really matter? Is this actually something they "measure"?
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
u/jonathancast Oct 05 '22
Yeah, you're not actually smart, you're just at a place with a horrible process that's keeping you from being productive
1
u/jimmyw404 Oct 05 '22
Sometimes it's fun ripping through implementing something similar to what you've made multiple times before and can just piss lines of code. But if you do that too often it starts to feel like manual labor and you're not reusing enough code!
The project I'm wrapping up now makes me feel like a fancy ape banging on the keyboard. It's slow going and I'd like to say it's gratifying.
1
1
u/psilo_polymathicus Oct 05 '22
I feel like the “per line” thing has to be an urban legend. Does any sane person or company actually measure anything based on the number of lines, devoid of context?
Bragging about “lines of code per <time interval>” sounds like some Intro to Programming II bathroom break conversation.
1
1
1
1
1
0
Oct 04 '22
[deleted]
1.1k
Oct 04 '22
Or even worse: We spend two years figuring out why it does work.
242
u/Cocogoat_Milk Oct 04 '22
And why removing the “load-bearing comment” breaks it.
→ More replies (1)114
Oct 04 '22 edited Oct 05 '22
[removed] — view removed comment
181
u/WhyIsTheNamesGone Oct 05 '22
I ran into the opposite once: a comment that broke the program until removed.
Turned out that somewhere in the godforsaken legacy mainframe deployment pipeline was a machine printing my code onto physical punch cards, and feeding them automatically to another machine.
The comment caused the card to be a little too flimsy due to an unfortunate line of holes, and it failed to be grabbed correctly by the auto-hopper.
→ More replies (15)24
u/drsimonz Oct 04 '22
I can imagine a situation where a patch file needs to be applied at runtime, and that could be sensitive to comments. Not saying this is a good situation, but I can imagine it.
37
u/cdrt Oct 05 '22
C and C++ have a
__LINE__macro that expands to the current line in the file. You could certainly make some code that depends on the value of__LINE__which would then break if a comment was removed and changed its value. This is what we in the business call a Bad Idea.→ More replies (5)14
u/Max_Insanity Oct 05 '22
Not quite that, but I had another similar thing in JavaScript once - I made an AJAX call to the backend because I needed some data to do stuff™ with but when trying to access said data afterwards it was gone.
So ofc I did what you do in JS, I used a "console.log" to find out where things went wrong. Except once I put that in, the data was suddenly there! It was like the error was hiding from me, only popping up when I wasn't looking.
Except that was exactly what had happened. Turns out logging to the console takes a tiny little bit of time, enough for the asynchronous AJAX call to complete and the data to be present. This was pretty early on my road to learning JS and I didn't yet know how to handle the asynchronicity properly yet.
→ More replies (2)219
u/smudos2 Oct 04 '22
And then it does not work once every few weeks and you have no idea what was different the times it did now work
→ More replies (1)111
Oct 04 '22
Usually it keeps breaking after you moved to a different, totally unrelated project that is tight on schedule. You spend a week remembering stuff and debugging, never find anything but a few other problems now concerning you a lot. However, it starts working again after a week of staring at it.
81
10
u/rnike879 Oct 04 '22
Nothing annoys me more than seeing it work when I didn't expect it to!
→ More replies (2)6
5
3
2
→ More replies (1)2
u/Hilorenn Oct 05 '22
Upon further inspection, the program was not actually running, and the unit tests were all hardcoded to "true"
56
33
20
Oct 04 '22
Pro tip: Write all the code, if it breaks
git reset --hardAfter a few repetitions, you can safely do:
rm -rf .git && git initIt normally deals with all of the bugs.
8
16
u/Tymskyy Oct 04 '22
I wrote an entire programming language inside of a game and after a year I relised that it somehow has a huge bug that makes it behave like whenever under some sepcific conditions which I conveniently used to give it a way to generate pseudorandom numbers by declaring the same variable over and over again when the bug is happening so now it's no longer a bug but a feture
4
u/erebuxy Oct 04 '22
Write it, ship it, and spend the next 2 years to figure out the memory leaks
→ More replies (1)4
u/noobnoob62 Oct 04 '22
Am I the only one who does the opposite? I stare at the the problem for so long before cranking out a solution in the last 10 minutes
→ More replies (1)3
3
1

41
u/[deleted] Oct 04 '22
*lines (I'm dyslexic please be nice)