Hi guys,
I’ve just recently (on Thursday) had a very long and what I thought very positive interview for a PHP developers job. They asked me to provide some example code to complete the application, at which point panic set in. I haven’t written any code for myself in God-knows-how-long, and all of the rest of my work is the I.P. of the people I wrote it for (ie my current employer), so, what do I send them?
In the end I decided to write a simple RBAC based CMS. It doesn’t have a template system built in, but otherwise it supports the setting of permissions, assigning them to roles, assigning users to roles and of course setting certain parts of the site to be visible depending on your permissions. I utilised FK constraints in MySQL’s InnoDB engine in order to ensure that if a role is deleted that all traces of it are deleted from other tables, as an example.
Now, bearing in mind that I’ve had about 8 hours to write this, and I’ve tried to include examples of all sorts of different things, like classes (including abstract and extended classes), various loops, complicated MySQL queries as well as a fundamental understanding of both MySQL and PHP, and the basis behind RBAC and CMS, does anyone think that I could’ve done any more? Personally I feel like I’ve outdone myself. If I’d added templates and hierarchical roles and permissions then I think I’d have the basis for a pretty solid platform, so to do this in spare time over a weekend feels like one hell of an achievement. The code may not be the neatest you’ll ever see, and I started to omit comments towards the end, but it sounds like it should be good enough doesn’t it?