Looking back on how I handled the test (see You Have Passed The Test: A PHP Coding Test, there are a few things I would have done differently. I’m going to focus on three — one practical, one learned lesson and one hilarious oops.
Practical – Read Ahead. I really overestimated how quickly I would get back up to speed with PHP. I expected to walk into the test without cracking a book and ace it. Wrongo. Next time, I would spend a little time in advance refreshing my memory on how things work in the language.
Learned Lesson — Write Those Tests. I almost called the code done and shipped it off, but decided to write a few tests to make sure I had good coverage. As a result I found a really dumb mistake. If I had written the tests as I went along, I would have caught it sooner.
Hilarious Oops — I was asked to submit the code to a public code repository as part of the test. After I had done so, I realized I left my DB credentials hardcoded in the class:
private $dbstr = 'mysql:host=serve.[REDACTED
private $dbun = '[REDACTED NOW]';
private $dbpw = '[REDACTED NOW]';
This was not exactly my brightest moment, but at least I realized it before having it pointed out to me. Thankfully, they were only test credentials.
I will be much better prepared the next time I have a timed test to conquer.
Safari Books Online has the content you need
The following resources in Safari Books Online will help you develop PHP apps, along with database interaction:
|PHP and MySQL: The Missing Manual takes you to the next level—creating dynamic, database-driven websites with PHP and MySQL. Learn how to build a database, manage your content, and interact with users through queries and web forms.|
|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.|
|Pro PHP Application Performance: Tuning PHP Web Projects for Maximum Performance contains tips, tricks, and techniques to make new and existing PHP applications much faster and less resource-hungry.|
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.|