The Joomla! Community Magazine™

Practical Development

Written by | Saturday, 01 February 2014 00:00 | Published in 2014 February
Whether you are writing PHP code or styling a website with cascading style sheets (CSS), there are a range of tools which can make your life much easier and allow you to focus on writing good quality code quickly and efficiently. This "practical development" series of articles will focus on using PhpStorm as a development environment and will consider seven topics.

There is more than one way to do it *

I am not saying that what I suggest in these articles is the best – or only – way to work. I'm writing from my own experience of how I am currently working and how we are doing it at work. The information is trial tested on windows environment but shall be documented as OS agnostic as possible. The practices should be applicable to either windows, Linux or mac.
You can pick and choose the practices that suit you and I would welcome any suggestions for other IDE's or platforms which you find useful.

Topics

Each of the topics will highlight one aspect of software development as described below, and will form a separate article each month in the Joomla Community Magazine (JCM).

Setup

Setting up your working environment and tools

vg swdev 0000 setupDefine a (directory) structure, with "project directories" that allows for multiple projects / sites in your workflow. A project directory will be the central location for all data related to a project, making it easy to archive projects or transfer to a different system.
Make use of (soft-)linking (also on windows!) of files and directories, making making files from outside the "project directory" available within that "project directory". A link basically provides multiple locations to access the same file.

Project

Manage and publish your files, apply coding and style

vg swdev 0001 projectIntegrated development environments (IDE's) such as Eclipse, Netbeans, PhpStorm and others can help to enhance productivity. They offer differing levels of support for languages such PHP, JavaScript and HTML with respect to highlighting, editing, inspection, refactoring, Joomla! coding standards, extensibility via plugins and much more. In the end it is a personal choice. I settled for PhpStorm as IDE of choice.

Styling

CSS and using CSS with preprocessors

vg swdev 0002 stylingStyling a website using CSS is a basic principle of website design. While CSS is powerful,it has come a long way since it was first introduced. Techniques have been borrowed from other programming languages to advance what CSS is capable of.  Over the past years, we have seen the development of 'pre-processors' such as 'Syntactically Awesome Style Sheets' (SASS) and 'Leaner CSS' (LESS). Each have their own strengths and weaknesses which are evolving - and each output standardised CSS. To keep up with the ever-evolving functionality of the preprocessors you should not rely on support built into templates but use your IDE to do the preprocessing.

Debugging

See what is going on in the code

vg swdev 0003 debuggingThe effort and improvement of Joomla! documentation over the last years has been epic!

Being able to see what is going on in real-time within your code ( Javascript or PHP) is, however, a very useful feature and well worth taking the time to set up both for local (your PC or Mac) and for remote (you development of production server). Debugging allows you to be able to halt a script at specific points in the code, inspect and modify variables, all without making changes to the source itself. Think of it as Firebug or Developer Tools for coding.

Stop execution at specific points in the code, inspect variables and modify them, all without modifying the source. Setting it up for local and remote use is well worth the effort.

Version control

Manage changes, roll back, contribute

vg swdev 0004 version-controlA version or Revision control system (VCS) has been the friend of professional software development for decades. The tools you could choose from including, CVS, Subversion, GIT have changed over time. At this moment probably the most commonly used VCS in the Open Source world (and the system used by the Joomla! project) is GIT. An IDE can support you in the basic tasks of the VCS, creating branches for issues or added functionality and saving (intermediate) annotated changes. You can even use it to contribute to Joomla! testing and bug fixing.

Building

Installable archives, miscellaneous tasks

vg swdev 0005 buildingWhen developing your own extension (or package) in end the you need to create a archive that you can install to your site or submit to the Joomla! Extensions Directory (JED). Using building tools like make, ANT or PHING will help with these repetitious tasks. PHING is the PHP extensible version of ANT and as it is natively supported by PhpStorm makes it the natural choice for building archive, running test and validations and any other project specific  tasks.

Testing

Unit testing, automated testing, user interface (UI) testing

vg swdev 0006 testing"Everybody" talks about it but only a few manage to do it. There is a strong push and a good reason to adopt automatic testing. The concept of having automated tests seems obvious, how to actually implement and deploy these within your projects is a different thing, especially with UI interaction. I still need to wrap our head around that, and that's why we kept it for last ;)

And now

We intend to document all the above topics and share them in forthcoming issues of the Joomla! Community Magazine. If you have any comments or suggestions for topics to cover please get in touch via the bio below. Share and enjoy (thhgttg)

Read 5727 times
Tagged under Developers, English
Marco Dings

Marco Dings

Marco is a long-time technology professional based in the Netherlands, who cut his teeth in the early 90's writing his own Content Management System for his employer, eventually being fast-tracked into a management position where he was responsible for embedded systems - the software which runs our TVs, video games consoles and phones to name but a few.

After starting his own business in software and cosultancey, Marco decided to focus on webdevelopment using Joomla. Now fasttracking the business as co-owner, and CTO of the Viryagroup (merging Virya Technologies & Blox42).