Wednesday, March 23, 2022

Coding Tests vs. Accomplishments

This week I was asked to take a coding test for a potential position as a Director of Software Development. I looked at the company providing the test and even ran through a number of sample questions. Ultimately I decided that I really don't want to work for a company that asks everyone to take such tests. I understand that organizations hiring software engineers need to gather some level of proficiency but think coding tests are the wrong way to go about it.

If you look at how world-class software organizations like Google gauge proficiency, they do it with white-boarding sessions. You are presented a problem and write code on a whiteboard, explaining your thought process as you jot things down. This allows the job candidate to ask very important questions. It also allows the interviewers to gain tremendous insight into the candidate's thought process.

One of the questions I was presented on the sample coding test was FizzBuzz. The program asks for an upper integer and then prints the whole numbers from 1 to the upper integer. If the number printed is evenly divisible by 3, then the word "Fizz" is also printed next to the number. If the number is evenly divisible by 5, then "Buzz" is printed next to the number. Finally, if the number is evenly divisible by 3 and 5, the word "FizzBuzz" is printed. There are some variations but hopefully you get the idea.

This is a great programming problem to solve as it does not require a lot of code but does expose some fundamental programming ideas. The first is if you understand the mod function, which returns a division remainder and is usually denoted by the percent (%) symbol. The equation "5 % 3" would return 2 as 5 divided by 3 has a remainder of 2. When you find a number with a remainder of 0 when divided by 5 and/or 3, you can print the appropriate word.

Next you have to know how to do loops in your language of choice. The testing software gave me something like 27 different computer programming languages to choose from. My preference would have been to use a FOR loop and I think most developers would start with that as well. For my sample test I used Python and made sure to set the range from 1 to n+1, where n represents the upper integer limit. Why n+1? Well the FOR loop goes up to but doesn't include the upper number. If you put in the upper limit of 15 and run the FOR loop, it will only go to 14 and so you need to add 1 to the upper limit so it goes high enough.

Both of those concepts being tested are fairly simple and an hour of coding instruction should be all that is needed to get that part of the test correct. Now is where it gets complicated. In my sample coding test, I was only going to be given 30 minutes to complete 5 such examples. My first thought would be to brute-force it an get something running. That would look like a nested IF-THEN-ELSE statement where you test the 3 and 5 first, followed by the 3, then followed by the 5. Then I would move onto the next question.

The advantage of white-boarding this problem is that the candidate can ask some important questions that show even greater insight in his or her experience. For instance, "Is performance important?" IF-THEN and IF-THEN-ELSE statements are very expensive in today's modern processors. You can write the code to use 2 instead of 3, which can be significant when your upper limit is a really large number. The downside is you sacrifice code readability which makes it more difficult for someone new to come in and maintain your code. Unfortunately in an automated test, the candidate is forced to make a choice without any feedback from the testing software.

As I mentioned, I opted not to take the coding exam. It is not that I felt I would do poorly. Instead I feel like having my code running on over 100 Million PlayStation 3's, over 100 Million PlayStation 4's, and over 17 Million PlayStation 5's should give some indication that I know how to write code. I think it is much better than taking a test that favors trivial details and syntax. Perhaps you may disagree.

No comments:

Post a Comment