3 ms·
Most applications branch based upon their state. You can't just statically analyze them without knowing that state. OK, so you can add print statements to get a
by jcrben 10y ago
Most applications branch based upon their state. You can't just statically analyze them without knowing that state. OK, so you can add print statements to get a small peek into the state. But if you have a moderately complex application with multiple branches, you'll need to keep adding these to even know where to point your next print statement. That's a rather tedious feedback loop.
Functional programming does make your code more statically understandable, but it's not going to remove branching. So I guess you memorize all the inputs? Do you write them down? Might be easy if you have a simple program under your own control, but not when business requirements impose a wide array of inputs, and some of those inputs are different than you expect (hence, the bug).
It's also enjoyable to drop into a REPL (read-evaluate-print-loop) at some interesting point. At that point you can try all sorts of things with no friction. Minimize your feedback loop.
It's funny how Lisp was famous for its REPL, and yet now we're in the 21st century and some people think they're too cool to use a REPL.
As for me, I'm enjoying Redux style time-traveling debuggers... in the future rather than tedious print->run or step slowly we may just query the state of a program over time like a database.