Updated 4a. JCB Demo Component Directory, Folders and Files (markdown)

Joseph Geller
2018-09-19 13:15:14 -05:00
parent f996f08308
commit 03a2fe2b52

@@ -37,11 +37,17 @@ Debugging tools are an essential part of any developer's IDE. Spending hours try
* A dump of all variables in play while single stepping through the code * A dump of all variables in play while single stepping through the code
* Easily examining classes, methods, and properties including their source on the fly during execution * Easily examining classes, methods, and properties including their source on the fly during execution
There are [many other features](https://netbeans.org/kb/docs/php/debugging.html) and functionalities not mentioned here. Effective debugging is indispensable during the development cycle of a component. It enhances the JCB build process and allows you to quickly identify and resolve issues in the component after JCB has compiled it successfully, but the component has run-time errors. Also, make use of Joomla's! built in debugging enabled in its configuration settings. The stack trace it displays, including links if using XDEBUG, are also indispensable. Plus, it integrates with an IDE like NetBeans using the [Chrome NetBeans extension](https://chrome.google.com/webstore/detail/netbeans-connector/hafdlehgocfcodbgjnpecfajgkeejnaa?hl=en). Getting XDEBUG to work with your browser and IDE can be a daunting task. [This guide](https://quantumwarp.com/kb/articles/87-netbeans/928-debugging-with-netbeans-xdebug-and-xampp-in-windows) and [another one](https://articlebin.michaelmilette.com/making-xdebug-work-with-netbeans-on-windows/) have excellent tips on using XDEBUG with NetBeans and other IDE's and include using it with a browser. It is also recommended to use [this excellent tool](https://xdebug.org/wizard.php) as it creates the necessary php.ini lines you will need to replace what NetBeans puts there which is just a stub except for the line that loads the correct DLL. The two links before that one are for understanding XDEBUG and what must be done to install it properly. The php.ini lines in them are not needed usually and the tool works just fine. There are [many other features](https://netbeans.org/kb/docs/php/debugging.html) and functionalities not mentioned here. Effective debugging is indispensable during the development cycle of a component. It enhances the JCB build process and allows you to quickly identify and resolve issues in the component after JCB has compiled it successfully, but the component has run-time errors. Also, make use of Joomla's! built in debugging enabled in its configuration settings. The stack trace it displays, including links if using XDEBUG, are also indispensable. Plus, it integrates with an IDE like NetBeans using the [Chrome NetBeans extension](https://chrome.google.com/webstore/detail/netbeans-connector/hafdlehgocfcodbgjnpecfajgkeejnaa?hl=en).
Each PHP version (WAMP allows switching between 5.x and 7.x) uses a different DLL in php.ini that WAMP switches between when different PHP versions are used. WAMP current version allows switching between that last 5.x version and three 7.x versions. So, do not change what was installed by WAMP at the end of php.ini. Comment out all the lines underneath using a semicolon (;) in each php.ini used by WAMP for each PHP version it allows you to switch to which is very nice for let's say looking at latest Joomla! version, e.g Joomla! 4 alpha. Not using the correct DLL is the most common error when using XDEBUG and WAMP sets this up correctly. The other error that is very common is not having the [Visual C++ Packages](http://wampserver.aviatechno.net/?lang=en&prerequis=afficher) installed for the corresponding version of PHP that was compiled. WAMP does this for you. The previous link is the best one for a comprehensive installation of WAMP, all on one page. Since there are many versions of WAMP, although you should be using the current one, it will not hurt to install all of the Visual C++ Packages though it takes considerable time and you must install the 32 and 64 bit versions. Read through the page completely so you install everything that is required. Go to and install all of them so you will have whatever XDEBUG needs to work with whatever version of PHP was compiled. This works and has always resolved any issues I have had with XDEBUG but like anything, do the work and read the information in the sites I have linked to. It will not work if you just install it and hope the installation took car of everything. Getting XDEBUG to work with your browser and IDE can be a daunting task. [This guide](https://quantumwarp.com/kb/articles/87-netbeans/928-debugging-with-netbeans-xdebug-and-xampp-in-windows) and [another one](https://articlebin.michaelmilette.com/making-xdebug-work-with-netbeans-on-windows/) have excellent tips on using XDEBUG with NetBeans and other IDE's and include using it with a browser. It is also recommended to use [this excellent tool](https://xdebug.org/wizard.php) as it creates the necessary php.ini lines you will need to replace what NetBeans puts there which is just a stub except for the line that loads the correct DLL. The two links before that one are for understanding XDEBUG and what must be done to install it properly. The php.ini lines in them are not needed usually and the tool works just fine.
It should be mentioned for those wishing to take the quick path you can browse com_demo_v2_0_0__J3.zip directly using Windows File Explorer as one example and skim through the tree and files without extracting it. However, this is a Joomla! component install package so it will not match the directory structure. Doing this does have benefit as and this explains how the package works. For some, this is all they require, especially if they are very experienced PHP developers, have used the Joomla! API extensively and found JCB was not very difficult to learn by just reading its code. However, if you are not at this point yet, creating the text file and performing the same analysis done here for your own component or ones freely supplied by JCB, as some are complex, is an excellent exercise. Make notes in your text file as you browse through the directories and files on your development site for later review or revisiting concepts that perhaps were not very clear at the time. Follow along as you go through the directory tree on your system. Locate and open the files in each one shown below and view its contents. Good study habits will enable you to progress quickly to become an advanced developer of components built using the MVC paradignm, JCB and the Joomla! API. It, along with the other tools mentioned here, allows you to save a lot of time, develop more components and most importantly, adhere to the [MVC paradigm](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) which is a time-saver in itself. Each PHP version (WAMP allows switching between 5.x and 7.x) uses a different DLL in php.ini that WAMP switches between when different PHP versions are used. WAMP current version allows switching between that last 5.x version and three 7.x versions. So, do not change what was installed by WAMP at the end of php.ini. Comment out all the lines underneath using a semicolon (;) in each php.ini used by WAMP for each PHP version it allows you to switch to which is very nice for let's say looking at latest Joomla! version, e.g Joomla! 4 alpha.
Not using the correct DLL is the most common error when using XDEBUG and WAMP sets this up correctly. The other error that is very common is not having the [Visual C++ Packages](http://wampserver.aviatechno.net/?lang=en&prerequis=afficher) installed for the corresponding version of PHP that was compiled. WAMP does this for you. The previous link is the best one for a comprehensive installation of WAMP, all on one page. Since there are many versions of WAMP, although you should be using the current one, it will not hurt to install all of the Visual C++ Packages though it takes considerable time and you must install the 32 and 64 bit versions. Read through the page completely so you install everything that is required. You can install all of the Visual C++ Packages as you will have whatever version of the package is needed for whatever version you have of XDEBUG. The dependency with each Visual C++ Package version depends on what version was used to compile PHP. Like anything worth the effort, do the work and read the information in the sites I have mentioned previously. It usually will not work if you just install it and hope the installation took care of everything. XAMPP will install XDEBUG without much effort from you but WAMP is a much better environment to work in (same for LAMP and MAMP).
It should be mentioned for those wishing to take the quick path you can browse com_demo_v2_0_0__J3.zip directly using Windows File Explorer as one example and skim through the tree and files without extracting it. However, this is a Joomla! component install package so it will not match the directory structure. If you are familiar with the Joomla! installation package requirements and structure this should not be a problem. For some, this is all they require, especially if they are very experienced PHP developers, have used the Joomla! API extensively and found JCB was not very difficult to learn by just reading its code.
If you have not reached this level yet, creating the text file and performing the same analysis done here for your own component or ones freely supplied by JCB, as some are complex, is an excellent exercise. Make notes in your text file as you browse through the directories and files on your development site for later review or revisiting concepts that perhaps were not very clear at the time. Follow along as you go through the directory tree on your system. Locate and open the files in each one shown below and view its contents. Good study habits will enable you to progress quickly to become an advanced developer of components built using the MVC paradignm, JCB and the Joomla! API. It, along with the other tools mentioned here, allows you to save a lot of time, develop more components and most importantly, adhere to the [MVC paradigm](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) which is a time-saver in itself.
Beneath the directory structure and files presented next you will find a short explanation of their relation to the component, the areas of the JCB component that builds each and JCB's interaction with the Joomla! API. You'll see how JCB reuses and extends Joomla!'s abstract base classes, including their methods and properties to implement the many features and functions built into JCB which are utilized by you while building a component. As you peruse the directory structure and files, links are available allowing you to quickly go to the explanatory text below the directory structure for that file, including a reference to where in JCB it originated from and any interaction between JCB and the Joomla! API. Beneath the directory structure and files presented next you will find a short explanation of their relation to the component, the areas of the JCB component that builds each and JCB's interaction with the Joomla! API. You'll see how JCB reuses and extends Joomla!'s abstract base classes, including their methods and properties to implement the many features and functions built into JCB which are utilized by you while building a component. As you peruse the directory structure and files, links are available allowing you to quickly go to the explanatory text below the directory structure for that file, including a reference to where in JCB it originated from and any interaction between JCB and the Joomla! API.
*** ***