DACS took a deep dive into website programming at the April General Meeting – no holds barred! Dan O’Connor gave us an in-depth view of the tools he uses to develop interactive web applications. This field is literally an alphabet soup of acronyms – Dan helped us a lot to make sense of them.
The session was ostensibly about WAMP (Windows, Apache, MySQL, PHP) but Dan quickly explained that LAMP (Linux, Apache, MySQL, PHP) is essentially the same thing: it makes little difference to the programmer, and none at all to the end-user, what OS platform is being used. WAMP is popular, however, because it makes it easy to install and run the entire “stack” on a single Windows machine, providing a development environment that is familiar and accessible to many.
Dan devoted the first part of his presentation to an explanation of some of the basic technologies that comprise WAMP and that are used with it.
PHP is a programming language that is used on the “back-end”, i.e. server side, of websites. All popular content management systems (CMS), e.g. WordPress, Joomla, are written in PHP. It is one of various languages used on the server; Python, for example, is another: Dan mentioned that although Python can require much less coding than PHP, the learning curve for it is steeper. PHP can be slow by comparison to Python and other languages but that is changing with the advent of PHP 7.
Apache is a very popular open-source web server software that is used by shared hosting services like GoDaddy, Network Solutions, etc.
MySQL is the leading open-source software used to host and manage databases. SQL (Structured Query Language) is the language used to access and update a MySQL database but, as Dan explained later in his presentation, there are programming techniques that can make it unnecessary to use SQL.
JavaScript is the most widely-used programming language on the “front-end”, i.e. the client side of websites (in the end-user’s web browser). Note: JavaScript and Java are not related. jQuery is a library for JavaScript that provides pre-coded functionality and can greatly reduce the amount of coding needed for a specific application.
Another piece of software technology that Dan described is the Zend Framework for PHP. Similarly to jQuery for JavaScript, Zend provides access to tools and code libraries that support the PHP programmer.
Dan illustrated his talk with examples based on the work he does for Agera Energy. In response to a question, he explained that the company’s website is hosted in-house on its own web servers and, in consequence, the environment is different from that experienced by hosting service customers. For example, the version of PHP used by Agera is driven by the needs of application code that runs the business. In a shared hosting situation, the hosting company chooses what version(s) of PHP are available to its customers.
MVC (Model-View-Controller) is an architectural model that many professional programmers use for the development of applications. The View is the code on the client side, e.g. HTML, CSS, JavaScript, etc. The Controller is the code on the server, typically written in PHP, and the Model is a representation (in code) of the database. These components provide conceptual containers to organize the application’s code. The MVC model is built in to the Zend framework.
Dan is a big proponent of WordPress for building simpler websites and he described how some of his personal sites are built in WordPress. One example is www.danosongs.com, which reflects Dan’s other life, as a singer / songwriter. His music is available on the website for pro bono use by schools and non-profits.
Starting as a system for posting blogs, WordPress has evolved into a full-blown CMS and has become very popular. Many free plug-ins are available to add specialized functionality. Dan emphasized the importance of keeping a WordPress site up-to-date to prevent it from becoming vulnerable to hacking.
Dan explained that many of the technologies which were the subject of his presentation come into play mainly for the development of sophisticated, special-requirements websites. More straightforward sites can be developed without high-end expertise, using software such as WordPress, or other CMSs.
After the break, our speaker gave us a live demonstration of the concepts and tools that he had described. The demo was based on an application that he is working on at Agera, and we are indebted to the company for allowing him to use their software as an example.
After a brief overview of the alternate energy supplier business, Dan showed us the Models (as in Model-View-Controller) that he works with. (Dan demonstrated using SQLyog but there are other good database tools available, e.g. phpMyAdmin.) Then, using Zend Studio, an Integrated Development Environment (IDE), we saw actual PHP code. He showed us the components (get name and set name commands) that perform database updates without using SQL. About 70% of all database access is done by this method. A piece of software called the Data Adapter maps the Models to the database. Dan gave us an example of a case where get / set could not handle the access and he had to write custom SQL code. The Data Adapter handles any complexity or messiness in the database and hides it from the Model.
Dan talked briefly about the Controller components. Each Controller maps to a website page. His specific example was the Index controller, which corresponds to the index.html file that is the home page entry point for basic websites.
Then we got to the View. Using the Agera example again, Dan demonstrated a front end containing several forms. We saw the browser screen and the code behind it. He explained how some of the form buttons use jQuery code to manipulate data in the browser. In the example, Dan showed a section that was hidden from the user initially but would appear when a table row was clicked.
Dan also demonstrated the use of AJAX. AJAX (Asynchronous JavaScript and XML) is a set of techniques that allow the browser page to be updated without reloading it from the server. In his example, the browser used AJAX to update information about an Agera customer without reloading the page. This technique allows the user to continue working while processing goes on behind the scenes.
Dan described other cases where he has used jQuery to meet complex user interface needs.
This was an excellent presentation that very clearly explained a lot of very abstract concepts and techniques. Our thanks to Dan O’Connor for a job well done. A pdf containing Dan’s presentation slides may be found on the DACS Downloads page of the DACS website.