As a lot of criteria would vary PHP from an experienced and skillful one, just about the most important criteria is the cabability to debug their own code. A beginner programmer would write his code snippet, leave parts “for later”, without spotting the fact that they left a variety of bugs, compile and run the code, and then see that his code fails, for many weird reason. Well, beginning with the compilation part to noticing that all things are messed up is a part of programming itself, and bugs on the first compilation doesn’t make you a bad programmer.
But the difference between bad/inexperienced programmers and skillful/experienced programmers starts here. A lot of the “programmers” on the market would consider their problem for (maximum) 5-ten minutes, then go to StackOverflow/FXP/Their senior programmer friend, and post something such as that:
Hello. My code doesn’t work. Here you go: some code Please fix it in my opinion. If you can’t spot at least 3 wrong aspects of this post, well, you can start thinking about a whole new career. This post shows a normal “I have never really attempted to solve this problem, solve it to me” method of thinking. You are able to immediately see that:
“My code doesn’t work” – Well, OK there. If it worked, you wouldn’t have posted it here, right? What really doesn’t work? Do you expect your mates to comprehend your code independently? “Please remedy it in my opinion” – This shows zero will to truly solve the issue. You need to understand that as long as the thing is yours, you are the one that should solve it. And naturally, I must mention that asking other people/your smarter/more knowledgeable friend needs to be the LAST thing you are doing. First, you might try and solve the problem by yourself.
So that we saw what a newcomer would do. Now, how could fiction handle this annoying but frequent situation? First, before we can solve the bug, we have to find the bug. If an exception is raised, well, you can easily tell the position of the bug. Otherwise (discussing logical bugs):
If you deal with a good IDE, like Visual Studio, Eclipse, PyCharm, etc., it is possible to run this program step-by-step, check your variables’ content, and see the line/function that fails to operate properly. If not, you are able to print checkpoints to see where the code reaches before it breaks, and you may print your variables’ values to find out what goes completely wrong. Obviously, the very first approach is preferred as it’s easier and more convenient way of working.
After spotting in which the bug occurs, you should start trying to find why it can. Usually, you’ll locate a problematic value of one of many variables on the type of the bug (could be a never raised flag, a never incrementing counter, a null or falsy value, etc.). If the problem is not variable related, it could be an uninitialized object, unopened connection, or any other arlkkg you could forget to perform – import a library, reset a connection, etc.
Now, what’s left would be to trace the problematic variable’s value, see where it’s assigned wrongly, and try to fix it (or at a minimum get the cause to the problematic assignment). In the event you don’t know why a specific function will not function as you’d expect it to, exactly what a specific class does, or what a weird error means, remember that GOOGLE is your best friend. Googling your issue will not allow you to a poor programmer. It really causes you to a better one – a programmer that may find his needed information by himself.
Now, you need to remember. Debugging is not really a science, it’s an art. It doesn’t possess a clear step-by-step solution. Always begin debugging “open minded” – bugs occur due to strange reasons, in unexpected places. Also, keep in mind that there exists no problem in seeking cancer – never feel ashamed to ask your mates/a programming forum/StackOverflow for answers. But in addition remember that other people could be more open to help should you demonstrate to them that you simply at least tried to handle your problems. Don’t permit them to believe that they actually do your projects.
And finally, a good programmer that uses the methods described here, Google and friends in a wise and balanced way would find and correct his problems one thousand times faster compared to a programmer that every bug he sees equals to another telephone call his experienced friend receives. So in a single sentence: Do your very best to analyze it utilizing the tools you might have, and inquire others only when really needed.