News for hackers. Stuff that matters.
Re:Technical Debt: Why it'll ruin your software by spamizbad on Friday October 23, 2020 @01:37PM (#24871883)
One thing I've learned is that what often looks like overengineering is actually underengineering -- it's much "easier" to throw together a complicated system than really think things through and develop something that accomplishes the same objectives in a simpler (but possibly more complex) manner.
Re:Technical Debt: Why it'll ruin your software by hinkley on Friday October 23, 2020 @02:51PM (#24872573)
A blogger I read when people still did such things asserted that this sort of overengineering is fear. It's really dreadfully obvious once you know to look for it.

People are so afraid of making a bad decision that they refuse to make any decision at all, and then make a giant mess in the process. What you should do is spend your energy on finding reversible decisions, and then not spend a lot of effort on actually making them. We know where the paint store is, we know they can make up paint in 15 minutes, fuck it, paint it blue, we can always paint over it later. Hard no to black, though, since you can't paint over that shit.

People are so used to avoiding decisions that on a few occasions I've entirely flustered someone who wanted to tear into me (sometimes with an audience) but cutting them off and saying, "Yeah that was a mistake, and here's how we're going to fix it." None of them had any idea how to recover from someone saying "I was wrong" and going on to try to fix the problem. I still have a little video in my head of one guy's eyes bugging out when he realized what I just said.

Re:Technical Debt: Why it'll ruin your software by lt on Friday October 23, 2020 @02:22PM (#24872300)

    “I apologize for such a long letter - I didn't have time to write a short one.”
― Mark Twain
Re:Technical Debt: Why it'll ruin your software by mixmastamyk on Monday October 26, 2020 @02:14PM (#24899218)
I've seen that attributed first to Pascal:

https://quoteinvestigator.com/2012/04/28/shorter-letter/

There may be better information.

Re:Technical Debt: Why it'll ruin your software by coddle-hark on Friday October 23, 2020 @02:05PM (#24872157)
I think poorly engineered is a better term than under engineered in this case, but I agree with you.

Logging is my go-to example for this sort of behaviour. People write stupid amounts of log statements in their code, so much that it’s hard to even read the code to understand what it does, in the hopes that it’ll make debugging easier. Use a damned debugger! Take a traffic dump! Use strace!

What’s more, it’s extremely rare that libraries provide logs themselves. So the actual complex parts of your application, like say the HTTP library or (God forbid) the TCP stack, can’t be debugged this way.

If you find yourself writing a bunch of statements like “DEBUG: updating balance from 1 to 2”, stop and write some tests instead.

Re:Technical Debt: Why it'll ruin your software by jcelerier on Friday October 23, 2020 @02:30PM (#24872384)
> Use a damned debugger! Take a traffic dump! Use strace!

I have encountered a fair amount of cases where that does not work.

- debugging a super large program ? loading gdb may take two minutes while recompiling to add a printf only 3-4 seconds.

- not an admin on the machine you are and the person with the admin account is not around ? sorry, you can't debug on macos (and likely in some linux distros)

- likewise, no traffic dump (and I'd assume no strace) if you don't have root access

Re:Technical Debt: Why it'll ruin your software by SCHiM on Friday October 23, 2020 @02:34PM (#24872429)
And how about highly congested multi threaded programs?

I've got a program with log statements like that all over the place. Since stepping through it with a debugger would not even be possible. My IDE takes care of hiding the debug statements, since they're all encapsulated in different regions and if-def statements to log different types of things.

Re:Technical Debt: Why it'll ruin your software by coddle-hark on Friday October 23, 2020 @02:56PM (#24872633)
Isn’t that what tracepoints are for though?

Flipping your argument, you’re basically saying that you can’t debug multithreaded code if the program doesn’t log.

Re:Technical Debt: Why it'll ruin your software by SCHiM on Friday October 23, 2020 @03:14PM (#24872797)
I certainly wouldn't want to debug this ball of mud if there were no log statements, no :)

But, I think we're depending on different programs in our workflow. I much prefer a logfile with statements that focus on what I want to inspect at the time.

I'm quite proficient with debuggers on both Windows and Linux, but I tend to use them less when dealing with my own multi-threaded code.

Re:Technical Debt: Why it'll ruin your software by merb on Friday October 23, 2020 @06:53PM (#24875206)
that works maybe with multi threaded code but not with greenthreads that are all over the place. the calls stacks are a pain in the ass.
Re:Technical Debt: Why it'll ruin your software by coddle-hark on Friday October 23, 2020 @02:51PM (#24872574)
> loading gdb may take two minutes while recompiling to add a printf only 3-4 seconds

To be clear I’m not talking about adding some specific print statements to the code while debugging, I’m talking about keeping those statements in production code.

Of course, there’s cases where logging might be your only option. In that case: Go for it!

Re:Technical Debt: Why it'll ruin your software by MaulingMonkey on Friday October 23, 2020 @08:21PM (#24875797)
> - debugging a super large program ? loading gdb may take two minutes while recompiling to add a printf only 3-4 seconds.

Relinking a super large program may take minutes, whereas loading gdb can get me a backtrace in 3-4 seconds! VS natvis files and other visualizers can hot-reload while I'm looking at a crash dump from production that took hours to trigger/gather/repro!

There are cases for logs - where sufficiently efficient conditional breakpoints are particularly painful to setup, for example - but the only time I've waited minutes for a debugger to respond has been with VS after major system updates as it refreshes a universe of symbols from the symbol server.

Do you have some really slow python scripts auto-loading in GDB or something?

Re:Technical Debt: Why it'll ruin your software by jcelerier on Saturday October 24, 2020 @07:44AM (#24878574)
> Relinking a super large program may take minutes, whereas loading gdb can get me a backtrace in 3-4 seconds!

well, we have definitely opposite experiences :) the main software I work on creates a ~1gb binary in debug mode and lld links that in a few seconds. Bud gdb and lldb, even with gdb-index, and all the optimizations I could find, both make startup slow enough that I can go for a coffee and it's not always finished loading when I'm back

Re:Technical Debt: Why it'll ruin your software by nullsense on Friday October 23, 2020 @06:17PM (#24874881)
On the contrary, I've spent months recently working on a system loaded with tech debt that has fallen victim to a half done rewrite. I've used a debugger on it plenty of times.

It was only when I added proper logging to the critical junctures in the code that I could finally see very clearly how it behaves and see what input results in what code paths and output. I learned more in an afternoon than I did in a month.

Re:Technical Debt: Why it'll ruin your software by m463 on Friday October 23, 2020 @01:47PM (#24871992)
Sometimes it's hard to tell the difference.

for instance one smart and experienced guy I knew said if there was an error, your program should just fail instead of giving a ton of messages and recovering.

and if you're just throwing code together, that might be what you do.

on the other end of the scale, a well written "second pass through everything with cleanup" might have tastefully written code, a few relevant comments and consistency.

and then I've seen a lot of code that appears to look like that, but is copy/paste garbage. (sort of the coding equivalent of a wordpress theme)

Re:Technical Debt: Why it'll ruin your software by pjc50 on Friday October 23, 2020 @02:59PM (#24872659)
I've come round to the "fail hard and early" view, provided you can be sure in your design that it doesn't leave junk lying around. Because otherwise contaminated data and invalid states start propagating everywhere..
Re:Technical Debt: Why it'll ruin your software by quicklyfrozen on Friday October 23, 2020 @05:14PM (#24874260)
This can be fun if it's a particular client request that causes a hard failure, and the client retries several times before giving up. Before you know it, all your instances are restarting and no traffic is being handled...

So fail early, but not too hard.

Re:Technical Debt: Why it'll ruin your software by ziml77 on Saturday October 24, 2020 @12:35AM (#24876971)
Interestingly I prefer failing hard specifically for data consistency reasons. I've had to deal with systems that swallowed far too many errors and let themselves get into an inconsistent state which then caused other operations to not fail but instead persist invalid data. It's very hard to clean messes like that up (restoring a nightly backup is easy, but that's a last resort).
Re:Technical Debt: Why it'll ruin your software by darkerside on Friday October 23, 2020 @02:28PM (#24872363)
> your program should just fail instead of giving a ton of messages and recovering

I would bet that he was right in that situation, but that he was also making a nuanced statement. Not all code should fail loudly, but when it should, "recovering" can sometimes be a distraction from a very real problem that needs to be addressed by the right person.

Re:Technical Debt: Why it'll ruin your software by flyrain on Friday October 23, 2020 @01:49PM (#24872009)
Totally agree. That complicated system is called a big ball of mud. Pretty easy to make.