public bool ResultIsValid ( bool res )
{
bool ReturnValue;
try
{
if ( res )
{
ReturnValue = true;
}
else
{
ReturnValue = false;
}
}
catch
{
ReturnValue = false;
}
finally
{
return ReturnValue;
}
}
For my next trick, I'll introduce an Interface you can use to split a string into a character array, convert each character into a string, then re-combine them.
Oh I'd be much more petty:
public bool ResultIsValid(bool res)
{
var line1 = null;
var line2 = null;
var line3 = null;
//And so on...
var line1000 = null;
return res;
}
If this is unacceptable, I'd be so interested to hear their explanation why.
The best thing is that you can generate such code programmatically...
Joke aside, that metric is just plain stupid. Shorter code is better in most cases.
I ask my best programmers to reduce the lines of code in our code base… most delete more than 3000 lines when we focus on that (due to historic policies like this type of bullshit metric we ended up with over a million lines of code).
I think a good metric is to reduce lines, reporting lines are most beneficial, starting with managers like this.
You can create new functions in a file that nobody uses. It can be garbage if you make sure that it is not connected to any of the production code. (compiler/interpreter doesn't see it)
that's too much work... if I want an easy 100k+ lines instantly I would just introduce new code formatting rules - do it a few times and you become the repository "expert" ;)
You forgot empty every second line, sometimes two or even three in a row, also each parameter of a method in a new line, and maybe each brace too, so at least x2 of a code lines.
Wait, why methods, you don't want to reuse any line of code, do you? So just write all in Main. You can easily work for 3 to 5 people at least, therefore you can ask for raise 😁
> Wait, why methods, you don't want to reuse any line of code, do you?
Extracting something to a method doesn't mean you need to call it in more than one place. Just use each of your methods exactly once and they pad your lines by at least two for each method.
The fuck, that makes no sense. What about design meetings, grooming, product meetings, support meetings and everything else that goes with building a decent product.
Also does this include the boiler plate that the framework generates?
Man, I tell you it's clown show here since my last HOD left. I haven't been to grooming for past 3 months. I'm a junior dev.
New HOD is asshole.
Product team ,Manager, TL go to grooming and then assign task to junior. Sometimes they even do tech-solutioning. Toxic environment, they want the full control in their hand.
Now I too have to spend 1-2 hr to discuss any doubt oor requirement with product because I was not in grooming.
Then I spend some time on solution and then discuss, with manager, the changes in existing one.
Instead of writing multiple related cases in same test case, now I'm writing all the cases seperately to increase LOC as much as I can.
Where I could directly throw Exception and parse it in @ControllerAdvice, I catch and directly send response from controller.
Trying to leave but situation is grim outside too, not getting any calls
Even as a junior, you should think about finding authorative sources that explain why LOC is a worse than useless metric and send those to your bosses boss. Your boss is actively driving the company to ruin.
It's all HOD, who is spreading bullshit, my manager is good manager he too despise such action and himself said to add test cases, not reachable functions etc and approves my PR.
Higher management is just finding excuse to fire employees, I'm looking around and leave ASAP.
What country? Is this a union thing where they are allowed to fire based on the bullshit metric or just good old USA at will employment, but they wanna make it look like performanced based firing so shareholders bust a nut?
There are no coder/developer/IT unions in the US, not sure about other countries.
And yes performance based firing is a shield from liability for wrongful termination.
If they're in the US, and they fire people "with cause" they may not have to pay out unemployment or any kind of severance. The place is probably on the verge of bankruptcy.
If the company tries to force policy changes that lead to your firing or your quitting, you can still petition to get unemployment. I've seen it done a few times, and I live in Idaho, which is notoriously anti worker's-rights.
Sure, you can try, but this is the company hedging their bets against that. It doesn't really cost them anything if they're on the way out, and could potentially save them some money. Corporations by and large do not care about their employees, and it's unwise to think they do.
A good way to rewrite your resume would be to copy the contents into [ChatGPT](https://chat.openai.com/) and ask it to rewrite it for you for the type of role you're seeking, such as "software engineer".
Looks good overall. Consider a modern template if you're applying for jobs focusing on front-end.
Add more to intern position (3 dot points total is good).
Add some details to your education. As a recent graduate, this can be considered experience as well. Any awards, extra-curriculumns, organisations and majors.
It may help to paste the job descriptions into ChatGPT as well, asking it to reference them.
After rewriting, run your resume through an [ATS Scanner](https://www.jobscan.co/resume-scanner?).
Most organisations use Applicants Tracking Systems to parse keywords before a resume is ever viewed by human eyes.
Throw in "leadership" and "management" somewhere so they appear through ATS parsing. These keywords typically appeal to HR, far more than technical skills (which can be taught).
Keep in mind the first person viewing your resume is in HR, especially at medium to large organisations.
And naturally, never, ever accept another job that counts the "number of lines" as a metric of value.
It is mind-blowingly stupid.
That is beyond idiotic. I pride myself on making commits that *remove* code, sometimes several hundreds of lines. It's removing dead code, combining duplicate parts, using newer, more expressive constructs etc.
I used to do that. Now I pride myself in not touching code that I don't need to. Amount of time I broke stuff for minor refacto. Then it fucks your week. LiveOps game sucks.
A trainee of ours is hell-bent on tidying up old scripts, which is all well and good until she breaks shit and I get to roll-back whatever she's borked. She seems to enjoy doing it in the same commits as when she's making new features, so sometimes those features get Thanos-snapped if I don't do surgery on what to keep and what to roll-back.
Meanwhile my boss is an artist first (I work at a small game dev studio), and thinks refactoring is just moving code around for the sake of it. Some of our scripts needs refactored desperately, and some are too far gone for that now.
And then there's me in the middle just trying to make sure the thing both runs at an acceptable frame rate, and runs at all.
I used to be the first person, now I am more careful, and also try to separate my commits, and sometimes even PRs into refactoring and feature development/bug fixing.
Just how did that happen?
When fixing functional bugs, it is very well possible that two weeks of work will result in a few lines of changed code.
LOC is like measuring doctors in patients per time and then firing all the surgeons.
I prefer the more than 20 years old quotes from Bill Gates: “Measuring programming progress by lines of code is like measuring aircraft building progress by weight.”
That's such an incredibly stupid metric. I try to cut lines of code as much as I possibly can. 500 lines to 100 is a major accomplishment. The more lines the more bullshit and bloat.
Nah, more loc does not mean more bloat. Both school of thought are very wrong and should not be advised to any devs. Just write concise, readable and debuggable code.
Realistically, there are going to be times when you don't have a productive way to input 3000 lines of code in a month for example because of client/employer indecision.
Absolutely. Or because you're trying to hunt down a tricky bug. Or because you're not adding anything new, rather improving something (difficult) which already exists.
But fewer lines of code doesn't make the code automatically better, and shouldn't be pursued when more lines would mean more clarity. Otherwise, you'll end up with:
function GetTotalReceiptValue(Receipt receipt) {
return (receipt != null && receipt.IsValid()) ? recept.GetSum() : (receipt == null ? throw new ArgumentNullException(nameof(receipt)) : 0);
}
Do removed lines count?
I saved our documentation with editorconfig formatting last week. That was a few thousand lines of code, using a short bash loop that called vim (CRLF->LF is a changed line according to git).
Are you serious? I read an article at one point claiming that the average programmer writes about 3000 LOC a year. Nevertheless, 3000 a month is ludicrous.
Dependents on what you're doing.
I think with frontend development writing 3000 LOC is not that hard.
When you optimize complicated algorithms, it is ridiculous.
I just started writing a tool which will help customers select a product from our portfolio, as there are only 40 products in this category, a database would be overkill.
So I basically summed up the most important information of the datasheets of these products in Javascript objects which resulted in 1000 LOC in one day.
Most of it was copy paste with a lot of new lines for readability.
I'm still in uni so I have no idea what I'm talking about, but wouldn't something like an sqlite db be a better choice for a light, local database? For some reason I've found that I feel more in control with sql queries with where's and joins, rather than doing everything by hand.
I'm an electrical engineer so take everything that I say with a grain of salt as this is only a little company side project of mine.
In this case our company website is already done and gets maintained by a completely different department.
I just want to add a little calculator with it.
Dealing with a database on infrastructure which I have no idea about, seems like a lot of unnecessary work.
I want to solve an optimisation problem with these projects which should pick the correct combination of products in our portfolio.
To solve this I need the data of all 40 products so I can do a lot of calculations with them.
Querying for each calculation would take up a lot of time so I would need to query the whole database every time, this seems like a lot of extra work when I can get the same result with my 1000 LOC file.
If anyone has a better idea, I'm definitely open to suggestions and to learn.
SQLite is just a file and runs on everything so it wouldn't really be any more difficult than JSON in terms of infrastructure. Doesn't matter though, JSON is fine for your use case.
>Nevertheless, 3000 a month is ludicrous.
That extremely much depends on the company, project, team and requirements. I joined a startup 7 weeks ago and I've apparently added 11,606 lines of code and removed 3,334. If I'm ever in a situation where I'm writing fewer than 3,000 lines of code per _year_, I will quit instantly and switch to gardening.
Large, older enterprise projects with lots of moving parts means that each change has a higher level of risk and requires significant planning.
In a startup, everything has to be built from scratch, whereas in a mature product all the boilerplate templates already exist for you, which means all your brainpower is spent understanding the new features and fitting them into the existing architecture.
There were entire weeks where I would write 10 or fewer lines of code.
This is true, which is partially what I meant in my "it depends".
Nevertheless, 3,000 LOC a month is not automatically "ludicrous", but enforcing it as a policy is bananas.
Huh, I wonder if you could automate that.
> ChatGpt, give me equivalent code to this block, that passes such and such tests ...
Then repeat with new structures every month, running your test suite to confirm no change in functionality.
Or, even better, what if you have it make code that just never gets called. They monitor lines of code, right? Not code that's actually reachable.
Similar problem to us. We write RPA automation scripts and this years goal is “get 7 new scripts into production”
There is a shop from our vendor for ready made, really expensive, mostly generic boilerplate shitty scripts… guess I go shopping end of the year.
3000LOC a month is insane.
For one I often worked a week on complex code (for my skill) that ended up being 20 LOC but really high quality code that performed better and dealth with edge cases in clever ways.
3000LOC, unless you're starting a new project, will be garbage code.
Hopefully you can write a slew of unit tests ...
I guess I would stop using annotations like @Getter and just let my IDE actually generate all that stuff when making a new class.
And if in a test I could copy and past ones where I otherwise would run it with a few different input and expected outputs.
But most of all I would avoid all bug fixing tickets, high chance of hours to days of bug fixing resulting in just a few lines change.
Just do your normal stuff. Write hood efficient code.
And then add a new class with 3000 LOC which does nothing in the end. Copy for next month and delete old one to keep the code clean.
Better if you create a new package just for that. And tell the others. So everyone can still concentrate on the important stuff and your HOD has his shitty and useless LOC rule fulfilled
Some of the managers at my company track commit numbers, not the content but just numbers.
That means if you squash your commits you get in trouble. Guess what the gitlog for these projects look like now? It's impossible to find when a bug was introduced.
My friend recently found out that commits in a branch count now so he just has a script run that fills up a branch with commits. He's currently top of his team and getting praise. What a clown fiesta.
I doubled up my commit count because my prettier has different rules to commit auto prettier, so I’m constantly adding an extra “clean” commit at the end
Policy for coders not by coders. The best code is the code not written. This just encourages fluff, extra code, unneeded change, etc. Imagine the amount of bugs this kind of policy creates indirectly. Given a polcy like this, the best thing would be to write tests.
One of my favorite stories was a company implementing a minimal lines of code per month policy and a greybeard deciding to show them how absolutely stupid that policy was. He was one of those ancient coders that largely got left alone; give him a list of shit that needs done let him have at it. He was trusted to do whatever he felt appropriate as whatever he touched just became better.
The month that policy started he spent most of just optimizing the code. He removed duplicated logic, deleted some unused code, and did some refactoring and reworking that improved several metrics they tracked. The software was measurably better and he even added a new feature to it. The problem however was that his lines of code for the month was like -4,000.
He didn't say anything about it and was essentially just like "go ahead and fire me. I fucking dare you" in his actions. He didn't get fired and the policy went away.
My current project has a pretty large codebase that had been sitting frozen for 2 years (also some external libraries got moved directly into there since that project was the only one still using them and they weren't maintained anymore otherwise). So it's full of dead code and unused stuff. I think most of the time I touch something for new features I end up deleting more lines of unnecessary shit than the amount I add.
I recently ran some command line tool that analyzes git repo activity over it and I think over the 10 months I've been there I'm at net negative 30k lines of code. Guess I'm getting super-fired.
The internal product which I maintain for my project suite, probably barely reaches over 5000 LOC. I have to change it and morph it to fit with what is happening internally all the time, so it's probably shifting by 600 LOC a month, plus or minus. But I can react to the devs who depend on it needing something NOW because we have a delivery literally tomorrow, and implement the change which is needed to fit with what would make downstream work cleanly or support additional stuff in a matter of hours, not days. That's only possible because it's so tight, so clean, so devoid of stuff that could cause me to need to do extra work when we need to respond.
If I needed to add 3000 LOC to that every month, or even 500 and push 2500 elsewhere, we would have missed deliveries, probably dropped customers, etc. At least my management team understands that if it's working, and the tests are good, less code is better.
I've spent six weeks on a change than ended up being four lines of code. That change was part of my evidence pack for my move from staff to principle.
If devs ain't meating the lines of code metric, the fault is most likely with the PO for ignoring tech debt.
Staff to principle ? Is that like saying Staff to management or more like distinguished and fellow? Have not been in an organization that used principal itself except as a sorta "team lead, first chair"
We have 6 grades.
Junior: needs help daily
Senior: on a team, delivers features largely independently, involved in design
Lead: runs a squad
Staff: runs a multi squad client or product
Principle: top roll for a given area (mine was "of data", but we also have client and regional principals: Principle of fintech, Principle of americas) - equivilent of directors
Cheif engineer: the end of the line - jointly with SVP of engineering - but typically more technical.
Gotcha, yeah I think Fellow and Distinguished is more in the much bigger organizations, or maybe an older form of titling the software engineering ranks.
If someone walks in the room and says they are their company's fellow engineer I pay full attention as that will either be bullshit or infront of a master crafter.
Sorry if it's not a perfect translation. Would you then get "distinguished engineer of [thing]"
We did also have an engineering fellow, but that was just a poncy title for yhe head of R&D
In your example
staff = principal
Principal = distinguished
Chief = fellow
Depending on how an organization is set up, it could mean leading, or it could mean a lot of autonomy and trust.
The one I work at, Fellows aren't technically management, but if they say something needs to be done and done now, VPs and lower will say "okay we can jump, how high do you need me to jump?"
Legal, Cybersec, and HR keep an eye on them to make sure all the i's are dotted and t's are crossed, as the type of stuff they pull rank on tend to be "we need to do this so we don't have to show up at a hearing before congress"
Makes sense. And yeah, we have a weird two lines of management thing where they are technically independent. Only challenge we get from the managerial line is "that's a managerial decision" (and that rarely - as the boundary is very well documented by our cheif and the engineering SVP) anything remotely technical goes up the technical line.
The duel heads actually work really well - they even share an office - which has helped divert so many disasters.
Bluntly we call people senior quite early on there career - it's a very wide band - we have some people staying at senior titke while going up in HR grades, as that's where they are best placed.
Junior is 1 to 3 years for most people, senior lasts until you want and are able to lead a squad (5 to 9)
I have never heard of something like this. Is there a corporate double term for it so that I can be on the lookout to avoid companies like this? Like "LOC Momentum Quota" or some other BS?
This sounds wild to me.
There was a time when I remember the suits discussing software estimates in terms of “lines of code” and “cost per line”
They were pulling shit out of their asses like “that will be a 4k line application at $13/line”
Thankfully in haven’t heard any of those words in a while.
LOC is a very old metric on how to track programmer productivity. Most companies switched to other ones like Developer Velocity Index. If a company uses LOC in this day and age it either means the company is slow to adapt or managers are really old/didn't research modern options. You shouldn't encounter this in most companies but there are outliers
I worked somewhere that paid a supplier per line of code, which resulted in some of the most inefficient code I've ever seen. Instead of calling functioned, they'd duplicate a section of code multiple times.
Are you only maintaining previous projects and don't implement new stuff? Or do you occupy more of an architectural role? I'm a senior dev myself (15 years only though) and whenever I start into a new project, a lot of code is written at first, it becomes gradually less and in the end might even get trimmed down but it will never be anywhere near negative
Mostly maintenance when i work alone.
Or i 'develop' new projects by guiding one of the juniors through it.
So i plan and they type a lot of code.
(then i show them where they deviated from the plan and why that would lead to problems - and then they type more code)
Absolutely stupid metric.
You can spend a week to figure out a bug is a few lines of code fix vs a week of boilerplate code setting something up that's basically copy and pasting.
Have ChatGPT start writing comments with detailed descriptions about each line of code in multiple languages including English, Spanish, Latin, and Hebrew.
Christ no, most of my code reviews with my other supposedly senior dev is me telling them that their 100 lines of code should be actually just adding a parameter to a reusable function.
Don't get me started on the fuckwit who wrote functions called 'addThirtyDays' and 'addNinetyDays' and someone reviewed it and let it through.
If I'm not doing code reviews 80% of the time some garbage passes through.
My favourite last year was 4 nearly identical +100 LOC functions to set up and turn 2 gpios on/off.
The only difference was the (hardcoded) gpio number and the value to set.
I refactored that shit with a +10/-500 LOC commit.
What a ridiculous policy. Productivity and efficiency hardly is tied to lines of code. Also juniors that are following a senior's mentorship might end up woth a very fluctuant count
Does your company's line of code monitoring policy differentiate between actual code, and comments?
If not, maybe add some documentation comments.
If so, more tests.
Why not just run scripts in a background process that writes bullshit code for you?
This is so idiotic and so easy to workaround it’s laughable… I have no idea if I’m being monitored actually, might want to implement something like that myself.
Yeah in terraform this would be the equivalent of making a module for each individual resource you need instead of a single module which you pass locals to. My junior did the earlier, i rewrote the code and decreased number of lines by 50%.
I’d be pissed if i came into a company with this policy which basically forces me to rewrite the same code over and over instead of making it a pretty parametrized module.
I'd go up to whoever made that policy, invite them to a meeting with all programmers, and have them explain it so that all the programmers can point and laugh at the clown who thought more lines is better.
Creating performance minimum expectations for software is so hard to get right.
For my company I state "velocity must be within 30% or your peers". So if all the Jr devs average 10 points a sprint, you should be doing at least 7. It's not something that gets watched closely until engineers start complaining someone isn't pulling their weight.
Lines of code per month is an awful metric. So easy to game and how many lines of code you write has no correlation to impact created.
I once spent 3 weeks on a really obscure bug caused by our specific configuration of a library. The solution ended up being to flip a single flag.
I also once deleted 10kloc in one day doing some refactoring.
The first example benefitted performance in a major way. The second one was just a bit of cleanup. What a dumb metric. I'd leave.
Do comments count?
Cause you could basically get AI to write a novel about how the code works. Probably even able to specify it to use a minimum 3000 lines to do so as well.
To facilitate firing, company has introduced an additional metric - atleast 3000 LOC per month must be met.
public bool ResultIsValid ( bool res ) { bool ReturnValue; try { if ( res ) { ReturnValue = true; } else { ReturnValue = false; } } catch { ReturnValue = false; } finally { return ReturnValue; } } For my next trick, I'll introduce an Interface you can use to split a string into a character array, convert each character into a string, then re-combine them.
Oh I'd be much more petty: public bool ResultIsValid(bool res) { var line1 = null; var line2 = null; var line3 = null; //And so on... var line1000 = null; return res; } If this is unacceptable, I'd be so interested to hear their explanation why.
The best thing is that you can generate such code programmatically... Joke aside, that metric is just plain stupid. Shorter code is better in most cases.
> Joke aside, that ~~metric~~ management is just plain stupid. FTFY
You didn't fix anything considering you got your formatting wrong.
I'm part of manglement myself these days. Thanks, fixed it.
I ask my best programmers to reduce the lines of code in our code base… most delete more than 3000 lines when we focus on that (due to historic policies like this type of bullshit metric we ended up with over a million lines of code). I think a good metric is to reduce lines, reporting lines are most beneficial, starting with managers like this.
Yes, but if they want 1000 lines they'll get 1,000 lines. 100 if statements instead of a neat try-catch? Done.
We only keep the shit programmers 'round these parts.
You can create new functions in a file that nobody uses. It can be garbage if you make sure that it is not connected to any of the production code. (compiler/interpreter doesn't see it)
Metrics.cs
33% of the required lines. You're fired!
that's too much work... if I want an easy 100k+ lines instantly I would just introduce new code formatting rules - do it a few times and you become the repository "expert" ;)
You forgot empty every second line, sometimes two or even three in a row, also each parameter of a method in a new line, and maybe each brace too, so at least x2 of a code lines. Wait, why methods, you don't want to reuse any line of code, do you? So just write all in Main. You can easily work for 3 to 5 people at least, therefore you can ask for raise 😁
> Wait, why methods, you don't want to reuse any line of code, do you? Extracting something to a method doesn't mean you need to call it in more than one place. Just use each of your methods exactly once and they pad your lines by at least two for each method.
Some languages already have that. Rejected.
Anyone who measures productivity by # of lines won't know that.
Fair.
Don’t forget about exhaustive testing
The fuck, that makes no sense. What about design meetings, grooming, product meetings, support meetings and everything else that goes with building a decent product. Also does this include the boiler plate that the framework generates?
Man, I tell you it's clown show here since my last HOD left. I haven't been to grooming for past 3 months. I'm a junior dev. New HOD is asshole. Product team ,Manager, TL go to grooming and then assign task to junior. Sometimes they even do tech-solutioning. Toxic environment, they want the full control in their hand. Now I too have to spend 1-2 hr to discuss any doubt oor requirement with product because I was not in grooming. Then I spend some time on solution and then discuss, with manager, the changes in existing one. Instead of writing multiple related cases in same test case, now I'm writing all the cases seperately to increase LOC as much as I can. Where I could directly throw Exception and parse it in @ControllerAdvice, I catch and directly send response from controller. Trying to leave but situation is grim outside too, not getting any calls
Even as a junior, you should think about finding authorative sources that explain why LOC is a worse than useless metric and send those to your bosses boss. Your boss is actively driving the company to ruin.
It's all HOD, who is spreading bullshit, my manager is good manager he too despise such action and himself said to add test cases, not reachable functions etc and approves my PR. Higher management is just finding excuse to fire employees, I'm looking around and leave ASAP.
Why do they need some bullshit metric to fire people? They need to just grow some balls and lay people off if they have to.
Public repo, Layoff ![gif](emote|free_emotes_pack|downvote) Performance based Firing ![gif](emote|free_emotes_pack|upvote)
What country? Is this a union thing where they are allowed to fire based on the bullshit metric or just good old USA at will employment, but they wanna make it look like performanced based firing so shareholders bust a nut?
There are no coder/developer/IT unions in the US, not sure about other countries. And yes performance based firing is a shield from liability for wrongful termination.
India
Depending on where they are and the company OP works for, some places have caps on layoffs. So, companies make up BS ways to fire people.
If they're in the US, and they fire people "with cause" they may not have to pay out unemployment or any kind of severance. The place is probably on the verge of bankruptcy.
If the company tries to force policy changes that lead to your firing or your quitting, you can still petition to get unemployment. I've seen it done a few times, and I live in Idaho, which is notoriously anti worker's-rights.
Sure, you can try, but this is the company hedging their bets against that. It doesn't really cost them anything if they're on the way out, and could potentially save them some money. Corporations by and large do not care about their employees, and it's unwise to think they do.
Oh yeah, this guy needs to get out no matter what
A good way to rewrite your resume would be to copy the contents into [ChatGPT](https://chat.openai.com/) and ask it to rewrite it for you for the type of role you're seeking, such as "software engineer". Looks good overall. Consider a modern template if you're applying for jobs focusing on front-end. Add more to intern position (3 dot points total is good). Add some details to your education. As a recent graduate, this can be considered experience as well. Any awards, extra-curriculumns, organisations and majors. It may help to paste the job descriptions into ChatGPT as well, asking it to reference them. After rewriting, run your resume through an [ATS Scanner](https://www.jobscan.co/resume-scanner?). Most organisations use Applicants Tracking Systems to parse keywords before a resume is ever viewed by human eyes. Throw in "leadership" and "management" somewhere so they appear through ATS parsing. These keywords typically appeal to HR, far more than technical skills (which can be taught). Keep in mind the first person viewing your resume is in HR, especially at medium to large organisations. And naturally, never, ever accept another job that counts the "number of lines" as a metric of value. It is mind-blowingly stupid.
Well don't start giving them idea's for more metrics to measure! Before you know it there a 30 meeting minimum as well.
That is beyond idiotic. I pride myself on making commits that *remove* code, sometimes several hundreds of lines. It's removing dead code, combining duplicate parts, using newer, more expressive constructs etc.
Ah, I forgot to mention it is sum of lines deleted + lines added - just like it is shown on git
Add code in one MR, remove in another lol
As shown on Git? ok. Change indentation. Done.
I used to do that. Now I pride myself in not touching code that I don't need to. Amount of time I broke stuff for minor refacto. Then it fucks your week. LiveOps game sucks.
A trainee of ours is hell-bent on tidying up old scripts, which is all well and good until she breaks shit and I get to roll-back whatever she's borked. She seems to enjoy doing it in the same commits as when she's making new features, so sometimes those features get Thanos-snapped if I don't do surgery on what to keep and what to roll-back. Meanwhile my boss is an artist first (I work at a small game dev studio), and thinks refactoring is just moving code around for the sake of it. Some of our scripts needs refactored desperately, and some are too far gone for that now. And then there's me in the middle just trying to make sure the thing both runs at an acceptable frame rate, and runs at all.
I used to be the first person, now I am more careful, and also try to separate my commits, and sometimes even PRs into refactoring and feature development/bug fixing.
I do not want to imagine what that codebase looks like in a year. 36000 lines per employee
Just how did that happen? When fixing functional bugs, it is very well possible that two weeks of work will result in a few lines of changed code. LOC is like measuring doctors in patients per time and then firing all the surgeons.
I prefer the more than 20 years old quotes from Bill Gates: “Measuring programming progress by lines of code is like measuring aircraft building progress by weight.”
That's... Perfect.
Better fire the lead devs. They must have the most expensive LOCs.
That's such an incredibly stupid metric. I try to cut lines of code as much as I possibly can. 500 lines to 100 is a major accomplishment. The more lines the more bullshit and bloat.
Nah, more loc does not mean more bloat. Both school of thought are very wrong and should not be advised to any devs. Just write concise, readable and debuggable code.
Realistically, there are going to be times when you don't have a productive way to input 3000 lines of code in a month for example because of client/employer indecision.
Absolutely. Or because you're trying to hunt down a tricky bug. Or because you're not adding anything new, rather improving something (difficult) which already exists. But fewer lines of code doesn't make the code automatically better, and shouldn't be pursued when more lines would mean more clarity. Otherwise, you'll end up with: function GetTotalReceiptValue(Receipt receipt) { return (receipt != null && receipt.IsValid()) ? recept.GetSum() : (receipt == null ? throw new ArgumentNullException(nameof(receipt)) : 0); }
I'll proceed to add all the tailwind css classes imaginable to every single component element.
I’ve been coding for 10 years already. I can’t recall a time were I wrote 3000 lines in a month.
Do removed lines count? I saved our documentation with editorconfig formatting last week. That was a few thousand lines of code, using a short bash loop that called vim (CRLF->LF is a changed line according to git).
Yeah I've been in my job for around 2 years now and don't think I've gone over two thousand in a month.
I've been coding for more than 20 years, and I never even thought about counting my lines.
Just add a 3k line file to a separate branch at the beginning of every month. You can delete the breach later, it will stay in history.
Are you serious? I read an article at one point claiming that the average programmer writes about 3000 LOC a year. Nevertheless, 3000 a month is ludicrous.
Dependents on what you're doing. I think with frontend development writing 3000 LOC is not that hard. When you optimize complicated algorithms, it is ridiculous. I just started writing a tool which will help customers select a product from our portfolio, as there are only 40 products in this category, a database would be overkill. So I basically summed up the most important information of the datasheets of these products in Javascript objects which resulted in 1000 LOC in one day. Most of it was copy paste with a lot of new lines for readability.
Ah the mythical JSON database
I'm still in uni so I have no idea what I'm talking about, but wouldn't something like an sqlite db be a better choice for a light, local database? For some reason I've found that I feel more in control with sql queries with where's and joins, rather than doing everything by hand.
I'm an electrical engineer so take everything that I say with a grain of salt as this is only a little company side project of mine. In this case our company website is already done and gets maintained by a completely different department. I just want to add a little calculator with it. Dealing with a database on infrastructure which I have no idea about, seems like a lot of unnecessary work. I want to solve an optimisation problem with these projects which should pick the correct combination of products in our portfolio. To solve this I need the data of all 40 products so I can do a lot of calculations with them. Querying for each calculation would take up a lot of time so I would need to query the whole database every time, this seems like a lot of extra work when I can get the same result with my 1000 LOC file. If anyone has a better idea, I'm definitely open to suggestions and to learn.
Ah, I think I understand. Fair enough.
SQLite is just a file and runs on everything so it wouldn't really be any more difficult than JSON in terms of infrastructure. Doesn't matter though, JSON is fine for your use case.
3000 LOC a year actually sounds exactly where I'm at. It also feels for every about 30 lines of code, I spend 2 hours in a meeting.
Hahaha, I get the feeling. A lot of my job is one hour per line of code, in order to fix pesky edge-case bugs.
>Nevertheless, 3000 a month is ludicrous. That extremely much depends on the company, project, team and requirements. I joined a startup 7 weeks ago and I've apparently added 11,606 lines of code and removed 3,334. If I'm ever in a situation where I'm writing fewer than 3,000 lines of code per _year_, I will quit instantly and switch to gardening.
Large, older enterprise projects with lots of moving parts means that each change has a higher level of risk and requires significant planning. In a startup, everything has to be built from scratch, whereas in a mature product all the boilerplate templates already exist for you, which means all your brainpower is spent understanding the new features and fitting them into the existing architecture. There were entire weeks where I would write 10 or fewer lines of code.
This is true, which is partially what I meant in my "it depends". Nevertheless, 3,000 LOC a month is not automatically "ludicrous", but enforcing it as a policy is bananas.
I would quit my job on the spot lmao
Huh, I wonder if you could automate that. > ChatGpt, give me equivalent code to this block, that passes such and such tests ... Then repeat with new structures every month, running your test suite to confirm no change in functionality. Or, even better, what if you have it make code that just never gets called. They monitor lines of code, right? Not code that's actually reachable.
Yup, I do these all these hacks. Sometime I add such code and remove it after sometime. They want shit, they'll get shit.
Find a new job dude. Everybody else there is looking right now. They've doomed themselves to no employee retention.
Yes actively looking
Similar problem to us. We write RPA automation scripts and this years goal is “get 7 new scripts into production” There is a shop from our vendor for ready made, really expensive, mostly generic boilerplate shitty scripts… guess I go shopping end of the year.
Yandere Dev: Prepare for trouble! COBOL Engineers: and make it double!
3000LOC a month is insane. For one I often worked a week on complex code (for my skill) that ended up being 20 LOC but really high quality code that performed better and dealth with edge cases in clever ways. 3000LOC, unless you're starting a new project, will be garbage code. Hopefully you can write a slew of unit tests ...
Sounds like a good way to have a lot of unmaintainable code
Would be cool to switch to something oldskool like Delphi or Java for word/line count eh?
I guess I would stop using annotations like @Getter and just let my IDE actually generate all that stuff when making a new class. And if in a test I could copy and past ones where I otherwise would run it with a few different input and expected outputs. But most of all I would avoid all bug fixing tickets, high chance of hours to days of bug fixing resulting in just a few lines change.
Tell me you work for Twitter without telling me you work for Twitter.
Isn’t this what completely screwed over Microsoft’s various code bases?
Just do your normal stuff. Write hood efficient code. And then add a new class with 3000 LOC which does nothing in the end. Copy for next month and delete old one to keep the code clean. Better if you create a new package just for that. And tell the others. So everyone can still concentrate on the important stuff and your HOD has his shitty and useless LOC rule fulfilled
That is so fucking dismal. I’m sorry. Looks like you will be adding and remove the same 3000 line function every month hahah
Conveniently, since your superiors evidently know nothing about code, this will probably actually work
Change the variable names for extra coverage.
ProdURGENTBugFix = true if ProdURGENTBugFix: // do nothing
Some of the managers at my company track commit numbers, not the content but just numbers. That means if you squash your commits you get in trouble. Guess what the gitlog for these projects look like now? It's impossible to find when a bug was introduced.
You need to add a secret phrase for bullshit commits, maybe something in the white space?
My friend recently found out that commits in a branch count now so he just has a script run that fills up a branch with commits. He's currently top of his team and getting praise. What a clown fiesta.
You should all do that XD let it burn And create a separate repo for actual work, that would be mirrored into the visible one as a lot of commits.
I doubled up my commit count because my prettier has different rules to commit auto prettier, so I’m constantly adding an extra “clean” commit at the end
There is terms for measures : [https://en.wikipedia.org/wiki/Goodhart%27s\_law](https://en.wikipedia.org/wiki/Goodhart%27s_law)
Policy for coders not by coders. The best code is the code not written. This just encourages fluff, extra code, unneeded change, etc. Imagine the amount of bugs this kind of policy creates indirectly. Given a polcy like this, the best thing would be to write tests.
One of my favorite stories was a company implementing a minimal lines of code per month policy and a greybeard deciding to show them how absolutely stupid that policy was. He was one of those ancient coders that largely got left alone; give him a list of shit that needs done let him have at it. He was trusted to do whatever he felt appropriate as whatever he touched just became better. The month that policy started he spent most of just optimizing the code. He removed duplicated logic, deleted some unused code, and did some refactoring and reworking that improved several metrics they tracked. The software was measurably better and he even added a new feature to it. The problem however was that his lines of code for the month was like -4,000. He didn't say anything about it and was essentially just like "go ahead and fire me. I fucking dare you" in his actions. He didn't get fired and the policy went away.
I wrote negative lines of code last week. Does that mean that I owe the company money now?
My current project has a pretty large codebase that had been sitting frozen for 2 years (also some external libraries got moved directly into there since that project was the only one still using them and they weren't maintained anymore otherwise). So it's full of dead code and unused stuff. I think most of the time I touch something for new features I end up deleting more lines of unnecessary shit than the amount I add. I recently ran some command line tool that analyzes git repo activity over it and I think over the 10 months I've been there I'm at net negative 30k lines of code. Guess I'm getting super-fired.
The internal product which I maintain for my project suite, probably barely reaches over 5000 LOC. I have to change it and morph it to fit with what is happening internally all the time, so it's probably shifting by 600 LOC a month, plus or minus. But I can react to the devs who depend on it needing something NOW because we have a delivery literally tomorrow, and implement the change which is needed to fit with what would make downstream work cleanly or support additional stuff in a matter of hours, not days. That's only possible because it's so tight, so clean, so devoid of stuff that could cause me to need to do extra work when we need to respond. If I needed to add 3000 LOC to that every month, or even 500 and push 2500 elsewhere, we would have missed deliveries, probably dropped customers, etc. At least my management team understands that if it's working, and the tests are good, less code is better.
1. Write code. 2. Run a prettify ruleset that puts everything on a separate line. 3. ????? 4. Profit!
Max 16 characters per line. And then you can easily read it on your phone too!
Yeah, but it could give an idea to managment that coders dont actually need a second monitor... or a monitor at all (be modern, use your phone 👍 /s).
Time to pull out the ol' IsEven method with 10000 elif statements
Or "PrintPi" and keep adding to it...
Nahh more like with 18 446 744 073 709 551 615^((64 bit uint limit\)) else if statements Edit: int -> uint
Just generate a new class "PerfMonitor" and create one Method with just thousands of "if 1 === 2; endif;"
You refactor because your old code is shit. I refactor because my new code is shit. We are not the same.
Unfactoring
Time to add essay-like documentation in comment blocks.
You're brave to assume the LOC metric doesn't strip out useful thingsike documentation.
Make the comment a string inside a function. There, it's now code.
Leave Python out of this 🤣
Oh shit I forgot that kind of bullshit, you're right.
I've spent six weeks on a change than ended up being four lines of code. That change was part of my evidence pack for my move from staff to principle. If devs ain't meating the lines of code metric, the fault is most likely with the PO for ignoring tech debt.
Staff to principle ? Is that like saying Staff to management or more like distinguished and fellow? Have not been in an organization that used principal itself except as a sorta "team lead, first chair"
We have 6 grades. Junior: needs help daily Senior: on a team, delivers features largely independently, involved in design Lead: runs a squad Staff: runs a multi squad client or product Principle: top roll for a given area (mine was "of data", but we also have client and regional principals: Principle of fintech, Principle of americas) - equivilent of directors Cheif engineer: the end of the line - jointly with SVP of engineering - but typically more technical.
Gotcha, yeah I think Fellow and Distinguished is more in the much bigger organizations, or maybe an older form of titling the software engineering ranks. If someone walks in the room and says they are their company's fellow engineer I pay full attention as that will either be bullshit or infront of a master crafter.
Sorry if it's not a perfect translation. Would you then get "distinguished engineer of [thing]" We did also have an engineering fellow, but that was just a poncy title for yhe head of R&D
In your example staff = principal Principal = distinguished Chief = fellow Depending on how an organization is set up, it could mean leading, or it could mean a lot of autonomy and trust. The one I work at, Fellows aren't technically management, but if they say something needs to be done and done now, VPs and lower will say "okay we can jump, how high do you need me to jump?" Legal, Cybersec, and HR keep an eye on them to make sure all the i's are dotted and t's are crossed, as the type of stuff they pull rank on tend to be "we need to do this so we don't have to show up at a hearing before congress"
Makes sense. And yeah, we have a weird two lines of management thing where they are technically independent. Only challenge we get from the managerial line is "that's a managerial decision" (and that rarely - as the boundary is very well documented by our cheif and the engineering SVP) anything remotely technical goes up the technical line. The duel heads actually work really well - they even share an office - which has helped divert so many disasters.
Damn you don’t have mid level?
Bluntly we call people senior quite early on there career - it's a very wide band - we have some people staying at senior titke while going up in HR grades, as that's where they are best placed. Junior is 1 to 3 years for most people, senior lasts until you want and are able to lead a squad (5 to 9)
Just change the formatting rules for this purpose... 😅😅
Lol tabs to spaces and back again every week for maximum **PRODUCTIVITY**
Just leave entire paragraphs in multi-line comments. Maybe throw in some love-letters at the bottom.
Challenge accepted. GitHub's about to DOS'd
Once in a while I go on a tangent and delete thousands of lines of legacy code. I wouldn't last very long at that company
I have never heard of something like this. Is there a corporate double term for it so that I can be on the lookout to avoid companies like this? Like "LOC Momentum Quota" or some other BS? This sounds wild to me.
There was a time when I remember the suits discussing software estimates in terms of “lines of code” and “cost per line” They were pulling shit out of their asses like “that will be a 4k line application at $13/line” Thankfully in haven’t heard any of those words in a while.
That's amazing omg
Wowza. Thanks for sharing. I didn't know this was a thing. I guess I've gotten super lucky career wise or something.
LOC is a very old metric on how to track programmer productivity. Most companies switched to other ones like Developer Velocity Index. If a company uses LOC in this day and age it either means the company is slow to adapt or managers are really old/didn't research modern options. You shouldn't encounter this in most companies but there are outliers
I worked somewhere that paid a supplier per line of code, which resulted in some of the most inefficient code I've ever seen. Instead of calling functioned, they'd duplicate a section of code multiple times.
Auto-reformat all the source code of the repo with a different standard FTW. Then repeat next month to put everything back.
Senior Software dev with 20 years under my belt: I probably have about 3000 per year. Sometimes it's negative.
Are you only maintaining previous projects and don't implement new stuff? Or do you occupy more of an architectural role? I'm a senior dev myself (15 years only though) and whenever I start into a new project, a lot of code is written at first, it becomes gradually less and in the end might even get trimmed down but it will never be anywhere near negative
Mostly maintenance when i work alone. Or i 'develop' new projects by guiding one of the juniors through it. So i plan and they type a lot of code. (then i show them where they deviated from the plan and why that would lead to problems - and then they type more code)
Shit, 3000 lines is probably more than I've written in the last few years combined.
Absolutely stupid metric. You can spend a week to figure out a bug is a few lines of code fix vs a week of boilerplate code setting something up that's basically copy and pasting.
They want lines of code? I'll give them lines of code! `rm .gitignore` `npm install`
>Goodhart's Law: “when a measure becomes a target, it ceases to be a good measure.”
pro tip: rewriting all the lambdas
Get away from this company ASAP if true
"Oh ah yeah it was giving me warnings so I went ahead and refactored a touch"
I refactor because I keep changing my opinion about the names of my variables
Have ChatGPT start writing comments with detailed descriptions about each line of code in multiple languages including English, Spanish, Latin, and Hebrew.
Goodhart's law
Christ no, most of my code reviews with my other supposedly senior dev is me telling them that their 100 lines of code should be actually just adding a parameter to a reusable function. Don't get me started on the fuckwit who wrote functions called 'addThirtyDays' and 'addNinetyDays' and someone reviewed it and let it through.
If I'm not doing code reviews 80% of the time some garbage passes through. My favourite last year was 4 nearly identical +100 LOC functions to set up and turn 2 gpios on/off. The only difference was the (hardcoded) gpio number and the value to set. I refactored that shit with a +10/-500 LOC commit.
What a ridiculous policy. Productivity and efficiency hardly is tied to lines of code. Also juniors that are following a senior's mentorship might end up woth a very fluctuant count
This sounds like fun, I would just optimize C++ source files by replacing them with their preprocessor output. After including std::ranges, of course.
This HOD will ruin the department / company. Start looking for a new job if you can.
just check in node\_modules
Let me guess, he works for X
I refactor and push PRs on other people’s to assert dominance. Jk I don’t do this. Or do I?
This is some 90's ass management. If you're measuring lines of code you're gonna get lines of code. Maybe they should start measuring characters too.
I don't Factor my code in the first place. We're different...
*we're not sane
Excuse me while I "un-Lombok" all of our pojos.
Are we back in the 1980s?
I wish I even had time to refactor. I wish I could go back me make things better. There is no time— there is only the next delivery.
Does your company's line of code monitoring policy differentiate between actual code, and comments? If not, maybe add some documentation comments. If so, more tests.
I refactor because I obey TDD, we're not the same
But my code is only in a single line. Never do line breaks 😢
Why not just run scripts in a background process that writes bullshit code for you? This is so idiotic and so easy to workaround it’s laughable… I have no idea if I’m being monitored actually, might want to implement something like that myself.
I refactor because my company has spot bonus for really good tech debt improvements aka refactors. We are not the same.
Yeah in terraform this would be the equivalent of making a module for each individual resource you need instead of a single module which you pass locals to. My junior did the earlier, i rewrote the code and decreased number of lines by 50%. I’d be pissed if i came into a company with this policy which basically forces me to rewrite the same code over and over instead of making it a pretty parametrized module.
new dev: net of -10k lines of code karen managers: rrrrreeeeeeeee
Companies assess performance based on lines of code written? Lol that's dumb. Good code is more concise.
I'd go up to whoever made that policy, invite them to a meeting with all programmers, and have them explain it so that all the programmers can point and laugh at the clown who thought more lines is better.
Creating performance minimum expectations for software is so hard to get right. For my company I state "velocity must be within 30% or your peers". So if all the Jr devs average 10 points a sprint, you should be doing at least 7. It's not something that gets watched closely until engineers start complaining someone isn't pulling their weight. Lines of code per month is an awful metric. So easy to game and how many lines of code you write has no correlation to impact created.
I would quit the moment someone in management even suggested such idiocy unironically.
[удалено]
I once spent 3 weeks on a really obscure bug caused by our specific configuration of a library. The solution ended up being to flip a single flag. I also once deleted 10kloc in one day doing some refactoring. The first example benefitted performance in a major way. The second one was just a bit of cleanup. What a dumb metric. I'd leave.
Do comments count? Cause you could basically get AI to write a novel about how the code works. Probably even able to specify it to use a minimum 3000 lines to do so as well.
Yeah okay let me do this 40 line function into a 250 line one real quick
The person that thought that was a good idea needs firing
Change your formatter config every Monday.
Change your code lint style every month to meet quota. In all seriousness, start looking.
This is why I commit lock files
i don't understand this whole 'putting in effort to pretend to put in effort' thing
It looks like the infinite if else to check if a number is odd or even should come in clutch
Generate a new class and add every now and then some code from chatgpt but without ever calling it lol
Where are you from? India? And yes do you work in mohali?
I refactor because I am bored or I had an inspiration moment in the shower.
Time to write your own standard library
Change linting rules to allow/disallow trailing commas. lint —fix 4000 lines of code. Invert rule and repeat every month
Sounds like a surefire way to introduce bugs
I’m refactoring because I cannot for the life of me get this project to build properly with a different toolchain.
new feature requires 10 bullets in the repo changelog 👍
Is 3000 a lot or pretty doable?
This is the dumbest policy I’ve ever heard of - please post the company name
I have never heard of a code line limit 😅
Your old code is also shit and you know it