3 ms·
> printing things to the console is the poor man debugger. You may want to try working with network before making this statement, when you cannot step through
by dozzie 8y ago
> printing things to the console is the poor man debugger.
You may want to try working with network before making this statement, when
you cannot step through a function because of timeouts. Or maybe even looking
at tracing debuggers, like strace, ltrace, or Erlang's gdb, which all do
little more than "printing things to the console".
Logging (and logging-like tools) is a very important way of debugging services,
you know.
- simion314 8y agoSure, if you do not have the debugger you use the logging, but you will miss the main features of a debugger like see the entire call stack, all the variables and parameters at each call stack level, you can evaluate expressions in that context. I use logging to log problems that would happen on a user machine or server where I can't open the debugger and see it. When an error happens on a server or a customer machine and I can't use the debugger I have to guess the problematic section and put lots of logging and try to reproduce, then add more logging and so on until I find the problem. Debugger are much better but I notice my other colleagues do not use them and prefer the console.log or similar
- tabtab 8y agoEach do better under certain situations. One is a hammer and another a tweezer. Different debugging jobs/steps need different tools. But the real question is whether the hammer/tweezer kit that comes with Prolog is better than the hammer/tweezer kit of other paradigms/languages. In my personal opinion and observation, the hierarchical step-wise refinement approach is quicker for most developers to grasp, learn, and debug. Maybe if those of us who don't see the grokkability benefits try it for 50 years, it will finally click. But you better hope to be in management by then because the programming field doesn't like "old people". I'm just the messenger.
- simion314 8y agoProlog is ideal for some kind of problems, good programmers should know what logic programming is and what problems are perfect for logic programming, then if in real life you hit such a problem you can chose prolog or a library that does logic programming.
- tabtab 8y agoI'd like to see a comparison to the alternatives to illustrate objective benefits. I've been down that road before in my-language-can-beat-up-your-language debates, and the end result is usually, "Well, my approach looks easier and simpler TO ME; you just think wrong." Other times they do queries in the app language when they should be using a database.
- simion314 8y agoI don't think I understand your point, prolog is a logic programming language, some problems are easy to express like facts and rules so Prolog is a good solution, you can see examples in this HN thread of real usage. It is like recursion, some problems can be solved nice with recursion but you do not use recursion everywhere. Also you can use a library in your favorite programming language and not use prolog, examples were presented in this thread. My point is that a good programmer should know about the concept not to use it everywhere, I never had the chance to use prolog so far for my work. Btw I am also past the stage where I have a favorite language and OS, every piece of software has it's issues.
- tabtab 8y agoThe examples I see are what I'd call "lab puzzles" and not practical real-world enough. I invite you to point out a specific example that's highly practical/realistic.
- simion314 8y agoDid you see the real world uses? like prolog was and may still be used in Windows? The puzzle examples are for educational purpose. Again I am just a noob, I learned Prolog and did some basic things years ago, a cool page I used to learn was this tutorial that implements a text based game , more refreshing then the tutorials with puzzles or the familiry http://www.amzi.com/AdventureInProlog/a1start.php http://www.amzi.com/AdventureInProlog/a1start.php The situation is maybe similar with GA(genetic algorithms) when you learn it you have some simple examples, when you want to solve a real problem things get complex fast(how to encode the problem,what fitness function should I use ...)