
Ask HN: What did I do so wrong in this coding interview - notaio
A few days ago I applied for a senior Full stack developer in a mid size company. HR interview went great, I had a quick code test on paper that went OK as well, and a quite long technical interview that went great.<p>The day after the HR sent me an coding test that involved creating a simple memory game in JS with a tiny back end to store high scores. So I banged out this code as fast as possible, while trying to emphasis on maintainability and testability. I sent back the result as github repo:<p>https:&#x2F;&#x2F;github.com&#x2F;m4nuC&#x2F;memGame<p>Didn&#x27;t hear back for a few days but eventually arrived a mail stating that &quot;this code felt far short from a senior developer standards&quot; and obviously didn&#x27;t get the job. I know I cut a few corners, no unit testing, a couple of minor bug and obviously not a production ready app but I thought that would be enough to show that I knew how to build a web app without spending 2 days on it.<p>I couldn&#x27;t manage to get any more info from them on what they meant by &quot;falling far short of senior developer standards&quot; So what in your opinion went so wrong about the code?
======
honestfeedback
Disclaimer: I'm posting this under a new dummy account because I don't want
this to be seen as feedback from my company. We didn't interview you, but I'm
a senior manager and I want to help w/o implicitly dragging my team into it.
(The key word is also "help"; I'm not trying to belittle you, just give my
honest assessment of this project, quick as it was to create.)

tl;dr: I agree with the assessment that this doesn't look like the kind of
code I'd expect of a senior developer.

The biggest issue from my POV is that you pull in a _lot_ of heavy-weight
frameworks and implicit dependencies for what could be a really simple app. To
actually examine the application logic of your submission, I have to flip
through dozens of auto-generated PHP files, Javascript module wrappers, and
empty directories.

Sometimes, calling yourself a "senior" engineer means doing less, not more.
The layers of indirection, framework code, and build toolchain applied here
make it harder to follow what your code is actually doing. Coupled with a lack
of unit tests, it seems impossible to verify in any short amount of time that
it actually works as promised.

Even with all that MVC goodness, the separation of concerns on the client
isn't great. There's a mix of display logic and app state visible in lots of
places. (IMHO game.js is the worst offender here, as the entire game state and
DOM rendering are mixed pretty indiscriminately.)

Finally, asking a reviewer to run a bunch of code from an untrusted repo via
'sudo' is pretty much a giant red flag for me. A simple JS+PHP webapp
shouldn't require me to do _anything_ as root on my machine. (I'm also not
familiar with Composer, but my brief skimming of the homepage, it seems like
the whole point is to not require system-wide installation of dependencies, so
the sudo bit is especially weird.)

It looks functional, and if you were interviewing specifically at a shop that
used these frameworks and tools, it might not be so bad. If asked to review
this without that context, though, I would give similar feedback to what you
received.

~~~
notaio
So using abstraction is not something a senior does ? It seems to me like the
contrary. The more experience I have the more I like to abstract things
instead of making them from scratch. But even so it seems a bit heavy of
judgement to disqualify me with such strong word over this choice.

~~~
lambda
There's nothing wrong with abstraction. But you should use the right
abstraction for the job. You don't need a huge PHP web framework, tons of
dependencies, an entire package manager, sudo access, and so on to have a
simple memory game with a high score backend.

Remember, when you're looking for a job, you're not looking to create some
build and forget application. You're going to be working as part of a team.
Other people need to be able to maintain your code. For a problem that should
be able to fit onto a single page, you don't want to have to browse through a
7 megabyte git repo with nearly 10,000 files in it.

An analogy might be if someone's trying to hire you as a carpenter. They ask
you to build a cabinet to demonstrate your skill. You go and find a prefab
house frame, an entire prefab plumbing system, and so on, and build the
skeleton of a house. Within that, you build a reasonably functional cabinet,
though it's kind of hard to judge the cabinet among the entire rest of the
incomplete house. How do you think that's going to compare to someone who just
went and build a cabinet, and spent the time getting it built really nicely,
paid attention to the detail work, made sure the door hung true and opened and
closed without squeaks?

Here are a few things that I note at a cursory glance; and notice that I
haven't even gotten to the logic of the code, because all of these things are
red flags that come up before I am even able to read it:

1\. Checking in dependencies to Git. That's not how it you do it; dependencies
should be handled by a separate package manager, in which you depend on the
appropriate versions of packages. You should never check anything other than
your own source code into Git.

2\. Your commit messages. Commit messages in Git should follow the format of
an email describing a patch. The first line should summarize what the commit
does; the rest of the commit should contain a description of why you are doing
it. See the following for an explanation of what good commit messages should
look like. First from the Git source itself:

[http://git.kernel.org/cgit/git/git.git/tree/Documentation/Su...](http://git.kernel.org/cgit/git/git.git/tree/Documentation/SubmittingPatches?id=HEAD#n87)

And then a much more in depth guide:

[https://wiki.openstack.org/wiki/GitCommitMessages#Informatio...](https://wiki.openstack.org/wiki/GitCommitMessages#Information_in_commit_messages)

3\. Inappropriate use of frameworks. You included a lot of dependencies that
are unnecessary for the problem at hand. Dependencies have real costs; every
extra dependency is something that could break, could have a security bug,
could be a pain to upgrade in the future. Now, that doesn't mean to never add
dependencies; but do so with a certain amount of care.

4\. Simple spelling and style errors. Tabs vs. spaces. Inconsistent spacing:
"var _createCell = function( color, id ) {" and "if (
el.className.indexOf('turned-over') > -1)" (note: decide whether there are
spaces between parens and their contents, and stick to that choice). You
spelled "RESTful" as "restFul". Things like this are seen by developers as
canaries in the coal mine; if you are sloppy about the very basic stuff like
tabs vs. spaces, are you really going to be mindful of other important things?
Consistency of style is important for keeping code readable, if you can't even
keep consistent in a simple code interview problem, why should anyone think
that you'll be able to do it on a day to day basis when under real deadline
pressure?

Here's my exercise for you. If you want to get better, and be able to pass
future job interviews, condense this down into as small a codebase as you can,
with as few dependencies as possible. I think that you should be able to do
this in less than 100 lines of your own code, and only the most basic of
dependencies like jQuery and some simple microframework on the server side.

Give that a shot, and then take a look at both for comparison. Which would you
rather maintain? Which will be easier to make changes to? Which is easier to
code review?

~~~
Sgoettschkes
Regarding 1. As far as I know, npm says in it's docs you should add
node_modules to your scm because there is no way to install the exact same
version through npm on different machines. On the other hand, composer has a
.lock file which specifies commit hashes it installed on the dev machine, so a
composer install installs the exact same commit on every machine.

@OP: You didn't commit the composer.lock. That means that your code might run
locally but breaks on another machine because there might be a new version of
laravel 4.2

~~~
notduncansmith
Can you provide a link to that? That's not how npm works _at all_. You specify
dependencies as a dictionary: keys are package names, and values are versions.
They support commit hashes, but do not require them. See:
[https://www.npmjs.org/doc/package.json.html#dependencies](https://www.npmjs.org/doc/package.json.html#dependencies)

~~~
notaio
[https://www.npmjs.org/doc/faq.html#Should-I-check-my-
node_mo...](https://www.npmjs.org/doc/faq.html#Should-I-check-my-node_modules-
folder-into-git)

------
krapp
It may have been a red flag if they asked you for a simple memory game with a
tiny back end and you gave them a Laravel install with a Node.js dependency
that you admittedly "cut corners" on and left "a couple of minor bugs" in.

I don't know exactly what they were expecting from you if anything in terms of
efficiency or scale but there is a chance this looks like a massive, bloated
chunk of unnecessary dependencies and code, which suggests you might not know
how to manage a project efficiently. Just requiring Node.js to do javascript
development in a PHP environment, itself, is kind of smelly to me.

I'm not saying it's fair, just that it's the impression i'm left with.

~~~
antjanus
I think this is the root of it. Looking at the repo, you shouldn't have to go
through 20 steps to just install the app. I believe Node is just for compiling
and gulp stuff, so that's fine for front-end.

I can't say I'd pass the interview but my idea of how this would work would
be:

\- simple instal.php script that would use PHP's PDO to create a DB and a
table with necessary info \- simple api.php script that would take API calls
in order to save scores and that's it. You could easily do this in Node as
well thus keeping everything javascript \- javascript front-end with no PHP
involved there. An actual index.html file with everything in it, referencing
one (non-minimized) JS file and whatever images and CSS.

This is hindsight 20/20 obviously especially since we all want to show
EVERYTHING we know during an interview and I'm guilty of doing things like
this as well. I'm guilty of doing the opposite too, keeping things too
"prototype-y" and messy.

------
deepakkapoor
I have not looked at your code but I can say with some experience that it has
nothing to do with how you wrote it. There is no way for me to confirm but
most likely this is what happens when you turn in a coding test. Someone who
is perhaps at a debatable senior level looks at your code and often (I have
seen this happening at places where I have worked) gives it to someone else
for their feedback. The person your code gets handed over to is often not the
person who will make hiring decision. He/she will look at your code and try to
discover their own style in your code. If your code does not come close to the
way they would have written it then it is bad code.

A lot of things come into play here. Often it is unclear expections. I have
done coding tests where the requirement was to pull data from a dataset and
cache it in memory. This requirement can be met in many ways. I chose the
simplest one but the feedback I got was similar to what you got. It totally
depends on where the reader of your code is in the evolutionary stage
[https://medium.com/@webseanhickey/the-evolution-of-a-
softwar...](https://medium.com/@webseanhickey/the-evolution-of-a-software-
engineer-db854689243)

Reading code is harder than writing.

------
wfunction
1\. When your comments are longer than your code, either you're putting in too
many comments, or your code is too hard to read. (The former seems to be the
case here.)

2\. Why is the spacing convention all over the place in some files?
[https://github.com/m4nuC/memGame/blob/master/app/controllers...](https://github.com/m4nuC/memGame/blob/master/app/controllers/ScoresController.php#L10)
[https://github.com/m4nuC/memGame/blob/master/app/database/mi...](https://github.com/m4nuC/memGame/blob/master/app/database/migrations/2014_07_03_144443_add_high_score_table.php#L13)

3\. Why are there so many folders that only have .gitignore's inside them? In
fact, why are there so many folders at all?

4\. In my glances at some of your files I didn't find a single function with a
lot of "meat" inside it, so it doesn't show much about your ability to write
something that actually does something.

~~~
jsmthrowaway
> 1\. When your comments are longer than your code, either you're putting in
> too many comments, or your code is too hard to read. (The former seems to be
> the case here.)

I hate this meme. There's nothing wrong with too much commentary. You are not
on a comment budget. Please stop spreading this around, like the "rewriting is
always a bad idea" meme that's embedded itself in young developers like dogma
even though Spolsky's point is up for debate. Atwood is wrong about this one,
too, and I hate that Spolsky and Atwood have so many "rules" of programming
that people pass around.

I've seen this meme borne out via comment ratio rules in style guides. That's
ridiculous. We all work in editors that make comments a different color. I use
light gray. My eyes can look right past them, but if I want the paragraph or
two explaining the algorithm I'm looking at, it's there. The underlying flaw
in Atwood's claim is that it is possible to write code in a way that is self-
evident to every reader. You do not know every reader.

Well-written commentary -- bordering on literate programming -- makes
development much better. Even better if the code is the documentation. I don't
know where this notion that we must conserve comments like water came from,
but I'd be happy if it just stopped.

Note here that I'm addressing _quantity_ , not _quality._ I feel that is
important to clarify.

~~~
wfunction
I think you might've misunderstood what I'm saying. It's perfectly fine to
have complex functions commented as much as necessary; heck, it's totally fine
to have your comments be 100x as long your function when the function is
_actually_ hard to understand.

What's _not_ OK is commenting _ALL_ of your code, especially not to such an
extent where the comments are actually longer than the code size _on average_.
(!) Some stuff just _has_ to be self-explanatory, period -- that's a fact, not
a meme. If you can't make the simplest code self-explanatory, then I'm sorry
but you simply _can 't_ code as well as someone who can. And if you're going
to comment _everything_ , then you're also wasting valuable time that someone
who didn't need to do so would've spent writing actual code and getting more
done.

~~~
jsmthrowaway
I understand what you are saying perfectly, but you typed "you are putting in
too many comments" as a possibility, full stop. All of that context you just
painted for me is not in your comment. That's how "never rewrite because
rewriting is bad because reasons" gets started.

And absolutely I think commenting all your code is okay. I honestly wish
literate programming had caught on.

~~~
wfunction
Well, quantity can be measured in different ways. I didn't say "your
(individual) comments are too long"; I said "you have _too many_ comments"
(aka the total length of your comments is comparable to the _total_ length of
your code... i.e., your source files are on average more comments than code).
Too _many_ comments (even short ones) is generally bad; they make the code
_harder_ to read, not easier. A few long comments are generally good. I feel
like you were addressing a different point than I was making.

~~~
jsmthrowaway
> Too many comments (even short ones) is generally bad;

That's exactly what I'm refuting, so I'm not sure why you keep talking past
me. I am speaking to the crazy notion that there is a par for the comment golf
course, and we all have to be Goldilocks as we write software. I don't know
where that started, but I'd love it if people stopped judging software based
upon the non-executable portions.

A line before every line? Maybe. Are they comments of quality? I've put a
comment on every line of assembly before as a postfix. There is no hard and
fast rule on this, and I wish people would stop trying to make one.

Again, literate programming. I feel like you're missing how serious I am about
this by overlooking my repeated love for it.

~~~
wfunction
Well in that case, there's nothing crazy about it. If I can hire someone whose
code is reasonably self-explanatory vs. someone who puts comments all over
their code (whether or not it's self-explanatory), I'm certainly _not_ going
to choose the second one over the first one, not sure about you.

~~~
jsmthrowaway
You just said if I took the same self-explanatory code and added comments to
it that you deem unnecessary you'd no-hire me as a result. And yes, that is
absolutely crazy, and has been my point throughout this entire thread.

Please do me the respect of researching literate programming before attempting
to extend this thread, because I can tell you're unfamiliar, just based on how
many ways you're trying to slice and dice a chink in my opinion on this.

~~~
wfunction
Notice I never even mentioned the phrase "literate programming" when
responding to you? It's because I'm not trying to debate programming
philosophy here, I'm trying to address a practical/immediate concern of the
OP. I can debate with you day and night about what programming methodology is
best, but that's _not_ what the question here has been about, and I'm doing my
best not to divert the discussion into a different direction.

The debate has been about why the OP's code was considered poor by the
employer, and I think putting too many comments might have been such a reason.
Whether or not you think putting too many comments is good or bad is
orthogonal to whether or not it might have been a reason for rejecting the OP
as a candidate. _I_ think it's a reason for avoiding hiring the OP (see my
previous discussion about productivity and wasting time writing comments), and
whether you feel it's actually _justified_ by some "good" coding methodology
is orthogonal to whether or not the employer might have used the same
rationale as me, and that's all I'm trying to address here. If you feel the
employer's rationale was unjustified or crazy, then so be it; that doesn't
mean the employer couldn't have had this thought process anyway.

~~~
jsmthrowaway
This entire subthread for 45 minutes, me talking to you, has been me talking
about programming philosophy with you. OP left my mind on this a long time
ago. By your examples, I felt like you were coming along with me (two
arbitrary candidates, for example), so I don't even know what we're doing
here.

We're not on the same page here, clearly.

~~~
wfunction
Sorry?

------
eel
Without seeing the prompt they gave you and not knowing the context you would
have gained from the technical interview, we're all just guessing here.

My guess is that they were expecting a much simpler application for a simple
problem. Also for a JS game with a tiny backend, the Github project code is
heavily weighted toward PHP (73% PHP vs 20% JS). Perhaps in their internal
discussions, a word like "over-engineered" was brought up.

I'm not saying that it's bad code. It looks fine to me.

Other point is that the technical interview is a time to ask questions for the
interviewee (when they allow). What is their development process? Do they
iterate and prototype a lot, or is their process closer to waterfall? Assuming
their stack is primarily PHP, do they use a framework? Do they follow MVC? Do
they use a JS framework? Etc... Having known the answers to these questions
would have helped you create an application that looked closer to their
comfort zone. (Even if you don't know a coding test is coming, you still
should want to know the answers to these questions so that you can know if you
are getting into a situation where you might have to maintain old applications
written in PHP 4, for instance.)

~~~
joesmo
It's clear that their stack is not PHP from honestfeedback's comment about not
being familiar with composer (though really composer does not require sudo if
used properly). From briefly glancing at the code, I also think it looks fine
and for a one to two hour project, IMO, is way more than any company should
expect. I agree that knowing the answers to these questions is crucial
regardless of coding tests, but an interviewer who can't judge code that's not
in a familiar format (MVC, framework, etc.) is a junior developer and
shouldn't be judging any code.

I hope the OP finds a job someplace where his skills will be appreciated, a
place that doesn't ask for free work. Sounds to me that they were really too
lazy to look at the whole application or didn't have the technical know-how to
understand an application written in frameworks they were not familiar with.

------
ary
Assuming you did this in a day or less I think your prospective employer kind
of missed the point of the exercise. Turning out a (fairly well put-together)
working prototype in this timeframe shows that you _can_ code, your first-pass
level of quality, and that you know how to prioritize.

The output of this project should have been a starting point for further
discussion. Instead what you describe tells me the company you interviewed
with is probably a "one-pass" (it's expected to be perfect the first time)
shop and likely have loads of technical debt. Competent software shops
understand the long term nature of development and the tradeoffs involved.
They missed an important opportunity to learn about your true depth and
ability to work with others by not having you do a paired refactoring of some
aspect they didn't like.

Just as people are often bad at being the _interviewees_ people can be equally
as bad (or worse) _interviewers_. There are loads of jobs out there for you.
Don't let things like this discourage you.

------
uasked
I briefly took a look at the code and I'll help you out with some honest
feedback (I've hired before).

The problem looks like it's on the frontend, mainly. It doesn't look like
you're leveraging a framework (instead manually munging the DOM), which
suggests unfamiliarity with modern framework-based frontend development flow
(this may or may not be true).

Regarding the backend, it looks like mainly PHP framework copy-paste. I
suspect if someone has a vendetta against PHP (I don't, but some do), that
might be a black mark.

If I were to summarize this code, it looks like it was written by someone who
can competently hack together a web app on their own, but doesn't have much
experience with working on a modern dev team.

I have no idea if I'm right. Just offering an employer's perspective.

~~~
cypher543
With all due respect, it's a memory game, not a large-scale web application. I
don't understand why "frameworks" are the answer to everything these days.
There's nothing wrong with interacting directly with the DOM, especially for
something like this.

~~~
notduncansmith
Perhaps framework was the wrong choice of word. I wouldn't call jQuery a
framework, but it certainly would have helped. A library like Rivets.js or
similar would have been great to see as well, since at that point there'd be
(close to?) 0 manual DOM manipulation required (thus obviating the need for
jQuery), and he could still keep the page weight easily under 10k.

~~~
cypher543
But what's the point? These days, there's not a whole lot jQuery does that
can't be done easily with vanilla JavaScript. Would you rather hire someone
who can write lean code with minimal dependencies or someone who throws in
whatever library is getting the most buzz "just because"?

~~~
notduncansmith
I'd rather hire the guy who writes the most maintainable code. jQuery is
hardly a "buzz" library, and in this case, using it certainly wouldn't be
"just because". It's been the industry-standard method of non-trivial DOM
manipulation for _years_. If he included Angular or Ember or some other
nonsense, then I'd be concerned for the exact reasons you stated.

------
notduncansmith
I've never hired anyone, so take my thoughts with a bucket of salt, but one
concern I'd have is that there's just way too much code here. There only
needed to be one or two PHP files for the whole app (assuming you were
supposed to use PHP in the first place). If they're not a PHP shop, they
likely look down on PHP with severe disdain (as many do) and so this may have
led to some premature judgement.

Drawing the grid with Javascript wasn't necessary at all: that could have been
pure HTML/CSS.

No use of jQuery is probably a red flag - not that it's inherently bad to
avoid jQuery if you don't need it, but using it would have made your code
substantially cleaner/easier to maintain. If a quick and dirty project like
this is your assignment, I'd be a little concerned if you didn't install a
tool that would help you complete it as quickly as possible - especially one
that's (for better or worse) pretty much a given on any project that involves
Javascript.

Finally, while I understand that you may not be a UI designer, there's a
pretty severe lack of polish on this interface. Part of being a full-stack
developer is being a front-end developer; part of being a front-end developer
is some sense of design; and part of being a "senior" full-stack developer is
being able to set a strong example across the entire stack (including the
front-end). The arrow keys for navigation was a nice touch on the interaction
side, but visually it was amateur hour.

I'm not a strong PHP developer so I won't speak to your back-end skills, but
hopefully this has given you some perspective on why they made the decision
they did. For what it's worth, I agree with their feedback. I know that's hard
to hear, but just pick yourself back up and keep getting better.

In the mean-time, I suggest applying for lower-level positions. Find somewhere
that will provide a good learning environment, alongside some strong senior
developers that can mentor you without expecting you to perform at a senior
level. Then, in a few years (or months if you're a quick study), get back on
the horse and apply for some more senior positions. You'll get there someday.

------
ufmace
This whole interview practice seems a bit odd to me. Does anyone else out
there give these types of "Homework" assignments to candidates after they've
already been through HR and tech interviews? If I gave out an assignment like
this at all, I'd be inclined to give it before the on-site interview as a pre-
screen. I thought the whole point of such a thing would be to screen out
people who can't code at all before they take up valuable man-hours
interviewing, with a secondary goal of creating discussion material for a
technical interview. Assuming it doesn't completely suck, I'd use part of the
technical interview to discuss various aspects of the solution - the merits of
frameworks used, tradeoffs of design decisions you made, what would you need
to do to scale to 1M users, where are the potential performance bottlenecks
and security challenges, etc.

Doing it like this makes me wonder if their real motive is something else.
What are they really trying to determine with this sort of test at this time?
They do it at a time where there isn't much opportunity to discuss the result,
so what's the real goal? Whether, without prompting, you used their favorite
language/framework/database and happen to have the same coding style as them?
Seems pretty silly to me.

Did you get any possible feeling that maybe they have some hidden or political
reason for not wanting to hire you, and threw this test at you as a way to
create an excuse for why they won't hire you? That would explain why they gave
it after the interviews and don't seem to be interested in discussing why it
doesn't meet their standards.

~~~
Jemaclus
We always give some sort of programming test, usually a dumbed down version of
a problem we've recently solved ourselves. You shouldn't have to spend more
than two hours on it, if that. Most of the time our applicants say they spent
less than an hour on it. It also weeds out a non-zero number of people who
aren't really super interested in the position.

~~~
ufmace
That sounds fine; it's more a question of the timing. I'm guessing you give
your test before the in-person interview? That would make a lot more sense to
me than doing it after, which they apparently did to OP.

~~~
Jemaclus
Yes, it's usually "homework" (i.e., send us your resume and your code sample
at the same time). I have a "problem solving" task where I expect you to bang
out an algorithm (as opposed to code) for the in-person interview. That's
mainly just so I can watch you think out loud.

I can teach you my project's programming language... I don't have time to
teach you problem solving basics.

------
zachrose
You seem like a sharp developer who shouldn't be spending your time doing
bogus homework in today's market. Out of curiosity, whereabouts are you
located?

~~~
notaio
Thanks. I am a French expat in Hongkong

~~~
zachrose
Cool. If you wind up in southern California hit me up.

------
pistle
I see a disconnect between balance of dependencies vs. the minimum required to
yield the target result. A lack of focus on the thing you are trying to
show... coding skill/efficiency around the game problem. The tight piece
should be a great set of game code. I see, which I see a lot when I see IoC
for small jobs, inversion of focus. Lots of ceremony yielding a loss of
clarity.

You know laravel. You know about libraries and can use them. It's less clear
that the code you wrote was good. It's sort of buried in a fair bit of noise.

You won no favors by requiring an install of the nature you have and fumbling
that a bit as well (chmod 777).

The other thing is... you can't trust a potential employer's reason for
saying, "No." They said it, but you don't know if the message is garbled by
the HR rep or even a flat out lie because the short answer is, "No." and they
don't want to spend time explaining themselves.

They decided and moved on. They are not invested in your future. Coming here
for feedback is a good practice. We care about you and have few reasons to
just let you know, "No."

Soooo many dev job fish in the sea. Get your line back in. Your bait is fine.

------
kamaal
It only means they didn't deserve you. I have gone through a few interviews of
this nature off late. Given the, timelines(and technology limitations) they
give you to complete the assignment and return it to them and managing a day
job with family, frankly speaking I had to slog through whole nights for
sprints of 3 days. For nearly a month for various interviews.

At the end some companies appreciated it and some just plainly gave a very
discouraging feedback.

If you can't appreciate a person who can deliver your requirements with 100%
features covered and well tested to the point without wasting any time on
clarifications, under crippling timelines- Then clearly you are looking for
men from an another planet.

You must just wish those companies all the best and move on. They are
ultimately going to hire some career cup scraper any way.

------
scarmig
Eh. These things are highly subjective. Seems competent overall: I'm not
wowed, but these types of assignments are, as you surmised, about establishing
baseline competency.

Some thoughts for the future:

1) PHP was a bad choice; some people have a burning, irrational hatred for it,
and it leads them to judge your work in the harshest light instead of an
evaluative one.

2) Speaking of burning irrational hatreds: PLEASE DO NOT MIX TABS AND SPACES.
Drives me nuts--I would have dinged you for that. Not enough to make me say it
is "falling far short of senior developer standards," but it makes me question
your habits of development.

Tests are always nice, too: they're like the anti-PHP, and give a great deal
of bang for buck in terms of coloring people's impressions of you.

~~~
stcredzero
(Note: the following is not criticism directed at _you_. I'm merely using your
comment as a springboard for commentary about the industry on many matters you
also show you are aware of.)

 _These things are highly subjective._

Yes.

 _leads them to judge your work in the harshest light instead of an evaluative
one_

Should any professionals have to present apologetics for others in his
procession doing such a thing? We are all human beings, but shouldn't we be
_trying_ not to be this quickly and arbitrarily judgemental?

 _Speaking of burning irrational hatreds:_

Somehow the social expectations of the programming profession are that we can
get away with acting these out.

 _PLEASE DO NOT MIX TABS AND SPACES. Drives me nuts--I would have dinged you
for that._

Yes. This can be problematic. The fact that it is still problematic after all
these decades is a good indicator of how backwards we are as a profession.

If you look at the various analyses answering the op as detection of
signalling -- well, it's all about signalling. I'm not so sure this is too
much more substantive than an interview where you need to have the right
school name on the right degree and a properly pressed suit.

~~~
utunga
>> leads them to judge your work in the harshest light instead of an
evaluative one

> Should any professionals have to present apologetics for others in his
> procession doing such a thing? We are all human beings, but shouldn't we be
> trying not to be this quickly and arbitrarily judgemental

Well sure. But this is php we're talking about here.

~~~
stcredzero
_Well sure. But this is php we 're talking about here._

I'm not sure this is any more substantive than an interview where you're
supposed to have the right names on everything and show up in a pressed suit.

------
lostcolony
All the other comments so far are valid, but I have something else to add -
did they indicate a time frame you had to have it done by, and did you use all
of it? Because they may not have been looking for fast turnaround time, they
may have been looking for quality.

In the future if you get something similar, you may want to ask what they're
looking for (gathering requirements, you might say), and optimize accordingly.
Ultimately, it may be completely unrelated, but I've had both kinds of coding
tests, ones where I had an hour and had to cut corners as such, and ones where
I had an entire weekend and was explicitly told to make it production quality,
whatever I felt that entailed.

------
longlho
Agreed w/ honestfeedback.

\- Overall project structure seems a bit unorganized IMO (no centralized build
process, gulpfile inside subfolder). Overall this makes it fairly hard to dive
right into the project. It might be my lack of experience in PHP project
structure.

\- I think pulling in a server & a db might be an overkill. Local storage will
do the job perfectly.

\- Mix of tabs & spaces is also very messy.

\- Styling is pretty sloppy too I believe. No clear organization/reusability
in the stylesheets.

\- Vendor scripts/generated scripts should not be committed to the repo IMO.
There're already bower & CDNjs & a bunch of other services.

\- Your JS is also very module/singleton-based although some of them are
clearly object-oriented. Also seems to be a mix of jQuery usage & DOM
directly, why not 1?

I think what they're looking for is a couple of simple JS that's easily
tested, maintained & expanded which IMO is more important for senior
candidates. Less senior ones can always bang this out quickly but senior ones
care way more about other attributes of a project than just getting it done
asap.

~~~
tetha
> \- Overall project structure seems a bit unorganized IMO (no centralized
> build process, gulpfile inside subfolder). Overall this makes it fairly hard
> to dive right into the project. It might be my lack of experience in PHP
> project structure.

This was what I noticed the most - and I can easily see this as a big part in
the discussion, since seniors should lead and bootstrap projects.

I'd have expected something like ./server and ./client and a README toplevel,
client eventually having a public folder which can be served as-is (i.e.
doesn't contain any build/dependency management files), potentially with a
second public-minified around. Instead I end up with a src-folder hidden like
3 folders deep and another one toplevel for asymmetry.

Beyond that, the folders in the php app follow the package-by-kind
antipattern. There is no value in grouping all controllers in one place.
There's value in grouping all the highscore handling in one place, though.

------
andrewstuart
When developers assess the code of developers, the assessments can often be
entirely arbitrary and utterly meaningless. It's one of the worst possible
ways of assessing people because almost no-one does it in a scientific,
quantifiable way at any level. The assessments are purely subjective.

------
utunga
FWIW instructions dictate "1) Use directional arrows to select a card. 2) Use
"Enter" or "left click" to flip a card"

In the demo I can use arrow keys. But only left click can flip a card. [enter]
does nothing (using Chrome Version 35.0.1916.153 m on Windows 7).

If they tried it and it failed (and if they had a big pile of submissions to
get through) this would've definitely counted against your submission.

\--

More generally, having looked at what this game actually does vs number of
lines of code I would use one word to describe it - overkill.

\--

Let me add. It was very helpful of you to post this question. Informative (I
hope) for you, but also for everyone else, as we contemplate what coding
mastery is really about.

------
cjbprime
Your game looks generally fine, they're being weird.

Is it possible that you misunderstood and they (a) wanted you to use a
different language than PHP (perhaps because they're a Rails shop or
something), or (b) wanted you to do this in pure JS, with e.g. localStorage?

Also, the block indentation/braces look deeply messed up on github, any idea
what happened?

[https://github.com/m4nuC/memGame/blob/master/app/controllers...](https://github.com/m4nuC/memGame/blob/master/app/controllers/ScoresController.php)

~~~
tokenizerrr
> Also, the block indentation/braces look deeply messed up on github, any idea
> what happened?

Combination of using spaces and tabs for indentation. Looks like it'd look
fine with tab size set to 4, but it should of course only use one method of
indentation.

~~~
notaio
Yes it seems like it. Gotta find VIM script to catch those

~~~
davidcuddeback
listchars works pretty well. I have this in my .vimrc:

    
    
        set list
        set listchars=tab:>=,trail:~,extends:>,precedes:<,nbsp:.
    

Edit: you can also configure it to use one type of indentation. I use "set
expandtab" so that my files are always indented with spaces.

~~~
notaio
Thanks for that

------
sirrocco
Thanks for posting this, the whole thread was a learning experience and
congrats for having the guts to "Ask HN".

I won't really comment on the code but I think that the company could have
come back with something like: "Hey, can you make this much smaller? with only
minimal use of frameworks?"

An explanation like "Falling far short of senior developer standards" sounds
like an absolutely pointless comment and I feel someone had a bit of a
childish reaction when seeing the code (their comment could fit them just as
well).

------
cuong
The code didn't scream senior developer, but given the constraints it looks
like you're an able developer and worth the time to at least interview.

Sorry for the bad experience, hope it turns out better.

------
cnp
The key to all things is "Keep it Simple".

------
ryen
>Run sudo chmod -R 777 app/storage.

Certainly opening up write access to everyone isn't going to win you any
points.

~~~
notaio
I would have made it 755 on my environment but I wanted to make sure the
install work properly as I know this is often a friction point during install
of Laravel

~~~
ugh123
Then clearly you don't understand how to use your framework, or you don't
understand how to run a webserver. Saying "I would have made it.. but..." is
certainly not something i'd let fly in my dev team.

I've taken a look at your code and you do not appear to be senior-level
material. You managed to turn a relatively small game into 40+ files and 15+
directories of mostly useless framework fluff just to make what appears to be
a mostly-javascript game.

\- Trying to review your code, I have to navigate a nested tree of framework
php and nodejs includes to actually discover what the heck is going on. \- Why
do you need nodejs for development? That just introduces yet another framework
to install and deal with packaging and deployment. Why not just stick to
backbone or some other minimal framework tool in javascript? You're not even
importing that much useful stuff to warrant using npm. \- You're doing a lot
of manual dom manipulation which looks sloppy \- You've committed a minified
css file

Maybe some of the code you wrote might be okay, but your choice of setup and
prep for a project seems pretty junior. Get some experience working with
veteran developers on more complex projects (i.e. not simple web dev).

------
jsaxton86
I'm trying to figure out how much effort went into this. I ran cloc, and
here's what I got:

    
    
      --------------------------------------------------------------------------------
      Language                      files          blank        comment           code
      --------------------------------------------------------------------------------
      Javascript                     1803          66480          85484         423029
      HTML                             57            847             79          20374
      SASS                             19             21              8          12114
      C++                              38           1011            763           7700
      C/C++ Header                     45            816            713           5165
      CSS                              16            133             27            777
      PHP                              36            330           1048            597
      CoffeeScript                     14             72             44            326
      make                             13             91              3            255
      YAML                             39              8              0            227
      Bourne Shell                     16             49             42            197
      Python                            1             32              7            125
      m4                                1             12              0             61
      Bourne Again Shell                5             15             16             38
      XML                               1              0              0             18
      Ruby                              1              0              2              4
      --------------------------------------------------------------------------------
      SUM:                           2105          69917          88236         471007
      --------------------------------------------------------------------------------
    

Most of this is obviously third party code, but it looks like you wrote
thousands of lines of PHP, plus a bunch of frontend code?

I'm not a web developer, but this seems like a day or two of work? That seems
unreasonable to me, and I probably wouldn't have agreed to that level of
commitment, especially if they were still interested in me after an interview.

Side note: in the webdev world, is it normal to have third party code mixed
with stuff you wrote yourself? In C++ land most of the third party stuff would
have gone in a contrib directory or something before being built into a
library of some sort.

~~~
headcanon
TIL about cloc! Thank you good sir. It seems as though this is because he had
node_modules checked into source control on the frontend part. npm basically
likes to download the whole internet when you run npm install, so these stats
do not suprise me. Checking in that directory is generally discouraged, but
its possible he wanted to avoid adding the node dependency in order to ease
installation.

~~~
jsaxton86
You are correct. Here are the revised numbers after excluding
public/scripts/node_modules:

    
    
      -------------------------------------------------------------------------------
      Language                     files          blank        comment           code
      -------------------------------------------------------------------------------
      PHP                             36            330           1048            597
      Javascript                       9            101             86            362
      SASS                             6              4              4            127
      XML                              1              0              0             18
      CSS                              1              0              0              1
      -------------------------------------------------------------------------------
      SUM:                            53            435           1138           1105
      -------------------------------------------------------------------------------

------
adriand
Personally, I'm impressed by your work. These folks are missing out.

~~~
notaio
Thanks Adriand, much appreciate.

------
ugh123
Can you let us know what company this is?

