{"id":1393,"date":"2023-10-29T11:35:20","date_gmt":"2023-10-29T11:35:20","guid":{"rendered":"https:\/\/matob.web.id\/random\/?p=1393"},"modified":"2023-10-29T11:35:20","modified_gmt":"2023-10-29T11:35:20","slug":"debugging","status":"publish","type":"post","link":"https:\/\/matob.web.id\/random\/debugging\/","title":{"rendered":"What is Debugging?"},"content":{"rendered":"<p>For those of you who want to dive into the world of programming or developing, like it or not, you have to be familiar with debugging.\u00a0<a href=\"https:\/\/matob.web.id\/random\/1001\/debugging\"><strong>Debugging<\/strong><\/a>\u00a0is the process of removing bugs in the code.<\/p>\n<p>Oh, spoiler, yes, the bug in coding is really annoying.\u00a0If there is even one bug in the code, the whole program can crash, it can even jeopardize the security of a program that has been painstakingly created.<\/p>\n<p>But calm down, getting rid of bugs is not as difficult as imagined, really.\u00a0In this article, we will discuss what debugging is, how it works, and learn how to handle debugging with 9 effective tips.<\/p>\n<h2>What is Debugging?<\/h2>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\" wp-image-1396 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/Debugging.jpg\" alt=\"Debugging\" width=\"396\" height=\"396\" title=\"\" srcset=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/Debugging.jpg 626w, https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/Debugging-60x60.jpg 60w\" sizes=\"(max-width: 396px) 100vw, 396px\" \/><\/p>\n<p><a href=\"https:\/\/matob.web.id\/random\/1001\/debugging\"><strong>Debugging<\/strong><\/a><a href=\"https:\/\/matob.web.id\/random\/1001\/debugging\">\u00a0<\/a>is the process of identifying and removing bugs or errors in the code.<\/p>\n<p>This bug causes an application or software not to run properly.\u00a0For example, failed logins, errors when inputting data, feature dysfunctions, blue screens, etc.<\/p>\n<p>Since the coding system of a program is usually complex and complex, a single error in the code can affect the entire program.<\/p>\n<p>It&#8217;s no wonder that debugging can take longer than writing the program itself.<\/p>\n<p>That&#8217;s why debugging is so important.\u00a0Both before the release of the application and after.<\/p>\n<p>You don&#8217;t want it, right, the program is already running, let alone used by the client, but suddenly there is an unexpected error?\u00a0Or even abused intruders such as malware and his comrades?\u00a0Hey, that&#8217;s scary!<\/p>\n<h2>Why is Debugging Needed?<\/h2>\n<p>Debugging is one of the mandatory things when building a code-based application\/software.<\/p>\n<p>In addition to\u00a0the main goal of\u00a0solving bugs, this process has several\u00a0other\u00a0benefits\u00a0, such as:<\/p>\n<ul>\n<li>Errors can be detected early;<\/li>\n<li>The repair process can be carried out as early as possible;<\/li>\n<li>Avoid further program design errors;<\/li>\n<li>Can provide data structure information;<\/li>\n<li>Help developers reduce useless information;<\/li>\n<li>Reducing the risk of hackers infiltrating through bugs or errors;<\/li>\n<li>Developers can avoid complicated testing processes, saving time and energy when coding.<\/li>\n<\/ul>\n<h2>How Debugging Works<\/h2>\n<p><img decoding=\"async\" class=\"size-full wp-image-1397 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/Debugging-Works.jpg\" alt=\"Debugging Works\" width=\"626\" height=\"417\" title=\"\"><\/p>\n<p>Usually, debugging will be done by the\u00a0debuggers\u00a0.\u00a0However, this skill is also an important point that programmers or full stack developers must have.<\/p>\n<p>That&#8217;s because the way debugging works is very close to coding work.\u00a0Sequentially, how debugging works can be described in six steps, namely:<\/p>\n<h3>1. Reproducing Bugs<\/h3>\n<p>The first thing you should do is reproduce the bug.\u00a0The trick\u00a0is to properly\u00a0document all existing bug issues\u00a0.<\/p>\n<p>There are several\u00a0objectives\u00a0why this stage is very important, namely:<\/p>\n<ul>\n<li>Determine the priority scale for resolving bugs;<\/li>\n<li>Bugs can be solved with the right team;<\/li>\n<li>Map out which bugs have not been resolved, are ready for testing, and passed quality control;<\/li>\n<li>Test on different devices and browsers to see if there are any other bugs.<\/li>\n<\/ul>\n<p>When you&#8217;ve reproduced a bug it means you&#8217;ve pocketed any <a href=\"https:\/\/matob.web.id\/random\/1001\/bug\/\">bugs<\/a> that need to be fixed.\u00a0Well, you can appoint the relevant teams to do the next stage.<\/p>\n<h3>2. Identifying Errors<\/h3>\n<p>Next, identify errors, namely by\u00a0collecting error reports\u00a0or errors in the program.\u00a0For example, when a software command fails to execute, there may be a syntax bug in the script.<\/p>\n<p>This list of errors is usually obtained when testing the program, both internal testing and testing by clients.<\/p>\n<p>At this stage, make sure to really identify the program thoroughly.\u00a0So that the debugging process is more efficient and later there will be no more bugs that are still left.<\/p>\n<h3>3. Locating the Bug<\/h3>\n<p>After identifying, it&#8217;s time to find\u00a0out where the error\u00a0in the code is.\u00a0For example, in navigation code, command buttons, etc.<\/p>\n<p>That&#8217;s why identification of bugs during testing is important.\u00a0Because the location of the bug may be detected at that time.<\/p>\n<h3>4. Analyze Errors<\/h3>\n<p>Okay, already know there is a bug and where it is located, so let&#8217;s analyze the error, so that later the right fix can be done.<\/p>\n<p>Tips for sure\u00a0: Use\u00a0bottom-up techniques\u00a0or analysis from the smallest code at the error location to the surrounding code unity.<\/p>\n<p>The goal is to keep you aware of other bugs surrounding the error code.\u00a0And minimize the risk of additional errors during repair.<\/p>\n<p>Like a radar, you can fix the error center as well as find other errors.\u00a0Who knows, the error code will have an effect on other codes, right?<\/p>\n<h3>5. Proving Error Analysis<\/h3>\n<p>Well, the results of your bug analysis may find bugs in certain locations.\u00a0Before fixing it, you need to prove that there are no other errors that might appear in the software.<\/p>\n<p>To do this, you can\u00a0write automated tests on bug locations\u00a0with the help of the test framework.<\/p>\n<p>After the test script is done and there are no problems \/ errors that may appear, then go to the next stage.<\/p>\n<h3>6. Perform Debugging on All Errors<\/h3>\n<p>If you find more than one bug, don&#8217;t be sad.\u00a0You can\u00a0collect\u00a0in advance all the unit test code that you want to change.<\/p>\n<p>Once everything is gathered, run a code test on each code you want to change.\u00a0Remember, everything must pass the trial, yes.<\/p>\n<h3>7. Fix and Validate Scripts<\/h3>\n<p>OK, you&#8217;ve come to the final step.<\/p>\n<p>Already have a fix code?\u00a0Well, this is the moment you&#8217;ve been waiting for,\u00a0put all the code\u00a0that you have fixed and has passed the test into the framework.<\/p>\n<p>Always do\u00a0double checking\u00a0.\u00a0Retest all scripts and make sure the program runs as expected.<\/p>\n<p>If there are any more bugs?\u00a0Do not hesitate to repeat from number one yes.\u00a0Spirit!<\/p>\n<h2>Debugging Tips for Beginners<\/h2>\n<p><img decoding=\"async\" class=\" wp-image-1398 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/CPANEL.jpg\" alt=\"CPANEL\" width=\"774\" height=\"359\" title=\"\" srcset=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/CPANEL.jpg 1166w, https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/CPANEL-768x356.jpg 768w\" sizes=\"(max-width: 774px) 100vw, 774px\" \/><\/p>\n<p>In addition to these six must-dos, there are some debugging tips that you should know.<\/p>\n<p>The following tips can make debugging a very complicated and tedious process easier.\u00a0Both in CMS WordPress and coding such as HTML, PHP, etc.<\/p>\n<p>What are the tips?\u00a0Read on for more.<\/p>\n<h3>1. Enable WP_DEBUG<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1399 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/WpConfig.jpg\" alt=\"WpConfig\" width=\"756\" height=\"458\" title=\"\" srcset=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/WpConfig.jpg 756w, https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/WpConfig-298x180.jpg 298w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/p>\n<p>WP_DEBUG is a debugging mode feature in WordPress.\u00a0The system works by \u201cforcing\u201d WordPress to display error messages and provide warnings for bugs encountered.<\/p>\n<p>You can find it in the\u00a0<strong>wp-config.php<\/strong>\u00a0file\u00a0.\u00a0Change the value from &#8216;false&#8217; to &#8216;true&#8217;.\u00a0You can find it in the File Manager menu in cPanel.<\/p>\n<p>Once in the\u00a0<strong>cPanel<\/strong>\u00a0tab\u00a0, please select the\u00a0<strong>File Manager<\/strong>\u00a0menu\u00a0.<\/p>\n<p>You just need to look for the whereabouts of the\u00a0<strong>wp-config.php<\/strong>\u00a0file\u00a0.\u00a0Please check\u00a0<strong>public_html<\/strong>\u00a0, it&#8217;s possible the file is there.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1400 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/Wp_Debug.jpg\" alt=\"Wp_Debug\" width=\"647\" height=\"370\" title=\"\"><\/p>\n<p>Open the file and look for\u00a0<strong>define( &#8216;WP_DEBUG&#8217;, false )<\/strong>\u00a0.\u00a0Please change the value &#8216;\u00a0<strong>false<\/strong>\u00a0&#8216; to &#8216;\u00a0<strong>true<\/strong>\u00a0&#8216; and save the file.<\/p>\n<p>IMPORTANT!<\/p>\n<p>After you find a bug and fix it, immediately change the value &#8216;true&#8217; back to &#8216;false&#8217;.<\/p>\n<p>This is because WordPress security is designed to \u201chide\u201d website bugs or errors.\u00a0If WP_DEBUG is active, then all error details can be read and become an opportunity for hackers to enter the WordPress system.<\/p>\n<h3>2. Enable WPDB Error Reporting<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1401 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/wpdb.jpg\" alt=\"wpdb\" width=\"826\" height=\"397\" title=\"\" srcset=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/wpdb.jpg 1099w, https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/wpdb-768x369.jpg 768w\" sizes=\"(max-width: 826px) 100vw, 826px\" \/><\/p>\n<p>Do these tips if you identify an error in the website database.<\/p>\n<p>You can use this technique to display SQL errors in <a href=\"https:\/\/wordpress.org\/download\/\" target=\"_blank\" rel=\"noopener\">WordPress<\/a> queries.\u00a0The way to debug with these tips is to change the value of the\u00a0<strong>$show_errors<\/strong>\u00a0variable\u00a0.<\/p>\n<p>To enable WPDB Error Reporting, please go to the\u00a0<strong>File Manager<\/strong>\u00a0menu\u00a0(like the tutorial on WP_DEBUG).<\/p>\n<p>Then, open the file\u00a0<strong>public_html\/wp-includes\/wp-db.php<\/strong>\u00a0.<\/p>\n<p>Look for the wpdb class and change the value\u00a0<strong>$show_errors = false<\/strong>\u00a0to\u00a0<strong>true<\/strong>\u00a0.<\/p>\n<p>After that, WordPress will show all the queries made on your website and start performing error analysis.<\/p>\n<blockquote><p>IMPORTANT!<\/p>\n<p>Do not debug on an active website, visitors will get an error message.\u00a0We recommend using a dummy website or a website where you test all your code before releasing it.<\/p><\/blockquote>\n<h3>3. Check Error Log<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1402 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/error-log.jpg\" alt=\"error log\" width=\"593\" height=\"562\" title=\"\"><\/p>\n<p>If you encounter an\u00a0<em>Internal Server Error<\/em>\u00a0while the website is being browsed, it&#8217;s likely an HTTP Error 500. All you have to do is debug, of course.<\/p>\n<p>Although there is no detailed error information, you can check the website&#8217;s error log to deal with it.<\/p>\n<p>When there is an error on the website, usually the hosting will automatically add the\u00a0<strong>error_log<\/strong>\u00a0file\u00a0in the\u00a0<strong>public_html<\/strong>\u00a0folder\u00a0.\u00a0You can check for bugs or errors that occur there.<\/p>\n<h3>4. Use Website Staging<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1403 size-full\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/11\/WordPress-Staging.jpg\" alt=\"WordPress Staging Debugging\" width=\"620\" height=\"305\" title=\"\"><\/p>\n<p>Direct bug fixes on the original live website are very risky, you know.\u00a0All changes can be activated immediately and can make visitors feel uncomfortable.<\/p>\n<p>In addition, if there is a fatal error, it could be that your original website is directly affected.<\/p>\n<p>Well, to minimize unwanted things, you need to use a staging website when debugging.<\/p>\n<p>Staging websites are clones of your original website.\u00a0Point, to do all kinds of testing, including debugging.\u00a0So you can preview the changes before they are released on the original website.<\/p>\n<p>WordPress itself already has WordPress Staging, a feature you can use for testing.<\/p>\n<p>You can get this feature and use it automatically in your Hosting Member Area. The activation method is very easy, just go to <strong>Hosting<\/strong> <strong>Member Area<\/strong>\u00a0&gt;\u00a0<strong>WordPress Management<\/strong>\u00a0&gt;\u00a0<strong>Sites<\/strong>\u00a0&gt;\u00a0<strong>Staging<\/strong>\u00a0.<\/p>\n<h3>5. Enable SCRIPT_DEBUG<\/h3>\n<p>Enabling SCRIPT_DEBUG can be done if there is an error in the script or plugin that you are running.\u00a0For example, plugins not running, hidden, etc.<\/p>\n<p>It could be because WordPress uses CSS and JavaScript files, but in a minified version.\u00a0The goal is to speed up website loading.<\/p>\n<p>To fix this, please go to File Manager and open the wp-config.php file.<\/p>\n<p>Then, enter\u00a0<strong>define( &#8216;SCRIPT_DEBUG&#8217;, true )<\/strong>\u00a0in the wp-config.php file.<\/p>\n<p>After that, WordPress will automatically load the original CSS and JavaScript files.\u00a0So that all plugins can run in full and you can continue to analyze errors.<\/p>\n<h3>6. Error Detection in PHP<\/h3>\n<p>For PHP programs, bugs often still occur.\u00a0To find out any information about PHP status, compilation options, extensions, etc., you can monitor it in the phpinfo file.<\/p>\n<p>The debugging method is to configure the php.ini file to enable error reporting.<\/p>\n<p>However, to access this file you need root access, so you need a hosting package such as VPS in order to make configuration more flexible.<\/p>\n<p>For those of you who don&#8217;t use a VPS, an alternative can be to use PHP Code Checker.\u00a0Later these tools will check your entire code and help detect bugs.<\/p>\n<p>There are also other tools that you can use, such as Eclipse and PHPStorm.\u00a0After that, then you can enter the stage of proving bug error analysis.<\/p>\n<h3>7. Take advantage of Debugging Tools<\/h3>\n<p>We all know that the debugging process requires high accuracy and takes a lot of time.\u00a0To ease your work, there&#8217;s nothing wrong with using the help of debugging tools.<\/p>\n<p>Currently, there are many debugging tools available.\u00a0Whether it&#8217;s for CMS WordPress, PHP coding, and other programming languages.\u00a0Well, here are some examples of debugging tools that you can try:<\/p>\n<ul>\n<li><strong>GDB Tools (GNU Project Debugger)<\/strong>\u00a0: Debugging tools for C\/C++ in Unix programming.\u00a0This tool is also preinstalled on Linux systems.<\/li>\n<li><strong>DDD Tools (Data Display Debugger)<\/strong>\u00a0: Focus on running the Graphic User Interface on Unix systems.<\/li>\n<li><strong>Eclipse<\/strong>\u00a0: A tool that can help with the integration of editors, build tools, debuggers, and other development tools.\u00a0Can be used on Windows, Linux, Solaris, etc systems.<\/li>\n<li><strong>Query Monitor<\/strong>\u00a0: A WordPress plugin that has the ability to enable database queries, PHP errors, stop editor blocks, etc.<\/li>\n<li><strong>New Relic<\/strong>\u00a0: A premium tool for WordPress that can monitor user experience, map WordPress architecture, to detect anomalies before they occur, and much more.<\/li>\n<\/ul>\n<p>For reasons of effectiveness, what you can use when debugging are\u00a0<strong>IDE<\/strong>\u00a0or Integrated Development Environment\u00a0tools\u00a0.<\/p>\n<p>Tools with this IDE system can combine the required performance tools.\u00a0For example block editor, editing source code, debugger, etc.<\/p>\n<p>Examples such as Eclipse.\u00a0So you can monitor multiple jobs at once.<\/p>\n<h3>8. Check Syntax<\/h3>\n<p>Programmers are human too, agree?\u00a0That&#8217;s why one of the bugs that often occurs is a syntax error.<\/p>\n<p>Once the bug is identified, immediately check your syntax.\u00a0It might just be missing a semicolon, it could be that the command line hasn&#8217;t been closed, or even just a one-letter typo in the command, etc.<\/p>\n<p>Remember, the slightest mistake can cause errors and affect many aspects of your code.<\/p>\n<h3>9. Check Browser<\/h3>\n<p>Having problems with the display in the browser?\u00a0It&#8217;s possible that it&#8217;s a bug caused by your code not being compatible with the browser.<\/p>\n<p>For HTML and CSS code, problems related to the appearance of the website in the browser are often encountered.\u00a0The way to fix this, try checking the display in several different browsers.<\/p>\n<p>It&#8217;s a good idea to first check in several different browsers to make sure that your HTML and CSS code can appear flawlessly in the browser.<\/p>\n<p>You can use test tools like BrowserShots, EndTest, Selenium, IE Tab, etc.<\/p>\n<h2>Ready to Battle Bugs?<\/h2>\n<p>By now, you already know what debugging is, why it is important to do it and how it works, up to 9 tips for debugging.<\/p>\n<p>There are bugs in the code, like insects in the house.\u00a0It&#8217;s annoying, but if not handled properly it can cause fatal damage.<\/p>\n<p>Debugging is one solution and a way out to save your entire code.<\/p>\n<p>Well, I hope this article helps you in debugging.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For those of you who want to dive into the world of programming or developing, like it or not, you have to be familiar with debugging.\u00a0Debugging\u00a0is the process of removing bugs in the code. Oh, spoiler, yes, the bug in coding is really annoying.\u00a0If there is even one bug in the code, the whole program [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1395,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[154,153],"class_list":["post-1393","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-2","tag-debug","tag-wp-debug"],"_links":{"self":[{"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/posts\/1393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/comments?post=1393"}],"version-history":[{"count":1,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/posts\/1393\/revisions"}],"predecessor-version":[{"id":2441,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/posts\/1393\/revisions\/2441"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/media\/1395"}],"wp:attachment":[{"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/media?parent=1393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/categories?post=1393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/tags?post=1393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}