Abstracting the Resume
Recoding all of my subdomains to follow a model-view-controller framework has been a really interesting process. I've had the opportunity to experiment with different design patterns and techniques, especially in the realm of data handling and content delivery. Abstracting out my resume is a great example of how I'm handling my data in a way that provides necessary functionality at the moment while staying flexible enough for future rewrites.
Until recently my resume was written inline with html tags, merely included into different web pages as needed. This was a bad solution - every time I wanted to change a piece of it I had to wade through html tags. I couldn't place any dynamic content in my resume or reuse it in non-html formats. A cleaner solution was needed.
My first step was to divide up my resume into pieces. I have five main categories: objective, job history, skills, achievements, and education. The objective is a single line of text while the other four categories are lists. Some of these lists are lines of text while others contain sublists, etc. I needed to come up with a way to store everything individually and a way to loop through arrays recursively to parse strings (for dynamic content, like autolinking).
A side thought of this process was to enable different resume types. Right now I only need a single resume but I wanted to add the ability to instantiate different resumes, with each one having unique objectives, skills, etc. Some pieces might be the same (like job history) and have different descriptions of the job (to highlight duties related to the resume's objective). This logic is only partially in my solution... I'm waiting to build a second resume to see how much uniqueness I will need.
For now, I wanted an immediate solution that I could go back and tweak later. The data contained in a resume is an excellent candidate for a relational database setup, something that will take a deal of time planning and executing, so I created a loose wrapper class. This class will have all of the getters/setters I need to instantiate and display a resume yet I can easily reference more complex data structures when I build the relational database in the future. For now they only retrieve properties within the class. Here's a abbreviated section of the class as an example.
class Resume
{
private static $OBJECTIVE_WEB_DEVELOPER_TEAM = 'To obtain an exciting position within a web development team that utilizes and challenges my web development skills.';
private static $ACHIEVEMENT_PERSONAL_MVC = 'Created a personal MVC framework with data abstraction, custom error reporting, and internal asset/image cache handling.';
private static $ACHIEVEMENT_REPORTING_SYSTEM = 'Developed and maintained an abstracted reporting system with run caching and flexible view logic.';
public static $DEVELOPER_VERSION = 'developer';
private $version;
function __construct($version)
{
$this->version = $version;
}
public function getObjective()
{
switch($this->version)
{
case self::$DEVELOPER_VERSION :
$string = self::$OBJECTIVE_WEB_DEVELOPER_TEAM;
break;
default :
$string = '';
break;
}
return self::format_string($string);
}
public function getAchievements()
{
switch($this->version)
{
case self::$DEVELOPER_VERSION :
$array = array(
self::$ACHIEVEMENT_PERSONAL_MVC,
self::$ACHIEVEMENT_REPORTING_SYSTEM);
break;
default :
$array = array();
break;
}
return array_map(array('self', 'format_string'), $array);
}
private static function format_string($string)
{
return $string;
}
}
There are a few things that I really like about this setup. The largest is how broken up the pieces are - by viewing each getter method you can easily see what comprises each resume (when there's more than one, that is). I could easily add a asJSON or asXML method, run through all of the get methods, and the resume would already be tailored to what was originally instantiated. One thing I'm a little uncertain about is the repetitive switch logic, but I wasn't really sure how else to do it without sloppy associative arrays.
That's how I abstracted out my resume! In my next post I'll be working with the resume again in a very different context: microformat delivery. Stay tuned!
Comments (0)