How many of you use a debugger?

Like Xdebug and the like. I’m getting used to using Xdebug with PHPStorm and am loving it. Very powerful stuff.

Do you use a debugger too?

  • Yes, I do
  • No, not at all
  • Only once and a while
  • What is a debugger?

0 voters

Scott

Not unless you count “oh, there’s a fatal error on my browser” as debugging :stuck_out_tongue:

1 Like

I don’t understand why it is so difficult for people to use a debugger. None the less I welcome the efficiency and overall value created for myself in comparison to someone who does not. Now that might not be true for small scripts but when bug fixing and customizing platforms written on frameworks and cm’s it is most definitely true. So long as problem can be replicated locally it can be solved starting with smart debugging. Sometimes just starting at the front-end controller and executing line by line. I can’t even begin to think how much time that would take using var_dumps or logging. However, with smart debugging tools it is a relatively straight-forward and simple process to go from front-controller to where a problem might exist that is the cause of an error. Also although Symfony and Laravel have excellent documentation there always comes a point where business requirements will surpass the documentation. The easiest way to figure things out for ones self is to use smart debugging and just go line by line through the code. Not to mention using smart debugging prevent accidental code pushes with debug code which I have seen happen and is so funny when it does. Well for me not for them.

Honestly, I think it is the best invention in the php ecosystem. Especially with all these behemoth open source projects that would be near impossible to debug without it.

1 Like

I would say, it is because a debugger needs to be configured and most importantly understood how to use. You must also install xdebug or Zend debugger. Although none of these step are a huge hurdle, they are a hurdle.

This is a great video about PHPStorm’s debugging system for anyone interested.

Scott

I don’t know many people who tried it and couldn’t figure it out. Instead, I think not nearly as many start using it in the first place. And I think that’s because we the community don’t push it as strongly as we could. For example, when we see someone with bad password hashing, or an injection vulnerability, then we strongly and immediately inform them, even if it’s unrelated to their original question. But if we see var_dump() debugging? We don’t go nearly as far out of our way to inform people about XDebug. It suffers from lethargic marketing. :slight_smile:

1 Like

Actually, this is often asked. “What does var_dump($someVariable) show?”, instead of, “What does your debugger tell you about the value of variable $someVariable?” It seems almost more the norm to expect devs to use var_dump or echo. For a quick “trouble shooting” and at the level some of the questions are asked, it makes sense too. Hmm…

So how can we energetically market advanced debugging tools?

Scott

1 Like

Which is one reason I also highly support vagrant. In particular puphpet.com which makes it super simple to install xdebug.

1 Like

Mostly because var_dump is part of the language, accessible by all, rather than saying “Have you installed a debugger on the server that you may or may not control, and what does it tell you?”

Which… is another disconnect, i feel - oddz espousing the benefits of debuggers is all well and good, but when the majority of people using this site are people running a single script on a shared host… not really viable for a help strategy? If we were an enterprise site, or a specific product site, then absolutely.

But, they wouldn’t be true developers on a shared server, would they? I would think people on shared hosts would be more the end user of any software. I would hope the actual developer, any developer, who would consider himself even semi-professional, would have a development environment, which would include a debugger.

Scott

Tell that to the designer running Wordpress. I honestly believe that over half the people that offer professional services related to PHP work directly on production. Just from the very things I see posted on this forum.

But this forum isn’t targeted specifically at professionals. We get problems like “Why isn’t this if statement evaluating as I think it should”? because we have people of all skill levels here. Those people with the simpler questions (that are often very easily answered by use of a well placed var_dump()) are probably not in a position to install xdebug. It’s nice to see articles here focussing on vagrant and more advanced topics though :slight_smile:

A second hurdle is having an editor that supports it.

When I first tried using a debugger (many years ago!) the biggest issue was actually getting it to the right part of the code, with login systems and post data changing the code paths, it can take quite some work to get the debugger to the right place in the code to be useful… and it becomes quicker to just var_dump and view it in a browser.

I solved this, of course, by adopting TDD and using the debugger with the unit test :slight_smile:

1 Like

Eclipse is a free option that supports it and PHPStorm is another. I have tried to use it with Atom but ran into some hurdles. It can be tricky to set-up but given a PHP focused workflow it is worth it. Anything that promotes solving ones problems without including others in the conversation is worth it.

I wasn’t thinking specifically about this forum, when I wrote that. I actually said this earlier, about your point.

:smile:

Scott

Debugging is awesome. When it was first suggested to me I thought, “oh yeah I could see how that would be useful”, but didn’t think too much of it. Then when I had a bug that was layers deep in some legacy code, I gave it a go and wow it saved me hours!
Now that I’m in the habit and it’s all setup I use it quite regularly and it really is an invaluable tool.
Although I do remember I had some trouble setting it up at first and had to play around with it a bit (although a lot of that was initially following a guide that was doing it in a strange way).
I would definitely recommend anyone out there thinking about it to give it a go :smile:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.