Earlier quoted context omitted.
Whats even better than print for debugging is using a debugger...
Doesn't quite work when debugging a distributed system, though. You end up adding a lot of "distributed print", AKA logging.
Why I love Common Lisp and hate Java (2012)
21–30 of 171 posts
Re: Why I love Common Lisp and hate Java (2012)
#22Earlier quoted context omitted.
Whats even better than print for debugging is using a debugger...
I disagree. Most of the time, I find a debugger just slows me down. It's super helpful in some cases, but good logs can pinpoint problems far before a debugger can. Also, building in debug mode can change everything, so you may not even catch your bug, especially if it's concurrent in nature.
Of course we all hope for well thought out logging to troubleshoot issues we're seeing in prod.
I'm referencing an pattern I see with junior devs who simply use "printf debugging" in development instead of learning to use a debugger properly, even with distributed systems.
Re: Why I love Common Lisp and hate Java (2012)
#23Earlier quoted context omitted.
Whats even better than print for debugging is using a debugger...
I disagree. Most of the time, I find a debugger just slows me down. It's super helpful in some cases, but good logs can pinpoint problems far before a debugger can. Also, building in debug mode can change everything, so you may not even catch your bug, especially if it's concurrent in nature.
I regularly see pais+ of println debuggers debate and speculate while the guy with the debugger drills straight down to the issue, and fixes it.
Re: Why I love Common Lisp and hate Java (2012)
#24Earlier quoted context omitted.
Fair enough, but attaching multiple debuggers across several interacting components with conditional breaks gets me there faster than incrementally inserting progressively more print statements, in a dev environment. Proper logging is a given doping out problems in a production system to then verify and correct in dev.
Logs aren't a bad thing and they aren't going away. Whoever let's you setup debuggers on prod should be fired.
My comment explicitly stated dev environment, not prod, for debugger usage.
Re: Why I love Common Lisp and hate Java (2012)
#25That's why it's always a battle to push languages like Lisp, that offer mathematical elegance over languages that are a soup of half baked idea that veer programmers away from ideas that take more than a few days to master. For those of us who aspire to do better, we should continue to try to bring the from first principles approach of functional programming to the mainstream.
Re: Why I love Common Lisp and hate Java (2012)
#26It is a recurring theme for people to point out how verbose a hello world program is in Java: class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); } } For argument sake, let's compare it not to Lisp but to Python instead: print("Hello World!") Once you get proficient in a language and start writing larger programs, your perspective can change entirely. What appears to be…
And honestly, I always feel that the Hello World example is kind of biased. It's more an example of Java's way of launching a program being verbose because every program requires a certain minimal structure. But for the rest of the entire Java language that's not the main method, the only real "verbosity" comes from having to declare types, which is pretty much just a requirement of statically typed language and isn't so specific to Java itself.
I've written reasonably large amounts of code in Python, Javascript, Ruby, Racket, StandardML, etc. Every language has its own little forms of "beauty" - chunks of code that are particularly short and pretty to write in those languages. And I do get a certain amount of satisfaction doing trickier operations in a couple lines in languages like Python. But I always end up preferring Java's more verbose style because I don't want to have to think about the correct syntax to maximize my code's stylishness.
Re: Why I love Common Lisp and hate Java (2012)
#27Earlier quoted context omitted.
> Do you really want print() to be so easily accessible in the top-level namespace? It seems to me that the bigger an application gets, the worse it is to easily litter the codebase with print statements. Yes? It's great for debugging, which is generally what you'd use a print for anyways in a large application.
You really should be using a logging framework instead though, if you're working on a large application.
Re: Why I love Common Lisp and hate Java (2012)
#28Earlier quoted context omitted.
> Do you really want print() to be so easily accessible in the top-level namespace? It seems to me that the bigger an application gets, the worse it is to easily litter the codebase with print statements. Yes? It's great for debugging, which is generally what you'd use a print for anyways in a large application.
You really should be using a logging framework instead though, if you're working on a large application.
Re: Why I love Common Lisp and hate Java (2012)
#29If you are running JDK 9 or later, you can use jshell: jshell> "Hello World!" $1 ==> "Hello World!" https://openjdk.java.net/jeps/222
And lambdas were introduced in 8 making nearly all of the author’s issues mute.
Re: Why I love Common Lisp and hate Java (2012)
#30Earlier quoted context omitted.
I disagree. Most of the time, I find a debugger just slows me down. It's super helpful in some cases, but good logs can pinpoint problems far before a debugger can. Also, building in debug mode can change everything, so you may not even catch your bug, especially if it's concurrent in nature.
This idea that debugging with print statements is superior to using a debugger is simply false. Learn to use the debugger for your platform it will pay huge dividends throughout your career. I regularly see pais+ of println debuggers debate and speculate while the guy with the debugger drills straight down to the issue, and fixes it.