Let’s say you want to launch a service. For coders, by coders.

English: Coder decoder group AN/MSQ-18 (ao in ...

Coder decoder group AN/MSQ-18 (Photo credit: Wikipedia)

Let’s also say you want only coders. Nobody else should be able to get in.

Leaving aside any “Haha, launching is _hard_! Allow everyone and tweak incentives so only coders want to join.” While essentially true, coders act differently around coders than they do around people, and an exclusive environment could be awesome.

How do you make a lock only coders can get through?

The low-tech solution is a manual approval process. When a person signs up, you look at their profile and google around a little bit. Try to find them on Github, see if they have any technical blogs, have ever released a piece of software etc.

Congratulations! You’ve just made yourself a bunch of work and excluded the 80% of the coders who don’t have a strong web presence or aren’t even interested in that sort of thing.

No, we need an automated test … something only coders can solve, but trumps everyone else.

Something that:

  • Every coder can solve.
  • Nobody who isn’t a coder can solve.
  • Is simple to test.
  • Takes less than 15 seconds to solve.

But what’s the common knowledge all coders share?

The for-loop!

Everyone can write a for loop right!? How do you test a for loop? Wikia:code lists 18 different  for loops. Which means there are more … plus there’s languages like Haskell which prefer recursio. I hear there’s also a lot of coders out there using CSS and HTML that don’t even have a concept for looping.

Yes, those people are coders too. They write thousands of lines of code. Maybe not programmers – definitely coders.

Okay that was a stupid idea … but every coder has got a favourite text editor don’t they? If you like a text editor you are definitely a coder. Then again, there are thousands of text editors out there, we can’t test this one either.

Oh hey! Everyone can write a regular expression can’t they? At least a very basic one!

Regular expressions are great, they aren’t language specific since they are a language and pretty much everyone has written a basic regular expression once or twice in some of their projects.

Well, except for the guys writing hardcore C all their lives who are coding rocket launch procedures for SpaceX. Doubt they ever needed a regex. Maybe for grep or sed?

A plausible solution

A friend of mine recently (yesterday) had this problem and it seems the final solution is good enough for now.

To sign up you need to answer one of two questions:

  1. Write a very simple regex. (match New York and New Jersey, but not Newark)
  2. Or find a hidden element on the webpage and click it.

I was too lazy to do either, so I went into the page source and used node.js to run the snippet of javascript that constructs the redirect url. Also proving that I am a coder. I think …

But what about all those coders who are just starting out? Who haven’t encountered any of this stuff before? It took me years to first get into regexes … And what of those who’ve never come into contact with either regexes or front-end web development … someone coding up controllers for your car’s engine, say?

Question is, how would you make a CAPTCHA to distinguish coders from non-coders?

Enhanced by Zemanta

Learned something new? 💌

Join 8,400+ people becoming better Frontend Engineers!

Here's the deal: leave your email and I'll send you an Interactive ES6 Cheatsheet 📖 right away.  After that you'll get an email once a week with my writings about React, JavaScript,  and life as an engineer.

You should follow me on twitter, here.