6 ms·
I'd rather candidates had empathy, a willingness to learn, and an appreciation of testing & CI, than the ability to implement a linked list in under 10 minutes.
by EngineerBetter 10y ago
I'd rather candidates had empathy, a willingness to learn, and an appreciation of testing & CI, than the ability to implement a linked list in under 10 minutes.
In over a decade of software development including web systems, games development, command line tools and distributed systems, I've never had to implement a linked list. If you haven't used the modulo operator, FizzBuzz isn't necessarily obvious.
- deleted 10y ago[deleted]
- wasyl 10y agoWillingness to learn doesn't guarantee much. Actual skill is important too, and for anything above complete entry level position I would say knowing what is a linked list or a modulo operator is, well, necessary
- mseebach 10y agoIf you don't know the modulo operator, your claim to be a good programmer is rather suspect, so that's probably OK.
- busterarm 10y agoWhere have you ever had to use the modulo operator in your programming career, especially on the web side of things? Outside of challenges where it's almost required (FizzBuzz), the only thing that I can think of that I've ever used modulo for is to set an upper limit on random numbers. I can probably count the number of times I've needed to do that on one hand and for every one of those I've used several hundred other math functions like abs, floor & trig functions. I don't really do a lot of math in my code anyway. It's one of those things I see how to do in the language when I'm first learning the syntax and then move on.
- mseebach 10y agoI use it all the time to print out a message every 1000 iterations in a loop so I can see what's going on without flooding the output. I suppose you also don't often use division in your non-mathy web work. Despite that, would you think it unfair for an employer to think it reflected poorly on you if you couldn't write code to divide two numbers?
- busterarm 10y agoHeh, funny you use that example. Division operations have a lot of gotchas in many (most?) languages. That's exactly the kind of thing that I expect to see used in a stupid programmer challenge meant to test esoteric knowledge > ability.
- mseebach 10y agoDon't move the goalposts. It's about knowing at all, not knowing about gotchas. But hey, even then, those gotchas overlap with why you shouldn't store prices in floats and devs you don't want to hire do that all the time too.
- jusssi 10y agoConvert seconds into something human-readable (e.g. h:m:s). Surely it can be done without modulo, but using modulo seems to be the simplest solution.
- busterarm 10y agoYou should be using a library for this, not math. When it's an option.
- jasode 10y agoThere are lots of everyday uses (not mathy domains) for % operator. Some examples... Outputting a text report with columns. If there were 5 columns, use the "col=i%5" to put it in the correct column as "i" is incremented. date/time calcs such as... x%7 is often used for day-of-the-week algorithms x%3600 and x%60 is often used for converting raw seconds (e.g. convert 86400 seconds per day into hh:mm:ss) (If programmer doesn't know modulus "x%7", he might hardcode a big switch statement with 7 cases -- which will work, but it's not as elegant.) round-robin in discrete integer values --> use % modulus round-robin in continuous values --> use trig sin(), cos()
- busterarm 10y agoWorking with dates and time has so many edge cases and gotchas that I think it's irresponsible not to use a library for working with them. Any good Date(Time) library should abstract this away from you. Say Hello to Leap Seconds for me.
- jasode 10y agoIt's common to have a value called "total_elapsed_seconds" which comes from job logs, traces, etc and "leap seconds" wouldn't be relevant. You just want to "pretty print" it into hhh:mm:ss and %mod is the easiest way to calc that. I've used % for various unrelated tasks for more than 20 years. Another example... in languages that didn't have bit shifting like C/C++, I used % to convert bytes to a hex string (e.g. x%16).
- busterarm 10y agoI guess what I'm saying is... is calculating it easier than going: x = Time ( now ) ... total_elapsed_time = Time ( now ) - x print strftime ( total_elapsed_time ) I've actually used your hex example once before!
- nmjohn 10y agoI don't think the problem is the modulo operator per say, but rather programming in general is incredibly vast and even very experienced programmers will not have encountered some thing X which many other developers consider to be absolutely trivial. For example with modulo, I feel like I use it quite often, relatively speaking. Somewhat contrived example of usage on the web side of things: Let's say you're building a grid system that will have an unknown number of items. The grid is 12 columns wide. In the last row, any items that otherwise would be empty should instead have a placeholder item displayed. Given an arbitrary array of items, how many additional placeholder items should be included in what gets rendered? const colWidth = 12 const remainder = items.length % colWidth const numPlaceholders = (remainder === 0) ? 0 : colWidth - remainder
- BWStearns 10y ago>> Where have you ever had to use the modulo operator in your programming career, especially on the web side of things? Make every nth thing shaded a different color? Make sure a list of things has a useful amount of elements for a given task? When I was teaching myself how to program I'm pretty sure I made some terrible pseudo implementation of modulo before I found out it was a thing because that's a naturally occurring need.