Lessons from EAF

6. Reusable reusability

When we built the ElseApps Framework we learnt a lot of lessons. This series of short articles discusses some of the key learnings from our framework development. I’m sure most of them will be lessons other developers have already learnt, but many of them weren’t in our vocabulary when we started into the project.

The ElseApps Framework stands on the shoulders of giants. Open-source giants. It’s a LAMP stack web application, so obviously it owes a debt to the developers who gave us Linux, the Apache web server, the MySQL database and PHP. But it also relies on the LESS stylesheet language, Twitter’s Bootstrap presentation framework and the Javscript library jQuery. And the list of debts owed doesn’t stop there.

fw_knockoutWe wanted a client-side Javascript framework to simplify the management of dynamic content. After evaluating several candidates including Angular, Ember and Backbone, we settled on Knockout, which has proved a good choice for EAF.

fw_wikiwebhelpFor context sensitive help we elected to use Richard Bondi’s Wiki Web Help, which we’d previously customised for another project to make the pages role-specific.

fw_f3Knitting all this together is a PHP MVC library called Fat Free Framework or F3, which provides routing, templating, caching, and many of the other goodies that made the creation of the ElseApps Framework possible.

If you read the credits for each of the above open source tools, you’ll find much longer lists of contributors. The strength of open source software is the ability to reuse the building blocks that already exist.

When we were designing the ElseApps Framework we wanted to ensure our own code was also as reusable as possible. Applying this principle led to EAF’s dynamic web forms (see 4. Abstract data by type) and to our generic Knockout-based table class, which is used throughout the web application to present dynamic tabular data that’s paginated and filtered, and automatically stores user settings.

fw_pageseditor
When any setting on a table page is changed, the page automatically counts down the configurable Reload pause interval, while offering a button to pre-empt the delay. When the pause is complete, the user is advised when the data is being reloaded, and when the reload is complete.

fw_reloadpending fw_reloadloading fw_reloadcomplete

All this functionality can be reused anywhere within EAF without coding.

The table class is just one example of the sort of reusability we’ve baked into the ElseApps Framework from the outset. Over time the initial investment in reusability has reaped dividends far in excess of the upfront cost. Most client-requested customisations are easily implemented because we’ve ensured our own code, as well as the underlying open-source building blocks, is easily reused.

Next time? We have configurability in our sights (and in our sites) as we continue our lessons from EAF.

Lessons from EAFF: 1 2 3 4 5 6 7 8