r/AskProgramming • • Jan 03 '21

Seems like bad code is often more profitable than good code?

I wrote some code 10 years ago for a project. It basically imports user records from one a large enterprise database system to another. It took me about 4 weeks to do this and I was very careful to cover all edge cases and make sure it would work without issue even though they were pressuring me to get it out the door faster. Sure enough it worked every day for 10 years without having any issue at all. I worked my butt off for this.

Now I learned they put a new guy to rewrite the code for the main system, and in order to integrate they wrote a replacement for my software as well. Turns out every month for the last year there have been errors with the new import code and user records are failing to import and people are getting locked out. And the new programmer has to go onsite and tinker with the code and run tests and updates (the enterprise client has a closed network). So they pay him to fly out there and stay in a hotel and pay for meals every month or 2 and he gets paid the high consultant rate for this. So basically since the code always seems to have bugs he keeps getting paid to fix them.

Makes me wonder about things. What are your thoughts?

145 Upvotes

48 comments sorted by

50

u/KingofGamesYami Jan 03 '21

It's plenty profitable until the business gets sick of your shit and hires someone competent.

21

u/Melodic-Literature-6 Jan 03 '21 edited Jan 03 '21

Its very tricky though because some of the 'bugs' (but not all) were just edge cases that he didn't handle. For example all of the imported user data SHOULD have 'valid' identifiers on key fields such as username, userid as written in the specs, but sure enough the client was having some bad data come through. But instead of just rejecting that individual invalid record (this is how I wrote my code) - the new programmer did not handle these cases and the imports either corrupted the data or completely crashed the service.

So then he blames this on external system database which supplies the 'bad' data. So for this particular bug he argued successfully to the client it was their fault, and now for any subsequent bug he kind of has the 'upper hand' to blame on them as now the non technical people have doubts about their internal systems and people. However I don't agree with his argument as I feel any system should fail gracefully.

Edit: Another different bug he had to fly out and fix was because his code didn't handle another test case where someone last name had an apostrophe in it (O'Brien). And this crashed the whole system. Basically just random various bugs like this.

11

u/Beerbelly22 Jan 03 '21

Ouch, if a ' crashes the system then this guy needs to learn a lot about mysql injections. I think they hired an amateur.

I don't know anymore what's best, my goal was always to get it working in the least amount of code. But now a days it seems to be a competition who can use the most classes. And if your simple spaghetti code works faster and better they tell you your code is ugly.

2

u/[deleted] Jan 04 '21

It's ugly but beautifull on the inside.

0

u/[deleted] Jan 03 '21

[deleted]

3

u/bstiffler582 Jan 04 '21

Never trust the user with anything. Similar adage to “if it can break, it will”.

1

u/drunksciencehoorah May 08 '21

Don't tonnes of junior devs complain about how HR people make it near-impossible for them to get hired because it seems like they all want geniuses with 10+ years of experience for the most basic entry-level work? Unless these HR people actually do find enough super-experienced people, then it'd seem like they say 'oh we can't find anyone experienced-enough so we'll just outsource to India (and when stuff breaks then maybe at some people we'll hire a high-quality local junior)'.

1

u/KingofGamesYami May 08 '21

That's a popular internet myth, yes. I haven't found any evidence that it's widely true.

1

u/drunksciencehoorah May 08 '21

Yea, it never made much sense to me, though I wouldn't be surprised if HR people just do it as a test to see how confident the juniors are in their abilities to do anything.

1

u/KingofGamesYami May 08 '21

a test to see how confident the juniors are in their abilities to do anything.

That would be complete bullshit as a test. I think it's more likely HR is just incompetent.

1

u/drunksciencehoorah May 08 '21

I guess that problem's not the norm then, thankfully, but at least people on the IT sub (I know it's not programming but still) complain about it a lot.

15

u/[deleted] Jan 03 '21

Well, you can tell this business is top-notch just from the fact they pay someone to fly out every month to fix on-site instead of setting up a VPN.

10

u/Melodic-Literature-6 Jan 03 '21

It is part of a large government agency that has strict rules on the network connectivity in this case.

8

u/[deleted] Jan 03 '21

ah, well there you go. I did a few government projects back in the day and they sucked. So much BS, a lot of government project seem to literally be setup just to hand money out to people without ever actually accomplishing anything.

4

u/JeamBim Jan 03 '21

Fuck, where do I sign up?

3

u/[deleted] Jan 04 '21

Right here, sir. Next!

1

u/drunksciencehoorah May 08 '21

Yup, because regardless of their inefficiency or profit/income, they'll make money no matter what (unless some politician defunds them for unrelated reasons).

4

u/Milumet Jan 04 '21

large government agency

So the taxpayer pays it. Who cares how much it cost...

2

u/poubella_from_mars Jan 04 '21

It is more of a budget thing. Government agencies and organizations are going to spend their budget one way or another. If it's not on travel, training, and new equipment then they will just come up with random stuff to buy before the end of the next fiscal year. At least, that is what happens in my experience but I am just a lowly sys admin.

1

u/Milumet Jan 04 '21

I know, but it's still a waste of taxpayer's money. It's a systemic problem with government agencies everywhere around the world. People care less spending other people's money than their own.

1

u/poubella_from_mars Jan 04 '21

Well, also agencies like to keep their budgets high. If they get to the end of the year with extra money then that could mean a lower budget next year since they didn't "need" the previous amount that was allocated for them. And not just agencies, this sort of thing happens in smaller organizational units too. The government is divided into branches, agencies, departments, groups, teams, etc. and budgets can be divided down that chain. So if my group doesn't spend their budget then a portion of it could go to a different group instead who requested/justified a higher budget. I am not 100% sure how all of this works since I don't deal with these things directly, but I have seen/heard of some elements of this in my experience working with the government.

2

u/hugthemachines Jan 03 '21

You are right, as proven, in this sort of case. Still, if you work with a large enterprise products in a large company, the situation will be different because correcting buggs and getting support incidents cost money for the company. Still, if a company need stuff coded all the time and you code for them and there are no bugs, they would give you more and more jobs and you get a good profit. So it depends on the situation.

It is interesting, however, that custoers who had bugs appear and got a quick correction are often happier with the cooperation of the company than the customers who never bumped into any problems at all. To a limit of course. Nobody likes a program that always crash etc.

1

u/Melodic-Literature-6 Jan 04 '21

I think you bring up an interesting point. Which is sometimes people enjoy the process of getting a problem solved and fixed.

I think this could partly be the case for this client, because the network access point on site is in this windowless basement in this very boring government building and there are 4 people stuck in there working and I think they are lonely so they are happy when a consultant shows up.

67

u/ike_the_strangetamer Jan 03 '21

There are many industries where this happens.

If you're too good at your job, people wonder why they even need you and you get canned.

Meanwhile, those bad at their job, which would then require them to get good at justifying their existence, will often be promoted.

4

u/Yithar Jan 03 '21

Meanwhile, those bad at their job, which would then require them to get good at justifying their existence, will often be promoted.

I feel like this was the case at my job. :|

2

u/logicAndData Jan 04 '21

Had this happen.

Made all my (mechanical engineering) parts perfect. I also demanded free spare parts during every build, someone would always forget to order one or two.

My boss never had an issue with me. I could imagine this was perceived as "nothing going on/easy parts".

I was contract and let go after the Trump tariffs, but the engineer who took over my parts said "your parts are perfect".

1

u/drunksciencehoorah May 08 '21

Guess that's why social/psychological manipulation skills can be so important, depending on what you want in life.

0

u/[deleted] Jan 03 '21

[deleted]

0

u/[deleted] Jan 03 '21

[deleted]

2

u/LambdaLambo Jan 03 '21

Maybe, but it's not like I program in my free time, or would do it if I didn't get paid for it.

I think we people get pleasure from producing good work, even if we could get by with less.

17

u/YMK1234 Jan 03 '21

Simething that barely fulfils the requirements is always cheaper than something thats properly designed and allows for future expansion and modification. And that's not unique to software. Throwing together a hut out of planks is cheap, once you need to add a second floor though you are in for a real problem, probably requiring large-scale reworking of your existing structure. On the other hand if you'd have built in some sturdy material from the beginning it would be trivial to add a second floor, but your initial cost would have been higher.

6

u/[deleted] Jan 03 '21

This is a tale as old as time.

Generally the bad part of doing this, is that your stuck on the same project for X years (or job security that some people call it) and don’t get todo anything else.

Just remember being good doesn’t mean you get rich.

6

u/mgudesblat Jan 03 '21

Depends on your career goals and the companies you work with. I'd argue that a company that constantly hires out a consultant to constantly fix the shitty code that the consultant wrote is A. Lacking good management and B. Lacking good financial management. They probably thought it'd be cheaper to hire a consultant for a short term thing instead of an in-house team for a longer term thing and now they're paying it out the side as they continually have to fly back this consultant.

The other thing is, this consultant might be getting a good deal with this company but it's also just as likely that if someone were to ask the Company if they'd recommend using the consultant for another project they may be hesitant. A consultants livelihood is reputation based.

Also the consultants life sucks now because every month they're worried about getting a call that the thing is broken again and they have to pause whatever they were doing and go fly out to tinker on shit and that's just not fun after the first couple of times. And now everytime they have to apologise, probably give a discounted rate if not for free, and as someone else said, justify their existence.

On the other hand, you did the hard work upfront and can confidently say that the solution you implemented worked without issue for 10 years. That's not a small thing. And if you ever went into consultancy that kind of guarantee of work can allow you to charge much higher than the average consultant. But you'd have to prove it everytime.

I wouldn't look at the situation so cynically. The company is being shafted for their own lack of foresight and being cheap and the consultant now lives in a constant state of panic (unless they're a completely apathetic and cynical person themselves). So, be thankful you're not that person! There are far better and less soul crushing ways of making money in this industry than being a half-ass consultant. Be a whole ass consultant! Do the thing once, charge a lot more, and enjoy knowing you did good work and that company management teams talk to each other, especially when sussing out if someone is worth hiring/using as a consultant.

2

u/TGR44 Jan 03 '21

I think it can’t be emphasised enough how un-fun it is to have regular-but-unscheduled work travel. Planes and hotels get pretty boring after a while and it leaves your social life in ruins.

4

u/funbike Jan 03 '21

It's all perception and human nature. This kind of thing could have happened hundreds of years ago with clockmakers.

I think that clean functional test code or specifications can help mitigate this kind of thing. When a re-write happens, the old tests or specs can help identify those hard-to-find corner cases.

4

u/ericmurano Jan 03 '21

I definitely put more thought into my day job’s code. My freelance coding is geared towards not costing the client too much so that they continue to use my services.

I like to think that I would do more thought-out work if I were a consultant, though.

4

u/wrosecrans Jan 03 '21

Success in business often comes from being good enough, and no better.

The company that invests the R&D resources to make an objectively better product spent more money to get to the same point of making something their customers consider Good Enough. So the company with the better product is almost invariably at a massive disadvantage in the market. Think of something like MS-DOS. It was "Good Enough" for home microcomputers despite the fact that there were a ton of operating systems that were more sophisticated, and a ton of computers like the Commodore 64 that were cheaper than a DOS PC.

The C64 Kernal ROM wasn't quite Good Enough for home/business microcomputers. AmigaOS was better than DOS in all the ways that didn't matter to the market.

4

u/cyrusol Jan 03 '21

they were pressuring me to get it out the door faster.

You actually fulfilled your duty as a good programmer by taking the right decision to not let this pressure overwhelm you in this specific case.

In time they will learn. Or suffer if not.

3

u/ashunas Jan 03 '21 edited Jan 03 '21

You have to think about those who are not enough proficient on their own to write the code and from my experience is just a lot of them. So most time they are assigned to 'upgrade' our mumble jumble code to work better even if that is impossible thing to do with their skill level. And then that happens. The code starts crashing and other things malfunction. If they had some common sense they should have hired you to redo the code again not assign someone else to do it. If by any chance you still work for that company and they ignored you like that I would really hard think about cons and pros and try to search better company. As your code evolved during all these years you should also look for company that meets your needs. I mean you are not same person as 10 years ago.

Edit : just saw in comments that it's the part of government. Erhm that's common in every government. Not all people end up there because of their skills, unfortunately. Either way if you think you can be more prosperous in private sector go for it.

3

u/Ryuu-Tenno Jan 03 '21

I've heard of so many instances like this. And, yeah, it is profitable, but, only on a technicality. Companies aim for cheap products and services. But, because they tend to scrape the bottom of the barrel, rather than getting the fresh stuff on the table, they end up spending tons more, on a "cheaper" good/service. So, those that are super cheap can get a crap load of money, constantly going back to fix the problem, rather than just moving on to a bigger and better job/sale.

Meanwhile the company is simply hemorrhaging money in that area, just because they don't think it's worth spending an extra $100 or so on a better good/service. For whatever reason, companies think it's better to lose millions just to save thousands, rather than the other way around.

Honestly, things like this have to do with the competence of the CEO and whoever hired the programmer in the first place. Sure, saving an extra couple bucks now is fine, but, when it adds up over time where you're paying out more and more each time, it's just not worth it for the business.

Great for the guy making crappy code though.

3

u/coded_artist Jan 03 '21

When I first started working I learnt of the concept of being irreplaceable. Basically write it so the bosses call you the lead developer, the firefighter. If you're irreplaceable, you have tenure.

3

u/theInfiniteHammer Jan 04 '21

Businesses are just stupid. Better to have something that works rather than something that doesn't work.

2

u/wasmachien Jan 04 '21

This happens everywhere, unfortunately. It's the price you pay (literally) when you ask somebody to take care of something that you don't know anything about. As long as the perceived value is higher than the cost, nobody cares.

If my plumber takes 2 hours to install a new sink, for which I pay him 200 bucks, I have no idea if that's too much. If the faucet starts leaking a year later, I pay him 50 bucks to fix it. I don't know if it happened because the guy did a shitty job installing it the first time. All I care about is that my faucet stops leaking and 50 dollars is a small price to pay for that.

Meanwhile, the guy that would have done it in half the time and would have made sure I wouldn't have to worry about my new sink for the next decade is poor and out of work.

So yes, it is somewhat in your advantage to not do your work perfectly. There is a sweet spot between half-assing it so that they will never hire you again, and doing it so well they will never have to hire you again.

2

u/ElllGeeEmm Jan 04 '21

It's the Chinese steel problem.

The company saves money up front by taking the cheapest available option to solve their immediate problem, and then end up losing way more than they saved trying to scaffold and support what's been built with their budget steel.

2

u/samimairya Jan 22 '21

Those CEOs want to show shareholders that he is doing something. Now a days it is all about showing off your brand, doing the right thing or saying the right thing is boring. Everything should be different no matter the consequences.

1

u/[deleted] Jan 04 '21

Don’t worry, all of that can be written off as operational costs and tax expenses :-)

3

u/[deleted] Jan 04 '21

You have thst wrong. You can't write off operational costs. You need capital expenditure or R&D to claim tax benefits.

However, even with those, it is still money out the door. Spending money unnecessary is simply bad business.

1

u/[deleted] Jan 04 '21

I must admit, I am not an accountant, but I am sure that there will be a certain amount of creative juggling going on to make whoever made this strategic decision look good :-)

2

u/[deleted] Jan 04 '21 edited Jan 04 '21

Nah, it would be hidden in the amorphous blob called "IT budget". The mistake of most companies is not to see technology spend aligned with P&L, but rather as a cost centre on its own. This means the CIO/CTO isn't motivated to be transparent.

2

u/[deleted] Jan 04 '21

That too :-)

As long as each budgeted item is only $99.99, or less.

1

u/poubella_from_mars Jan 04 '21

If you read more of this thread you will see that the business in question is actually a government agency. "Spending money unnecessarily" is pretty commonplace in the government.