6 stages of debugging

611 points · 29 comments · view on lemmy.world

29 Comments

DonjonMaister@programming.dev · 29 pts · 3y (6 replies)

Stage 4.5: console.log() everything.

zqwzzle@lemmy.ca · 16 pts · 3y (3 replies)

And then the logging fixes the subtle timing issue causing the problem.

V699@kbin.social · 8 pts · 3y (1 reply)

Race conditions are the worst

zqwzzle@lemmy.ca · 1 pts · 3y

Good ol’ Heisenbugs.

sickmatter@fedia.io · 1 pts · 3y

Especially if logging ends up spreading a global mutex around the log file.

danc4498@lemmy.world · 9 pts · 3y

We have logging software built in, but I can never remember how to turn it on, so I just console.log

0x4E4F@sh.itjust.works · 6 pts · 3y

Step 4.6: Get another drive for the logs.

Dirk@lemmy.ml · 14 pts · 3y (1 reply)

console.log("Does it happen here?")

jcg@lemmy.world · 1 pts · 3y
print_r($object);die();
fubo@lemmy.world · 12 pts · 3y

"I notice that I am confused, and thus that one of my beliefs is fiction."

axtualdave@lemmy.world · 11 pts · 3y

Everyone always skips the last step, but that's where you learn.

dan1101@lemmy.world · 10 pts · 3y

How did that ever work, I've been there many times.

macgregor@lemmy.world · 8 pts · 3y (2 replies)

Get enough experience and you just have a brief moment of stage 3 as you dive straight to stage 4.

Unless it's a customer/that-one-guy-at-work (it's a title, but there's usually a handful of them) and then there's this vast stage 0 of back and forth of "are you sure that's happening, run these commands and paste the entire output to me" to be sure of what they are saying then you jump to stage 3/4.

V699@kbin.social · 4 pts · 3y

I jump straight to step 6

meekah@lemmy.world · 1 pts · 3y

Yeah honestly who ever starts at stage 1 is a bad programmer IMO. Unless you get your bug reports from the general public, it's unlikely that someone is lying in their bug report. Being at stage 1 pretty much means you have too much confidence in your product.

kriss0706@kbin.social · 7 pts · 3y

its funny i see this now, after spending 3 hours debugging D:

DarthYodaX@lemmy.sdf.org · 7 pts · 3y (1 reply)

My boss does 1 <--> 2 with us over most every bug any of us has ever found. Ticking time-bomb...

meekah@lemmy.world · 1 pts · 3y

sounds like a shit boss tbh

z500@startrek.website · 7 pts · 3y

Every time that last part happens I have to check the proper spelling of Berenstain. I've had some that really seem like they should have been impossible lol

Rhaedas@kbin.social · 6 pts · 3y (1 reply)

I have some Excel VBA scripting that I've been on 1-4 for a while now, so there's a branch off of 4 that should be "fuck it, here's the workaround" or "that part isn't that important anyway, ignore it".

(it's actually not Excel that's the problem, it's the change to its call to IE that throws up a stupid security warning.)

chaorace@lemmy.sdf.org · 2 pts · 3y

Oh my god this comment gave me an aneurysm

ShustOne@lemmy.one · 6 pts · 3y

As true as true can ever be

PtitSerpent@kbin.social · 5 pts · 3y (2 replies)

if (0 === 0) {
var_dump($test); die;
}

tgxn@lemmy.tgxn.net · 2 pts · 3y

Ahhhhh, PHP.... 😭

perviouslyiner@lemmy.world · 1 pts · 3y

if ((x != x) || (x == x+1)) then it's one of those weird numbers

egeres@lemmy.world · 4 pts · 3y

Stage 7: Who wrote this?

Stage 8: Ah ok... it was me

randombit@lemmy.sdf.org · 3 pts · 3y (1 reply)

One of the best pieces of advice I have ever gotten was to build diagnostics first. The time it takes to do will pay for itself 100X over the course of development.

Celivalg@iusearchlinux.fyi · 2 pts · 3y

100% unit tests ftw

Hate making them, love them when they are here

ZcaT@lemmy.world · 2 pts · 3y

Has it ever!?

SillyJester@lemmygrad.ml · 1 pts · 3y
[ removed ]