Joomla! versions that your extensions should support
What Joomla! version should I develop for? The short answer is definitely Joomla! 3, but probably Joomla! 2.5 as well, while it remains the current long term release.
If you want your extension to have the longest possible shelf life, then supporting Joomla! 3 is essential as its expiry is scheduled for September 2016, compared to Joomla! 2.5 which will have its expiry in September 2014. At the time of writing this book, the Joomla! 2.5 series is the current long term release, which is what most people should be using on their sites, and the long term release of the Joomla! 3 series is to be due out in March 2014.
Joomla! 1.5, while it is still widely in use, has already reached its official end of life which means there will be no more security releases, bug fixes, or improvements added. The Joomla! Extension Directory unpublished all extensions which only support Joomla! 1.5 in March 2013, although they can still be accessed for now at http://archive.extensions.joomla.org/.
Most developers choose to support both Joomla! 2.5 and Joomla! 3, however you need to make the decision as to whether you are going to keep these as separate packages, or just have one code base that supports both versions. There are advantages and disadvantages of both approaches. If you keep separate code bases for different Joomla! versions, then you can take full advantage of any new feature in the newer version and there will be less repetitive code, however, whenever you add a new feature or bug fix, you will need to apply these in two places. If you choose to support both the versions in the same code base, then you need to do more testing to make sure that a feature added for one version doesn't break something in the other version, or that you have a bit of repeated code that does one thing for Joomla! 2.5 and something else for Joomla! 3 – but new features and bug fixes are easier.
The differences between Joomla! 1.5 and Joomla! 2.5 are very dramatic, it was practically a rewrite and people who chose to support both Joomla! 1.5 and Joomla! 2.5 in the same code base were just making it hard on themselves. They either had to dumb down their Joomla! 2.5 versions, making them only use the features from Joomla! 1.5, or they had to rewrite massive chunks of code to backport the functionality. In comparison, the changes between Joomla! 2.5 and Joomla! 3 are relatively minor, and the good news is that since Joomla! 2.5.5, the Joomla! Platform version has been updated which added forward compatibility for some of the new stuff in Joomla! 3, and this makes it easier to support both these versions.
Anyone who wants to support Joomla! 1.5, Joomla! 2.5, and Joomla! 3 in the same code base is just asking for trouble. My advice to you is to start out developing for Joomla! 3 only, and get that functioning perfectly. Then if you choose to also support Joomla! 2.5, you can add in the appropriate code, but don't even bother with Joomla! 1.5.
What's new in Joomla! 3
There are many new features included in Joomla! 3, but some that are particularly of interest to an extension developer are:
Twitter Bootstrap
jQuery JavaScript Library
LESS CSS
Tags
PostgreSQL database support
Joomla! 3 is the first of the major open source content management systems to be mobile-friendly by default. This is due to the introduction of Twitter Bootstrap which takes a lot of the hard work out of making a website look good and making it responsive. Bootstrap relies on jQuery and LESS CSS , both of which have been added to the Joomla! core, which is great for us extension developers as it gives us some more toys to play with. You can choose not to use Bootstrap at all, just because a feature is present does not mean that you are forced to use it. In the case of Bootstrap, I would encourage you to take advantage of it, as it will make your life easier by adding responsiveness to your extensions which will make your site look good.
JavaScript libraries are used to simplify the client-side scripting of HTML, and allow you to perform common tasks in a single line of code which would be significantly more complex if you were using JavaScript alone. Two popular JavaScript libraries are jQuery and MooTools. Although jQuery has been added, MooTools is still available for those that want to use it, and some of the core Joomla! still relies on MooTools. jQuery has been used by extension developers for a long time but since it wasn't in the core phase, there were many different ways to implement it and different incompatible versions used. Some template developers even went as far as disabling MooTools which caused problems for extension developers who chose to use MooTools. Now that jQuery is in the core Joomla! and loads with no conflict by default, we can avoid many of the problems in the past. For a long time people have debated which is better, MooTools or jQuery, and there have been passionate arguments from both sides. It's great now in Joomla! 3 that you have a choice, so you can use whichever suits your needs or personal preference.
However, it should be noted that currently there are discussions on the development lists about removing MooTools entirely in the Joomla! 4.0 release, so it may be wise to opt for jQuery unless you are already familiar with MooTools.
LESS CSS is a new way of writing CSS files that allow you to reduce code repetition by using variables and other tricks not available in regular CSS. It's becoming popular with template developers, and some extension developers are also using it. We are not going to cover LESS in this book, as the extensions we are creating only require very simple CSS code.
At the time of writing this book, Joomla! 3.1 has just been released with a new tagging feature, and we expect more features to be added in Joomla! 3.2 in September 2013, such as Content Versioning which is likely to be the major new feature in that release. There will be a few more features that will slip into Joomla! 3.5 which is the long term release in the Joomla! 3 series, due to be out in March 2014. Any code that was marked for deprecation was removed in Joomla! 3.0, so although there might be some nice new features added, the underlying framework is not expected to change dramatically until Joomla! 4.0, so all the examples in this book will continue to work throughout the Joomla! 3 series. The Joomla! CMS has committed to backwards compatibility between the long term release and the previous short term releases, so any code written for Joomla! 3.0 should continue to work on Joomla! 3.5, and anything that stops working should be reported as a bug.
Joomla! has been working towards becoming database agnostic for a while now, so unlike some other CMS systems, you can run it on whichever database type you choose rather than being forced to use MySQL or MySQLi. Joomla! 2.5 introduced the Microsoft SQL Server drivers, which is supported by the core extensions and some third-party extensions, however the uptake with the extension developers has been a bit slow. Joomla! 3 now introduces another database driver, PostgreSQL, which is a popular alternative to MySQL. There are people working on implementing additional database drivers in the future, including Oracle, SQLLite, and PDO. You may be thinking that MySQL is great, and wondering why you would want to support these other databases. Well, many people are tied to using other database types due to applications they use, or they may just prefer those databases. This is particularly important for enterprise Joomla! users who may want to develop tighter integration with their existing systems and who may already have heavily invested in a particular database type. Supporting multiple database types in your Joomla! 3 extensions is not that hard. We will discuss it in detail in Chapter 6, Backend Component Development Part – 2, and I encourage you to make the extra effort.