News for hackers. Stuff that matters.
Re:Debugging Node.js in Production by nawitus on Friday December 04, 2015 @01:36PM (#10678127)
The argument that stack traces are easier to debug when functions are named is always brought up when talking about the issue of naming functions. However, I don't quite understand why it's such a big issue. Whenever I get a stack trace the issue is almost always easy to debug. That has been my experience working with JavaScript full time for two and a half years.

And every difficult to debug bug hasn't been related to knowing which functions are in the stack, but are instead related to figuring out why frameworks do something or race conditions and so on.

I just find it surprising that people are having problems with anonymous functions in stack traces, when I've never seen that.

Re:Debugging Node.js in Production by AgentME on Friday December 04, 2015 @03:32PM (#10678931)
Yeah I don't understand why "name your (short callback) functions" gets repeated as a truism so much. Do people have stacktraces that are missing line numbers?
Re:Debugging Node.js in Production by alessioalex on Friday December 04, 2015 @04:17PM (#10679199)
Line numbers don't help you with memory leaks, seeing the name of your function there does.
Re:Debugging Node.js in Production by vkjv on Friday December 04, 2015 @05:54PM (#10679769)
This. They don't show up in heap dumps and sometimes CPU profiles.
Re:Debugging Node.js in Production by jtchang on Friday December 04, 2015 @01:38PM (#10678138)
How do you easily glance at a stack trace and know if it is your own code or a 3rd party library's code? Named functions definitely help a lot.
Re:Debugging Node.js in Production by Killswitch on Friday December 04, 2015 @04:16PM (#10679191)
Because at a glance, it's easier to see the path of the file as an identifier than the name of the function. Function names are not unique throughout the codebase and dependencies. Lots of dependencies have the same named functions.