Interviewing a front-end developer
blog.sourcing.io
blog.sourcing.io
> it's important that anyone you hire has a comprehensive knowledge of apply and call
To other Javascript developers: is this really true? I do use call every now and then, but it's pretty rare. Maybe that kind of stuff is more important if you're trying to functionally isolate components with richer interfaces between them? I tend to keep a pretty polluted namespace, so maybe that's where I'm going wrong.
That said, I have a "I could learn that but I have stuff to ship" mindset about Javascript. That has its ups and downs. Maybe I should work on that a bit more.
You can do a lot of things with higher-order functions just by making closures, but `apply` and `call` will give you flexibility and power there's no other way to get. For one thing, they're your ticket to manipulating `this`.
The worst part is keeping them straight. My mnemonic is that `call` is just a function call, so arguments go in as normal. `apply` is the other one, so arguments go in as an array. (Maybe "A" for array, or something.)
Even in the "front end development" subfield of web development, there are divisions. Do you want someone to produce lots of modular libraries that are reusable throughout your company/application suite, or perhaps to build a UI framework? Then knowledge of these parts of JavaScript will be very useful. Do you want someone to build a rich internet application in Meteor? Then knowledge of positioning, layouts, templates, UI effects and how to tie them into the Meteor framework is much more valuable.
Where I work we do a lot of 2D animations, so it's great if the people who work here know all about CSS transitions, requestAnimationFrame, and so on.
amen bro...amen.
Thankfully he does move on to problem solving later on, which strikes me as far more useful - an open-ended question will reveal lots about the candidate.
As a parallel, when I interview developers for a Java position, I ask them to list some methods in java.lang.Object off the top of their head. A few have objected to this, calling the question arcane, something they could look up in 5 mins, etc, which are all true, but the thing is if you've written enough Java, you would definitely have run into at least equals(), hashCode(), and toString(), and likely wait() and notify() as well. This one simple question has been a surprisingly good proxy to the developer's general level of proficiency and experience with Java.
At the same time, this approach assumes your candidate is currently working on the language you use in the interview. I think it's not rare to have people working on different stacks depending on the projects, and they can be expert in front-end dev for instance, but have been diving into BE APIs for weeks when you interview them. Some can be coding in any language they know in seconds at will, others will need a lot more time to switch context.
It's a valid approach I think, but not without it's pitfalls.
This question seems to be targeted at weeding out people who never had to do with Java. Have you tried asking for code samples? We always do, if someone has nothing relevant to show, we give them a simple task to solve at their leisure. Has been quite useful both for weeding out non-programmers as well as for getting a rough idea of someone's skill level.
I've been writing code for web sites since the web was a new thing, and I don't remember ever writing code that used the arguments pseudo-array in JavaScript. I'm sure I've probably used plenty of tools that relied on arguments for their implementations, but not reinventing wheels and all that.
I tend to think these kinds of questions are almost as flawed as brain teasers if you're trying to hire someone who's actually any good at programming. A long time ago, when I first started programming professionally and only used one main language, I was quite the language lawyer and new all kinds of arcane tricks. Today, I often look up how to find the length of a string/array/list/vector because I'm not sure whether it's x.length, x.size(), len(x), or any of another half-dozen variations that are used in different programming languages I know. I usually do get it right, but experience tells me it's faster to check anyway than to wait for a Lint tool to run or a compilation to fail if not.
Knowing the concepts in each language is important, so you know what to look up. If a JS developer doesn't understand what "this" means or how prototypes work, and by extension they don't have some awareness of why you'd need to use "call" or "apply", they might struggle. But we have IDEs and search engines and automatic style checking tools and all that good stuff today, and there are more important things to remember than details I really can and do look up in seconds when I need them from time to time.
The way I see it, asking an obviously experienced developer how many little details of a specific language they can remember is rather like asking them to take a typing speed test. In theory, the result might tell you something about how fast they can get work done, but in practice you're unlikely to learn anything very useful because the result won't be strongly correlated with writing good code that gets the job done well.
If that works out, I really don't care if they don't know or forgot some detail. As long as their level of knowledge roughly matches their claimed experience, that is.
People tend to be stressed in interviews, especially when faced with unfamiliar (if simple) problems, so I prefer to look through code they wrote on their own to get an idea of their skill, then verify in the interview that they understand their own code.
I suppose big tech companies don't have time for that.
These are things that I understand when pointed out to me, but off the top of my head, with no google, I'd have to think for a second. They are things that I implement most every day. For instance, the position fixed/absolute thing... I work with things like that pretty much every day, but usually it takes me 10 minutes of fiddling, or 50 seconds of googling if I've had to do it before, unless I get lucky and it just reveals itself as obvious.
Oh well, I suppose that's why I live in the sticks and freelance instead of working for Twitter or Stripe :D I mean, this stuff seems esoteric to me, even though I work with it every day... it's neat to know that there are a lot of folks who have this stuff wired well enough to do it with no reference material.
"At this point, if the candidate is doing really well, I'll ask them to implement currying arguments."
Why? If they've already proven enough tech knowledge to do the job, why continue to ask more questions that might/might not use to server your hiring decision? (It sounds like you'd continue a different direction if they couldn't implement with currying).
EDIT: I'd probably not be really hiring a short-term consultant like this either, though, now that I think about it.
Spacify: "Split on empty, join with spaces." Done.
String.spacify: "Attach that function to String.prototype and call the split/join on `this`." Done.
And so on. It does serve as a way to test if they can actually write code, but my guess is that there's not that big a difference between talking through the code you'd write and actually writing it.
I'd be very comfortable with going through this verbally, but I'd be horrified to get an interview like this where they expect me to type code and talk to them while doing it. I'd honestly much rather have a whiteboard than a laptop—at least I'm used to writing with a pen while someone judges me. The laptop would just take away that comfort and make sure my brain turns off.
Am I alone in that?
I wouldn't say that's any worse, especially in this scenario. But they should get it just as quickly.
Edit: trim the string. :)
Edit: Not tested myself. I had a suspicion about it and "confirmed" it via an older post that is perhaps outdated now. Updated this comment to sound less authoritative ("I would think").
On my machine, I was surprised to see that the for loop is the fastest (Chrome + Crunchbang).
I'd guess that this is probably because looping structures are heavily optimized in modern JS engines.
Basic things like caching DOM lookups are always good, but not so much the little things.
Edit: Apparently the loop is faster.[0] :)
Fixed: http://jsperf.com/spacify/4
Note not everyone is a Github user. Some brilliant Python projects that I use are still hosting on Bitbucket and/or Google code (and of course some on sourcegeforge) so we should be careful with that. I will assume OP is making an alias rather than excluding other service providers, though it is important to keep that in mind (in particular, if you are implementing a form with a field "github profile", please provide either a drop-down menu or a general field with multiple textboxes)
Combining the rest, I can consider this almost a Javascript tutorial for experienced programmer. Bravo on the neat, concise writing.
Most programming interviews I've had over the years have asked for code samples. Github is just the first thing people think of, but companies will always in my experience ask for you to email them some code samples if you don't have a Github account.
Although there's an argument to be made that owning a many-starred project or contributing to a big OS project is also an indicator :)
A correct solution would be:
function spacify(input) { return input.replace(/([^ ])/g, '$1 '); }
Additionally, you could also use,
function spacify(str) {
return str.split('').join(' ').replace(' ','');
}
to remove the additional space.var spacify = function (s) { return s.match(/\w/g).join(' ') };
What about the front end web developers who can't seem to create original designs, they fight the design and artwork part as much as a layout designer fights with javascript.
This isn't so cut and dry. Plus with the javascript libraries you can get quite far without writing your own js.
BTW, for the record, I've never actually known a coffeescript dev who didn't know JavaScript, too, though.
And any interview technique that involves the candidate actually working on production code it criticised for being exploitative and effectively slavery.
"How they choose to center content inside the overlay is also revealing. Some of the candidates might choose to use CSS and absolute positioning, which is possible if the content is a fixed width and height. Otherwise may choose to use JavaScript for positioning."
First of all, JavaScript... just... no. Stop.
Secondly, hey, you don't need a fixed width or height, you just use:
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
I would really challenge the writer and anyone else interviewing for any position to consider that maybe they don't know everything.In my experience, interviewing is a costly process and being too particular can simply mean you don't find the right candidate. Companies which have a brand reputation that attracts talent can get away with this, but smaller more unknown companies sadly can't.
I just don't know too many people with a rich design / artwork talent as well as heavy javascript programmer mind. Maybe I just don't know enough people.
I suppose when you have a massive web app, you call your people front end enginers because there are twenty of them and they don't have to create an entire UI, they have been able to focus on specific issues and manipulating the DOM.
"This is how I would do it, but I would strongly recommend against doing this in a serious project of course because [reasons]"
I'm trying to figure out how sourcing.io gets it's developers. As a techie, there was no obvious way for me to put up a profile or anything. There's an explanation that it uses the companies team's social networks, so maybe the employees have to share all their specific account profiles with the company (see below on more on this).
How does this differ from something like TalentBin that scrapes together peoples various social profiles and aggregates them into a single "report/summary"?
Also, do employees really give up their social graph to their employer? I keep mine pretty tightly locked away. I've built it, maintained it. I might or might not be with the company in six months (They might lay me off. I might get a better job.) Occasionally, I've dug into mine to find someone when one of those emails is sent around mentioning a hiring bonus for a certain position. Or when I need to hire someone directly. But I still don't openly share mine.
I don't know anything, but I know where everything is.
And I know how to search for it.
Cue list of the most obscure js tricks and gotchas the interviewer knows.
Nice one.
- segway: a personal human transporter - segueway: a transition from one topic to another