Armstrong. Print statements. The great gods of programming said, “Thou shall put printf statements in your program at the point where yout hink it’s gone wrong, recompile, and run it.
It’s so funny to me that print statements get “hate”, like somehow it’s a low brow way of debugging (ditto people looking down at frontend, an area of development I find infinitely more difficult). I’m saving this quote just to throw in people’s faces. Print statements are the best. I’ve had to use debuggers in three situations, ever:
I was writing C++ and segfaulting. Adding a print statement prevented the segfault so that was not an option lol
I was writing Java and it was extremely heavy on codegen, DI frameworks, etc, so I didn’t even know where to put a print statement.
I was writing Python and the environment I was in made print statements too difficult to use.
In all 3 situations I would have preferred print statements but some artifact of the system that sucked made it too difficult. I would have preferred simply making that system suck less so that I could, but c’est la vie.
As always, it’s so nice to hear from Armstrong. His death was a great loss but I think of his words and his ideas very often.
IMO the best is being able to mark, in the editor, any expression or sub-expression to have its value recorded, without having to change the code. Sly for Common Lisp has this feature, and I miss it elsewhere.
I was being a bit hyperbolic with “the best”, perhaps. I certainly don’t hate debuggers, I used them in those instances and they were the best tool for those jobs, they saved me from some very painful situations.
Aesthetically, I really prefer debugging with print statements because it fits into a very straightforward “solve programming with programming” problem. I don’t need any other tools than what I already know, I can just “code” a solution by decomposing my program into smaller pieces, using printouts of state to guide the bisection, until I find the place where “state I expect” meets “state I don’t expect”. A debugger requires another tool and approach, which doesn’t fit into my “I’m just programming” mindset. It’s purely aesthetic, not functional, in terms of my preference.
It’s the same reason why I would prefer to declare my infrastructure using code (code code, not YAML). There are arguments for/ against the approach that vary in their justification approach, but ultimately it’s the aesthetic appeal of “I’m programming” that sways me towards it.
It’s so funny to me that print statements get “hate”, like somehow it’s a low brow way of debugging (ditto people looking down at frontend, an area of development I find infinitely more difficult). I’m saving this quote just to throw in people’s faces. Print statements are the best. I’ve had to use debuggers in three situations, ever:
In all 3 situations I would have preferred print statements but some artifact of the system that sucked made it too difficult. I would have preferred simply making that system suck less so that I could, but c’est la vie.
As always, it’s so nice to hear from Armstrong. His death was a great loss but I think of his words and his ideas very often.
IMO the best is being able to mark, in the editor, any expression or sub-expression to have its value recorded, without having to change the code. Sly for Common Lisp has this feature, and I miss it elsewhere.
Technically we should be able to do that in the BEAM ecosystem, but noone has had the time to write the bridge to the editors.
But we have all the tools and other frontends to it so…
It is just basic dynamic tracing.
Yeah, not hard at all. Though I feel you on no one writing bridges. In the CL ecosystem, your options are basically Emacs and Emacs.
I think Sly just changes the code behind your back to something that will record values, since a recompile is still needed.
For some situations.
I’m not sure why debuggers attract so much hate. In my experience it’s worth the effort to learn and understand your debugger.
I was being a bit hyperbolic with “the best”, perhaps. I certainly don’t hate debuggers, I used them in those instances and they were the best tool for those jobs, they saved me from some very painful situations.
Aesthetically, I really prefer debugging with print statements because it fits into a very straightforward “solve programming with programming” problem. I don’t need any other tools than what I already know, I can just “code” a solution by decomposing my program into smaller pieces, using printouts of state to guide the bisection, until I find the place where “state I expect” meets “state I don’t expect”. A debugger requires another tool and approach, which doesn’t fit into my “I’m just programming” mindset. It’s purely aesthetic, not functional, in terms of my preference.
It’s the same reason why I would prefer to declare my infrastructure using code (code code, not YAML). There are arguments for/ against the approach that vary in their justification approach, but ultimately it’s the aesthetic appeal of “I’m programming” that sways me towards it.
It’s a great book! I did the same thing a few years ago, here are my excerpts :)