My blog app: separation of concerns

Published on Sunday 24 April 2016. Tagged as General.

These are the basic principles of my Blog application: In the browser, clear separation of content, presentation and behaviour. On the server: a basic model-view-controller concept.

Front end: HTML, CSS, JavaScript

To have clear separation of content, presentation and behaviour in the front end 'page' of a web application, each part has to be put in a separate file:

PHP: separation of site and admin

For everyone except me, my blog should only be read, so only the list of posts and the rendering of each individual post is necessary. For myself, there is a separate admin part. Each part follows a simple MVC structure, with the admin classes inheriting from the blog app part. Since there is no interaction other than to read, the public part of my blog offers no security risks. The admin part has enhanced security built in.

PHP: a simple model-view-controller

The entire blog app

The entire application I've written so far weights a mere 50K in total, that's 10 times less than the weight of an average single web page nowadays. For another comparison: an average WordPress installation needs a whopping 50MB. That's more than a 1000 times more. I'll publish the sample code I've produced so far on github later.

The Blog app project on GitHub