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.

  1. class Resume

  2. {

  3. private static $OBJECTIVE_WEB_DEVELOPER_TEAM = 'To obtain an exciting position within a web development team that utilizes and challenges my web development skills.';

  4. private static $ACHIEVEMENT_PERSONAL_MVC = 'Created a personal MVC framework with data abstraction, custom error reporting, and internal asset/image cache handling.';

  5. private static $ACHIEVEMENT_REPORTING_SYSTEM = 'Developed and maintained an abstracted reporting system with run caching and flexible view logic.';

  6. public static $DEVELOPER_VERSION = 'developer';

  7. private $version;

  8. function __construct($version)

  9. {

  10. $this->version = $version;

  11. }

  12. public function getObjective()

  13. {

  14. switch($this->version)

  15. {

  16. case self::$DEVELOPER_VERSION :

  17. $string = self::$OBJECTIVE_WEB_DEVELOPER_TEAM;

  18. break;

  19. default :

  20. $string = '';

  21. break;

  22. }

  23. return self::format_string($string);

  24. }

  25. public function getAchievements()

  26. {

  27. switch($this->version)

  28. {

  29. case self::$DEVELOPER_VERSION :

  30. $array = array(



  33. break;

  34. default :

  35. $array = array();

  36. break;

  37. }

  38. return array_map(array('self', 'format_string'), $array);

  39. }

  40. private static function format_string($string)

  41. {

  42. return $string;

  43. }

  44. }

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!