News for hackers. Stuff that matters.
Re:Ask HN: What is your best advice for a junior software de... by dsr_ on Wednesday October 03, 2018 @11:48AM (#18131419)
And in the opposite direction: remember when you are writing error messages to include all the relevant details, and never ever write "this shouldn't happen" or "document later".
Re:Ask HN: What is your best advice for a junior software de... by fhood on Wednesday October 03, 2018 @11:52AM (#18131459)
What about, log_panic("If we have somehow managed to hit this code path, this project if FUBAR. I would recommend giving up and starting over.")
Re:Ask HN: What is your best advice for a junior software de... by btschaegg on Thursday October 04, 2018 @02:02AM (#18137539)
Somehow reminds me of Aliens:

  I say we take off and nuke the entire site from orbit. It's the only way to be sure.
:-)
Re:Ask HN: What is your best advice for a junior software de... by m_samuel_l on Wednesday October 03, 2018 @06:05PM (#18135231)
That's annoying but fine as long as it's unique and you can grep it in the codebase.
Re:Ask HN: What is your best advice for a junior software de... by fao_ on Wednesday October 03, 2018 @07:18PM (#18135615)
You can forgo something being unique if you just append line and file information to the log. Literally any logging framework (even homerolled ones) should give you this by default.
Re:Ask HN: What is your best advice for a junior software de... by fhood on Thursday October 04, 2018 @11:00AM (#18140486)
yup
Re:Ask HN: What is your best advice for a junior software de... by pletnes on Wednesday October 03, 2018 @12:41PM (#18132033)
If used correctly, «this should not happen» can be very useful, indicating e.g that the program is in some illegal state, as opposed to the input being incorrectly formatted.
Re:Ask HN: What is your best advice for a junior software de... by scarface74 on Wednesday October 03, 2018 @01:24PM (#18132504)
Even if that’s the case, create a custom exception and embed in the custom exception object the actual exception.
Re:Ask HN: What is your best advice for a junior software de... by gpderetta on Wednesday October 03, 2018 @07:14PM (#18135590)
Assert