r/badcode • • May 17 '21

kotlin When you are paid by lines of code.

Post image
1.0k Upvotes

40 comments sorted by

173

u/racrisnapra666 May 17 '21

Out of curiosity, is there really a system where programmers are paid by lines of code?

199

u/[deleted] May 17 '21

Yes.

The reason is "Management". I can't get more specific, neither can they, they don't know either.

Jokes aside, a lot of management is providing solutions to ill- defined problems. (Often with ill- defined solutions) So if the manager wants to award a bonus to one programmer, how does he choose which one if he doesn't understand programming?

If he came from the manufacturing line and understands productivity, he might think that code is the product and base it on that.

78

u/droomph May 17 '21

It’s so frustrating that this is so common that there’s Management and then there’s ~*~Engineering Management~*~. You’d think that “more steel beams won’t make a better building” is a blindingly obvious concept even before computers if you have an MBA but holy shit dude

59

u/[deleted] May 17 '21 edited May 17 '21

I've had to deal with managers a lot and I've come to realize the cause: what happens when the bad manager gets promoted?

Example. Manager A has been with the company since they just made widgets, and knows how to focus on productivity. He does well, gets promoted, and trains manager B to take his place on the production line while he oversees manager B, a d others, at a higher level.

Then time passes. The widget is now a gadget, and requires programmers to make software for it.

Manager B, who understands productivity, now is in charge of the programmers. He doesn't understand it, but they are doing well, so why change anything.

Problem is that manager A is still around. He also understands productivity, and sees that manager A is not being productive. If an Machinist makes widgets and a software engineer makes code, then what does a Manager do? A manager solves problems.

"Oh sub manager B, what problems have you solved?"

"Why nothing, super manager A, because nothing is going wrong, the software team is doing well and I don't want to interrupt them"

"That is a bad attitude sub manager B. You can always make the company more productive. Figure out what's wrong with your team and then solve those problems or else."

Then manager B, under the pressure to "make the team more productive" implements a line of code measuring project, and incentives the programmers by giving them bonuses based on lines of code.

At his next meeting he gets to say:

"oh, supermanager A, I found that the team was not programming hard enough and insentivised 5hem to work harder. Here you can see by these metrics that lines of code produced per day has increased 300%!"

"See, sub manager B, I told you there was a problem to solve."

"I sure am lucky to have you as a super manager aren't I"

"Yes you are. Let's give our team bonuses for doing such a good job. I'll take 75% of it for telling you to do it and you can split the rest of it between yourself and your team"

15

u/thanatica May 17 '21

I don't have a manager. At all. In a company of 400 employees, no one has a manager. A manager doesn't really do anything anyway, and indeed, we can manage ourselves absolutely fine.

Anyway, I imagine if I did have a manager and he/she was quite bad at it, and they got promoted, I would go to the manager of my manager. I'd tell them "why the fuck you promote him/her?" and I'd get a bullshit answer. I would genuinely use that word, so I'm not censoring it. Apologies if it offends.

That's why it's important to choose your employer carefully. It may take a few tries, and you might never find the exact right one. But in most cultures, a "next step" in your carreer is nothing to be ashamed of - in fact it's usually celebrated.

19

u/unit_511 May 17 '21

Instructions unclear, awarded bonus to designer of a solid cube made entirely of steel beams.

4

u/[deleted] May 17 '21

Great answer, give that unit a bonus.

13

u/Lost4468 May 17 '21

I'm sure this is how automotive operating systems etc end up with so many lines of code. The automotive industry in general seems to approach everything from an old school engineering point of view (with the exception of Tesla and a few others) , and it really shows in the design.

E.g. here's a comparison. That's right the average high end car uses 100 million lines of code... more lines of code than fucking Facebook... more lines of code than the bloody LHC.

Even the Chevy Volt has 10 million.

It's insane. Surely it must include generated code, and even then I wonder what are they doing that uses so much generated code?

Based on my experience with car software the actual end product is an absolute mess on everything but Teslas. Terrible GUI design, glitches and bugs everywhere, bloatware that lags all the time (at least they probably saved $5 not getting the more powerful processor, it's important to penny pinch on a $30k item), poor security (Jeep had steering controls connected directly to the open internet with no real security on them), systems being very independent such that they barely talk to each other, etc etc.

If anyone here works or worked in the industry, why is it so much? And is the code poorly written? Why is it all such a mess? I have been told before it's because they treat software developers like mechanical engineers, is that true?

7

u/thanatica May 17 '21

The sources of that infographic are a bit vague at best.

And you cannot whole-heartedly claim any number of lines of code in a piece of software that is closed-source, which I'm pretty darn sure car infotainment systems are.

Be that as it may, it is clear in most cars that everything has been designed from the technology outward. Every little darn function has it's own dedicated button. Even something I wouldn't EVER dare to touch (disable traction control) has a physical button. And why? Because the car has that function, so it needs a button. No further questions asked.

All those millions of buttons, and none of them can be made acessible in a settings menu on the infotainment system. Seriously? That is NOT possible? Come on.

And of course not to mention (well, I'm going to anyway 😀) how ridiculously outdated and eye-wateringly expensive the navi systems are. What do you get, like 5fps? Any POIs other than petrol stations and service areas? A useful way to search, like "Home Depot near me"? It's usually all designed from the perspective of the technology. You HAVE TO navigate to a street address, so you HAVE TO enter a street address. And Toyota want my €150 per year for updates, ONCE PER YEAR - who knows how old each update already is when it comes out.

I'm glad I'm a developer. It makes complaining a lot easier, because I know how customers (not consumers!) oftenly cannot be reasoned with.

0

u/[deleted] May 17 '21

[deleted]

1

u/Lost4468 May 18 '21

Yeah but it's much better than other cars, and the systems are integrated in an actual modern way. E.g. check out this older video of Sandy Munro he goes into how Tesla is the only electric car company making 30% profit, and he gives an example in the Model 3's rearview mirror. The Model 3 one costs $30 to make, while the BMW i3 costs $93 and the Bolt $165... It's because BMW and Chevy have made it so that all of the electronics are built into the mirror itself and it has to do all of the processing etc. Whereas with Tesla it's the main more powerful computer that does all of it, and the mirror is much more simpler.

This type of thing not only makes it cheaper, it also makes it much more integrated. Everything else has access to all of the information much more easily, much quicker, and it's the same thing controlling it so it doesn't feel as out of place. Car manufacturers making everything its own little independent module is just such a worse way to do it for things like that.

4

u/[deleted] May 17 '21

[removed] — view removed comment

4

u/Kidiri90 May 17 '21

Me, an intellectual: rm -rf

64

u/[deleted] May 17 '21

yes, i have worked under a project manager who didnt code and they had an unshakable belief that obviously the more lines of code is better so would pay accordingly

readability be damned, show me the money

21

u/Silverwind_Nargacuga May 17 '21

White space ahoy

13

u/Fusseldieb May 17 '21

I would "overcomment", but still try to leave the actual lines of code readable

9

u/Ninjakannon May 17 '21

I'd just autoformat my code with the max line length set to 1. I'd autoformat all code before editing to something readable and on commit to the mess they want.

14

u/skixcsgo May 17 '21

Imagine hunting a bug for days just to get paid for one line of code

10

u/blaktronium May 17 '21

Imagine the code that actually gets shipped instead of the one line solution so that the dev can properly paid.

5

u/_Ralix_ May 17 '21

Yes, when they try to give incentives to be more "active", or try to find ways to measure someone's performance.
You see this question pop up on Quora every now and then, resulting in predictable responses from actual developers (but also keep in mind the way Quora works, people deliberately post downright insulting questions to get many answers and views).

A classmate once told me they were refactoring outdated code at work and he had to explain to a non-programmer why he had net negative lines of code for the day.
“So you just went ahead and started deleting other people's work?”
Luckily that person was apparently very approachable and listened to reasoning. And some analogy about a house and the number of bricks used to build it.

4

u/[deleted] May 17 '21

Not so much in North America, but plenty in Asia.

4

u/IGYR04 May 18 '21

Python one liner enthusiasts: 😲

28

u/Dudecor3 May 17 '21

When overrides are used like this it genuinely hurts my soul :(

8

u/fugogugo May 17 '21

It is (Kotlin code based on) Android Java Class.. what would you expect. boilerplates everywhere

4

u/[deleted] May 17 '21

Right?? This is what event listeners are for

31

u/MurdoMaclachlan public boolean isInt(int i) { return true; } May 17 '21 edited May 17 '21

Image Transcription: Code


rootView?.viewpagerExplore?.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
    override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
        super.onPageScrolled(position, positionOffset, positionOffsetPixels)
        when (viewpagerExplore.currentItem) {
            0 -> setIndexAccordingVisibility(0)
            1 -> setIndexAccordingVisibility(1)
            2 -> setIndexAccordingVisibility(2)
            3 -> setIndexAccordingVisibility(3)
            4 -> setIndexAccordingVisibility(4)
            5 -> setIndexAccordingVisibility(5)
            6 -> setIndexAccordingVisibility(6)
            else -> setIndexAccordingVisibility(0)
        }
    }
})

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

13

u/Nielsly May 17 '21

Hi, thanks for your work, but you misscapitalized the N in setIndexAccordingVisibility a few times.

15

u/MurdoMaclachlan public boolean isInt(int i) { return true; } May 17 '21

Ah whoops, that's because I copy-pasted the miscapitalised line. Fixed now, thanks for pointing it out!

15

u/[deleted] May 17 '21

override fun

14

u/rixogdyuxhs +++++++[>+++++++++<-]>[.] May 17 '21

Programmers being paid by lines of code is the reason why schools definitely need better computer education.

11

u/thanatica May 17 '21

What language overrides fun?! 😀

5

u/valschermjager May 17 '21

Points for clarity and self-commenting code. /s

3

u/Brain-InAJar May 17 '21

New language, old habits

3

u/NoMansSkyWasAlright May 17 '21 edited May 17 '21

Question: does that include comments?

Edit: Particularly, comments of the multi-line variety?

3

u/[deleted] May 17 '21

[removed] — view removed comment

3

u/NoMansSkyWasAlright May 17 '21
/*Fair. But you gotta figure that a nice multi-line summary of what
 * each function/class/object is doing would be a nice way to pump
 * those line numbers up. You know, something like what the function is 
 * doing, where the input parameters are coming from, and why it's
 * significant. Nothing too excessive, but you could probably get around
 * 2-3 extra lines per function; maybe one extra on the smaller bits.
 */

I also saw a thing on this subreddit a while back where some dude was making an else-statement for every if-statement and if the else-statement didn't actually do anything, there'd just be a comment in the else block that said '//Nothing'. Thaaat might be scrutinized over a bit more. But comment blocks that explain what a function is doing might be something OP could get away with more easily considering you could pretty easily come up with justification/a sales pitch for them.

3

u/cur-o-double May 18 '21

Yep. "override fun"

1

u/SlaimeLannister May 17 '21

Could you put your optional chaining on separate lines for even more lines?