If you ever find yourself doing a coding test against a time limit, resist the urge to just jump right in and start coding right away. Spend a few minutes at the very beginning and lay out your strategy for how you’re going to approach the problem.
Then set some alarms so you can check on your progress. In the test I performed (see You Have Passed The Test: A PHP Coding Test), I could have spent a lot of time really thinking about the best way to bring in and parse the XML data. But if I spent too much time there, I would have been scrambling to finish the currency conversion methods. Or worse, I wouldn’t have done the testing that I did.
Since I allotted 4 hours for the test, I broke it into roughly four parts:
Hour 1 – Relearn everything I had forgotten about PHP.
Hour 2 – Focus on getting and parsing the XML.
Hour 3 – Focus on the DB and conversion code.
Hour 4 – Refine the class, test, and fiddle with it.
Things didn’t break down as neatly as I thought they might, but by setting these checkpoints for myself, I could easily see when I had fallen down the proverbial rabbit hole on a problem and needed to move on.
An alternate, arguably better approach, would have been to get to a “Walking Skeleton” first — that is, to get to a solution that did some of everything quickly. Once you have a walking skeleton, you can build out and enhance it from there. Build the simplest, most inelegant solution first. If you run out of time, you’ve at least solved the problem. If you haven’t run out of time, then you can always look for ways to make it better.
Safari Books Online has the content you need
Take a look at these books that cover PHP and some approaches for creating walking skeletons:
|PHP 5 Recipes: A Problem-Solution Approach will be a useful and welcome companion throughout your PHP journey, keeping you on the cutting edge of PHP development, ahead of the competition, and giving you all the answers you need, when you need them.|
|PHP 5 Social Networking is a fast-paced guide to creating a flexible Social Networking website using PHP with a custom, light weight MVC framework.|
|PHP Master: Write Cutting-edge Code is tailor-made for the PHP developer who’s serious about taking their server-side applications to the next level and who wants to really keep ahead of the game by adhering to best practice, employing the most effective object-oriented programming techniques, wrapping projects in layers of security and ensuring their code is doing its job perfectly.|
|Programming PHP, 2nd Edition is the authoritative guide to PHP 5 and is filled with the unique knowledge of the creator of PHP (Rasmus Lerdorf) and other PHP experts.|
About the Author
|Duane O’Brien is a tired computer scientist. He has written a number of articles on developing web applications and various PHP frameworks. To learn more about Duane, check out his blog or read his tweets.|