Testing candidate's mettle S02E01
-
Where we were when connection dropped.
By the upload speed of that screenshot, looks to be mine :/
-
@cartman82 said in Testing candidate's mettle S02E01:
Where we were when connection dropped.
By the upload speed of that screenshot, looks to be mine :/
Looks like he's got everything, minus the headers... which means this is the first one who actually finished your task?
-
@sloosecannon said in Testing candidate's mettle S02E01:
this is the first one who actually finished your task?
We live in a sad, sad world.
-
@sloosecannon said in Testing candidate's mettle S02E01:
Looks like he's got everything, minus the headers... which means this is the first one who actually finished your task?
Connection reestablished. Finishing it up.
Actually there was one other medior guy who did good, but he wasn't as good as this kid.
I look forward to the refactoring talk.
-
So, this seems to be turning into a Joss Whedonesque Season 2. As in, there will only ever be a Episode 1.
-
Code so far.
He's doing the tricky bits with floats. Not sure I'm getting much out of this part. Might remove it in future installments.
-
This post is deleted!
-
@cartman82 said in Testing candidate's mettle S02E01:
BTW, he took the time to set the indentation to 2 spaces. Sign of a guy who cares how his code looks.
Or a guy who writes dense and highly indented code.
Filed Under: Been there
-
Unfortunately, my internet is crap tonight. The meeting broke :/
He'll finish up on his own, then we'll try one last call. I really want to see how far he'd go into refactoring.
-
@boomzilla said in Testing candidate's mettle S02E01:
Or a guy who writes dense and highly indented code.
Filed Under: Been there
I don't care what particular style he likes, just that he likes SOMETHING. Hint that he cares about the craft to some extent.
-
@cartman82 said in Testing candidate's mettle S02E01:
Unfortunately, my internet is crap tonight. The meeting broke
FUCK YOU CABLE COMPANY, WHY TONIGHT!?
-
@cartman82 said in Testing candidate's mettle S02E01:
Hint that he cares about the craft to some extent.
Or that he's a pedant who's going to spend an entire workday arguing The Only True Coding Style. But oh well, he got the job done.
-
@cartman82 said in Testing candidate's mettle S02E01:
FUCK YOU CABLE COMPANY, WHY TONIGHT!?
"Why are you interviewing people at 10PM" is the question I'd rather see answered...
-
@cartman82 said in Testing candidate's mettle S02E01:
I don't care what particular style he likes, just that he likes SOMETHING. Hint that he cares about the craft to some extent.
I guess that's fine for a junior. Not much
you canwe could do when it's the lead. Gawd...there are still multi-thousand LOC classes in there that everyone is afraid of.
-
@Maciejasjmj said in Testing candidate's mettle S02E01:
"Why are you interviewing people at 10PM" is the question I'd rather see answered...
He's working during the day.
And I agreed to do it because bloggerviewing is fun, and still feeling good about the raise.
-
@Maciejasjmj said in Testing candidate's mettle S02E01:
Or that he's a pedant who's going to spend an entire workday arguing The Only True Coding Style.
Most young people are "One True X" fanatics for variety of X-es. Hopefully, they grow out of most of them over time.
-
@cartman82 said in Testing candidate's mettle S02E01:
Most young people are "One True X" fanatics for variety of X-es. Hopefully, they grow out of most of them over time.
I channel my inner pedantry towards build processes. ONE CLICK EVERYTHING!
-
@boomzilla said in Testing candidate's mettle S02E01:
I guess that's fine for a junior. Not much
you canwe could do when it's the lead. Gawd...there are still multi-thousand LOC classes in there that everyone is afraid of.Oh man. At an earlier job, we had a massive form file that represented the editing functionality for one of our core data types. Well over 10K lines of code. When I innocently suggested in a team meeting that it might be more maintainable if we broke it up into Frames, (a perfectly idiomatic way to handle a form set up the way this one was in Delphi VCL code,) I immediately got a bunch of panicky developers all looking at me in horror and, almost at the same time, saying various versions of "it works; don't touch it!"
-
@sloosecannon said in Testing candidate's mettle S02E01:
F$%king DOM manipulation syntax and inserting things into html
-
@No_1 said in Testing candidate's mettle S02E01:
@mott555 said in Testing candidate's mettle S02E01:
Probably could even pay them in cigs...
Apparently it's ramen noodles these days.
I'd go for Maruchan Ramen, none of that Nissin crap!
-
@masonwheeler said in Testing candidate's mettle S02E01:
I immediately got a bunch of panicky developers all looking at me in horror and, almost at the same time, saying various versions of "it works; don't touch it!"
At one point (after the culprit was gone) I had to fix something in there. It was a mess. Copy pasta was rampant. Duplicate code for
thing1
,thing2
, etc. I cleaned some of that up, so a particular corner of it is slightly less horrible than the rest.
-
Final code:
var xhttp = new XMLHttpRequest(); var parseData = function () { xhttp.open('GET', 'http://server.com/data', false); xhttp.send(); var output = []; console.log(xhttp.responseText); xhttp.responseText.split('\n').forEach(function (row, i) { if (i < 2) { return; } var values = row.replace(/ +(?= )/g, '').split(' '); var productName = values[0]; var unitPrice = values[1]; var amount = ''; if (typeof values[2] !== 'undefined') { amount = parseInt(values[2].replace('kg', '')); } if (amount >= 17 || amount === '') { output.push({ productName: productName, unitPrice: unitPrice, amount: amount, }); } }); return output; }; var parsedData = parseData().sort(function(a, b) { return b.unitPrice - a.unitPrice; }); var table = document.createElement('table'); var body = document.getElementsByTagName('body')[0]; var output = ''; parsedData.forEach(function (element) { output += '<tr><td>'+element.productName+'</td><td>'+element.unitPrice+'</td><td>'+element.amount+'</td></tr>'; }); table.innerHTML = '<tbody>'+output+'</tbody>'; body.appendChild(table);
He didn't end up refactoring anything. After I prodded him a bit, he produced the right kind of answers. I just don't know how to do this talk bit without feeling like I'm leading him to solutions I want. Need to figure out some better strategy for this final stage (too little practice :))
Overall, he understands the concepts such as API-s, pagination and all the rest. Impressive for someone his age. Of course, I'll recommend we hire him.
Off to tell the boss the impressions. I guess I could just link him to this thread, hmm.... Nah.
-
@masonwheeler said in Testing candidate's mettle S02E01:
@boomzilla said in Testing candidate's mettle S02E01:
I guess that's fine for a junior. Not much
you canwe could do when it's the lead. Gawd...there are still multi-thousand LOC classes in there that everyone is afraid of.Oh man. At an earlier job, we had a massive form file that represented the editing functionality for one of our core data types. Well over 10K lines of code. When I innocently suggested in a team meeting that it might be more maintainable if we broke it up into Frames, (a perfectly idiomatic way to handle a form set up the way this one was in Delphi VCL code,) I immediately got a bunch of panicky developers all looking at me in horror and, almost at the same time, saying various versions of "it works; don't touch it!"
We had some code like that, but as time went on less and less of it worked and nobody knew anything about it to fix it. I finally got fed up enough to scrap it and rewrite that portion of code, and I turned ~15,000 LOC into 600. I can't even imagine how anyone thought that feature needed so much code. And it was all C code, so it's not like there were newer libraries to simplify it during the rewrite.
-
@cartman82 said in Testing candidate's mettle S02E01:
I guess I could just link him to this thread, hmm.... Nah.
One of us! One of us!
-
It's too late now, but hangouts has screenshare and I assume it runs on linux since all it needs is Chrome. Maybe for future reference?
-
@LB_ said in Testing candidate's mettle S02E01:
It's too late now, but hangouts has screenshare and I assume it runs on linux since all it needs is Chrome. Maybe for future reference?
I don't remember if the screenshare part works on Linux.
-
@pydsigner said in Testing candidate's mettle S02E01:
@LB_ said in Testing candidate's mettle S02E01:
It's too late now, but hangouts has screenshare and I assume it runs on linux since all it needs is Chrome. Maybe for future reference?
I don't remember if the screenshare part works on Linux.
Bets on: Nope.
-
@cartman82 late answer, but maybe it helps someone.
For this sort of thing http://appear.in/ works great
-
@Tsaukpaetra said in Testing candidate's mettle S02E01:
@pydsigner said in Testing candidate's mettle S02E01:
@LB_ said in Testing candidate's mettle S02E01:
It's too late now, but hangouts has screenshare and I assume it runs on linux since all it needs is Chrome. Maybe for future reference?
I don't remember if the screenshare part works on Linux.
Bets on: Nope.
It works on ChromeOS, and Chrome Remote Desktop works on my headless Linux machine, so
-
You know, considering how knowledgeable this guy appears to be, do you think he's never heard of TDWTF?
@cartman82 did you mean to post this in the lounge instead of games?
-
@bb36e said in Testing candidate's mettle S02E01:
You know, considering how knowledgeable this guy appears to be, do you think he's never heard of TDWTF?
@cartman82 did you mean to post this in the lounge instead of games?
I thought this was a game show?
-
@cartman82 said in Testing candidate's mettle S02E01:
Final code:
var xhttp = new XMLHttpRequest(); var parseData = function () { xhttp.open('GET', 'http://server.com/data', false); xhttp.send(); var output = []; console.log(xhttp.responseText); xhttp.responseText.split('\n').forEach(function (row, i) { if (i < 2) { return; } var values = row.replace(/ +(?= )/g, '').split(' '); var productName = values[0]; var unitPrice = values[1]; var amount = ''; if (typeof values[2] !== 'undefined') { amount = parseInt(values[2].replace('kg', '')); } if (amount >= 17 || amount === '') { output.push({ productName: productName, unitPrice: unitPrice, amount: amount, }); } }); return output; }; var parsedData = parseData().sort(function(a, b) { return b.unitPrice - a.unitPrice; }); var table = document.createElement('table'); var body = document.getElementsByTagName('body')[0]; var output = ''; parsedData.forEach(function (element) { output += '<tr><td>'+element.productName+'</td><td>'+element.unitPrice+'</td><td>'+element.amount+'</td></tr>'; }); table.innerHTML = '<tbody>'+output+'</tbody>'; body.appendChild(table);
@cartman82 said in Testing candidate's mettle S02E01:
I prepared a version of the usual data processing task. We'll be doing it in javascript this time. I won't even bother with any FizzBuzz intro crap.
Write a webpage that displays a list of products with AMOUNT of 17 kg or more, sorted by UNIT PRICE in descending order. - Data should be loaded from: http://cartman.com/data.txt - Items with missing AMOUNT-s should be INCLUDED in the results - Output should be in an HTML table - Column headers shoud be preserved - Preferrably, no external library should be used
The data is just this text file on my server:
Product name Unit price Amount ==================================================== Apple 8.63 17.00kg Watermelon 17.12 6.3kg Corn .78 143kg Orange 20.12 56.44kg Grape 11.00 Banana 20.12 18.12kg Pear 6.00 17kg Kiwi 1.99 Pineapple 6 14kg Lemon .5 11kg
I'll assume requirement 4 was just overlooked, but do you know why they converted all the amounts to int instead of float?
-
@bb36e said in Testing candidate's mettle S02E01:
@cartman82 did you mean to post this in the lounge instead of games?
Nah.
-
@Tsaukpaetra said in Testing candidate's mettle S02E01:
I thought this was a game show?
Every testing mettle episode goes into a different category, it's tradition.
-
@cartman82 said in Testing candidate's mettle S02E01:
@bb36e said in Testing candidate's mettle S02E01:
@cartman82 did you mean to post this in the lounge instead of games?
Nah.
@cartman82 did you mean to leave a blank line instead of having your post show as part of the quote?
-
@ben_lubar mobile :/
-
@cartman82 said in Testing candidate's mettle S02E01:
@Tsaukpaetra said in Testing candidate's mettle S02E01:
I thought this was a game show?
Every testing mettle episode goes into a different category, it's tradition.
I can't wait until the category 4 and 5 episodes!
-
@Dreikin said in Testing candidate's mettle S02E01:
I'll assume requirement 4 was just overlooked, but do you know why they converted all the amounts to int instead of float?
Probably bug?
I realized these details aren't very interesting for the interview. In the future, I'll remove some of these gotchas (including the DOM crap), and try to put more accent on good software architecture.
-
@mott555 said in Testing candidate's mettle S02E01:
We had some code like that, but as time went on less and less of it worked and nobody knew anything about it to fix it. I finally got fed up enough to scrap it and rewrite that portion of code, and I turned ~15,000 LOC into 600. I can't even imagine how anyone thought that feature needed so much code. And it was all C code, so it's not like there were newer libraries to simplify it during the rewrite.
That package (it's java) has about 16K physical lines. The business requirements behind them are pretty crazy, but basically legit. Just some really poor coding practices in there. Like...for one of the domain objects, a particular member was deprecated and then repurposed for something totally different. Fuck.
-
@cartman82 said in Testing candidate's mettle S02E01:
Finally figured out DOM crap. Typos. :/
i swear i had nothing to due with that.
-
@mott555 said in Testing candidate's mettle S02E01:
@masonwheeler said in Testing candidate's mettle S02E01:
@boomzilla said in Testing candidate's mettle S02E01:
I guess that's fine for a junior. Not much
you canwe could do when it's the lead. Gawd...there are still multi-thousand LOC classes in there that everyone is afraid of.Oh man. At an earlier job, we had a massive form file that represented the editing functionality for one of our core data types. Well over 10K lines of code. When I innocently suggested in a team meeting that it might be more maintainable if we broke it up into Frames, (a perfectly idiomatic way to handle a form set up the way this one was in Delphi VCL code,) I immediately got a bunch of panicky developers all looking at me in horror and, almost at the same time, saying various versions of "it works; don't touch it!"
We had some code like that, but as time went on less and less of it worked and nobody knew anything about it to fix it. I finally got fed up enough to scrap it and rewrite that portion of code, and I turned ~15,000 LOC into 600. I can't even imagine how anyone thought that feature needed so much code. And it was all C code, so it's not like there were newer libraries to simplify it during the rewrite.
I do hope that you know for sure if it's functionally the same. Legacy code might be bulky and full of cruft, but at the same time it might have sprouted features that are actually wanted by a customer without anyone realizing it.
-
@JBert said in Testing candidate's mettle S02E01:
@mott555 said in Testing candidate's mettle S02E01:
@masonwheeler said in Testing candidate's mettle S02E01:
@boomzilla said in Testing candidate's mettle S02E01:
I guess that's fine for a junior. Not much
you canwe could do when it's the lead. Gawd...there are still multi-thousand LOC classes in there that everyone is afraid of.Oh man. At an earlier job, we had a massive form file that represented the editing functionality for one of our core data types. Well over 10K lines of code. When I innocently suggested in a team meeting that it might be more maintainable if we broke it up into Frames, (a perfectly idiomatic way to handle a form set up the way this one was in Delphi VCL code,) I immediately got a bunch of panicky developers all looking at me in horror and, almost at the same time, saying various versions of "it works; don't touch it!"
We had some code like that, but as time went on less and less of it worked and nobody knew anything about it to fix it. I finally got fed up enough to scrap it and rewrite that portion of code, and I turned ~15,000 LOC into 600. I can't even imagine how anyone thought that feature needed so much code. And it was all C code, so it's not like there were newer libraries to simplify it during the rewrite.
I do hope that you know for sure if it's functionally the same. Legacy code might be bulky and full of cruft, but at the same time it might have sprouted features that are actually wanted by a customer without anyone realizing it.
As far as our unit test coverage could tell, it was functionally the same. Actually, functionally better, since things like DMA and interrupts no longer worked in the old code but did in the new code.
I forgot to mention, this was all device driver stuff, not typical software.
-
@mott555 said in Testing candidate's mettle S02E01:
I forgot to mention, this was all device driver stuff, not typical software.
Speaking of, can you help design a software-based video card that uses the RDP protocol to emulate extra physical displays? Asking because I've been wanting this for ages and all the paid solutions are so proprietary (and glitchy) it's unusable...