Sherif's Tech Blog

Just another guy on the Internet with a keyboard…

5 Things to Look for When Hiring a PHP Developer

Hiring new talent, whether you’re looking for a freelancer to code the next facebook or a full time employ to support your latest web app for a long-scale term, requires a certain sense of understanding from an engineering perspective. Engineers like solving complex problems. Most managers don’t necessarily see a problem as a challenge worth solving, but more as an inconvenience that needs to be overcome. Recruiters tend to feel the same way so when they look at resumes objectively they are only looking for the solution and not the problem.

It would be a good idea to have your engineers or more tech-savvy employees review certain criteria about a prospective programmer or web developer. Since today many companies are looking for programmers or web developers with PHP experience I thought it apt to discuss some key criteria to look for in a prospective new employee that will work on your code.

  1. Always ask for references
    • This is a pretty common requirement when hiring anyone for a job. The idea is to find references that are current and put the most weight on them, because a reference from a project they worked on 5 or 10 years ago isn’t likely to be valuable in your assessment of the programmer.
  2. Look for qualifications in certification – not the other way around
    • Some times this can be confusing, because we tend to overlook that some certifications aren’t impartial or a significance of qualification, necessarily. A Zend Certified PHP programmer is likely to have proven themselves on paper, but a CS major at a reputable University is likely to have been put through the test of time and ability. A University is likely to offer up more hands-on experience for a graduate, especially recent graduates, than a certification. Don’t put too much emphasis on these sketchy online certifications like on elance.com, for example. Most importantly, look for programmers that can tell a story and not just produce a degree and a manifesto of documents that certify their abilities or skills. A programmer that can portray their reasoning behind their choice of certification (in story-form) is far more likely to be visionary than opportunistic.
  3. Make sure they can understand a spec
    • Not every PHP programmer is a CS graduate or a Zend Certified professional, because PHP is quite popular and easy to learn. However, many hobbiests have learned poor coding practices and very few will attempt to distinguish themselves as professionals. Make sure the programmer you are hiring understand how to read a spec (or specification sheet) or can at least put one together for you without hand-holding. This will determine just how professional they are. There is going to be a disconnect between programmers that have studied things like spec sheets, user stories, and product design modelling and programmers that have actually dealt with them in real life scenarios.
  4. Ask to see production-grade code that they’ve recently written
    • One of the biggest gaps between a PHP programmer that has been writing PHP for years and one that has recently started (especially if its their first programming language) is that older programmers don’t always tend to stay current on changes. If you’ve ever had to deal with legacy code before you’ll understand that there is a benefit to having a lot of experience with the programming language that code was written in, but not all programmers with 10 or 15+ years of experience on their resume are necessarily well-versed or experienced. Many programmers refuse to learn new things and adapt to changes, which ultimately leads to the same thing as a programmer with no experience. So ask to see code that is production-worthy that they have written in the past 6-12 months. This may change your mind for better or worse before you hire them, but best that this decision be made in the early stages of the project.
  5. Put them to the test
    • One of the worlds largest employers today is Google and they like to put many of their job applicants “to the test” during the interview process. This entails asking a difficult question that will put them on the spot in order to see how they can adapt to real-life scenarios – if thrown a curve ball. One of the things you can do is ask the programmer to write you a simple function or code snippet that does something useful. It has to be simple enough that the idea is common-knowledge, but also entails a slight mathematical challenge. This way you know if the programmer you are hiring is in fact a good problem solver – since programming really is all about solving complex math problems.
    • To demonstrate, I’ve included some real-life scenarios below
  6. One of the most common tasks a programmer will have to know in order to produce well structured and modular code is their ability to implement translation mechanisms between data models. For example, say you have an ordered list of items stored for various users and you’d like to display those items in a numbered list, but you want to use appropriate English suffixes for each number. You can ask the programmer to demonstrate their ability to effectively and efficiently solve this problem by writing a function in 10 lines of code or less that can return the proper english suffix for any natural number. Since PHP is a loosely typed language the programmer must account for the input being of either string or integer type. The example below gives you an idea of how such a function may be written using a basic mathematical approach. It’s simple and returns a boolean value upon failure so that it’s easy to test.

    	/**
    	* @function str function suffix([int]) - Returns the appropriate English suffix of any positive integer
    	* @param $var - (int) any loosely typed natural number (where 0 is accepted as a natural number)
    	* @return returns suffix for positive integer as string on success, otherwise returns boolean false on failure.
    	*/
    	function suffix($var) {
    		if (!is_int($var) && !ctype_digit($var) || $var < 0) return false;
    		$suffixes = array('th','st','nd','rd');
    		if ($var % 100 > 9 && $var % 100 < 14) $var += 4; // Accounts for 10th - 13th as they are an exception to the rule.
    		$mod = $var % 10; // Otherwise the rule is always that $var modulus 10 should provide the appropriate suffix
    		if ($mod > 3) $mod = 0;
    		$suffix = $suffixes[$mod];
    		return $suffix;
    	}
    

    Here’s a test case for the function.

    	foreach (range(0,25) as $num) echo $num , suffix($num) . PHP_EOL;
    /*
    # OUTPUT
    0th
    1st
    2nd
    3rd
    4th
    5th
    6th
    7th
    8th
    9th
    10th
    11th
    12th
    13th
    14th
    15th
    16th
    17th
    18th
    19th
    20th
    21st
    22nd
    23rd
    24th
    25th
    */
    
    var_dump(suffix('foobar')); // OUTPUT: bool(false)
    var_dump(suffix(-1)); // OUTPUT: bool(false)
    var_dump(suffix('0.0')) // OUTPUT: bool(false)
    

    Another test may be to ask the programmer to write a recursive  function that can return X amount of numbers in the Fibonacci sequence as a comma delimited string. Again, it’s a good idea to try making the task a challenge – such as by setting a limit on the number of lines of code they can use to write the function or a time limit. I’ve demonstrated this below in a recursive function of less than 10 LOC.

    	/**
    	* @function str function Fibonacci([int],[array]) - Returns X amount of numbers in the Fibonacci Sequence
    	* @param $x - (int) [default value 1]
    	* @param $start - (array) [default value 1]
    	* @return Returns X amount of numbers in the Fibonacci Sequence as a comma delimited string.
    	*/
    	function Fibonacci($x = 1, $start = 1) {
    		if (!is_array($start)) $start = (array) $start;
    		if (count($start) < $x) {
    			$start[] = end($start) + prev($start);
    			return Fibonacci($x, $start);
    		}
    		$sequence = implode(',',$start);
    		return $sequence;
    	}
    
    	echo Fibonacci(15); // The first 15 numbers in the Fibonacci Sequence
    /*
    # OUTPUT
    1,1,2,3,5,8,13,21,34,55,89,144,233,377,610
    */
    

    As you can see there are many real world examples that can be both useful and practical for a good PHP programmer to know and their ability to write this code on the fly should give you an idea of their level of knowledge and skill with the programming language, but moreover with programming in general.

Category: PHP

Your email address will not be published. Required fields are marked *

*