Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #31311
| From | Doc O'Leary <droleary@2015usenet1.subsume.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: How would you prepare for javascripting interview? |
| Date | 2016-09-10 18:39 +0000 |
| Organization | Subsume Technologies, Inc. |
| Message-ID | <nr1k0b$d4t$1@dont-email.me> (permalink) |
| References | (9 earlier) <nqkl2e$6bt$1@dont-email.me> <nqmpag$kit$1@dont-email.me> <nqo0jf$a4v$2@dont-email.me> <nqpr7i$l7t$1@dont-email.me> <nqvqac$64e$1@dont-email.me> |
For your reference, records indicate that
Scott Sauyet <scott@sauyet.com> wrote:
> So if we're going to write functions to be used in a mathematical
> context, we should write functions that are mathematically lucid.
Except computers *aren’t* only used in a mathematical context. Even
things in Math are called to do work with *meaning*, not demonstrate
some abstract mathematical laws. That’s why it does indeed qualify
as a trick question to compare the results of min/max without
arguments.
> Mathematical laws like the one above make it *easier* to write useful
> code. Imagine you have a list of temperatures with timestamps and have
> to display the highs for each month and for the year. You partition the
> readings by month, pluck the temperatures for each, find the maxima, and
> then you can simply take the maximum of that list to to find the annual
> high. It's more efficient, and it's even possible that the part of the
> system that takes the annual maximum only knows these monthly maxima, not
> the raw data.
The mistake you make is in thinking everything is just about that one
calculation, and that there are no possible errors in the process.
What if instead your wonderful system had a sensor that broke down
one day? Now you have empty set that returns -Infinity as the
maximum temperature! And what if the calculation of interest in
aggregate is instead the *average* maximum temperature for the time
period that now contains that fabricated -Infinity?
> What makes this possible? The law above.
And a lot of incompetent programming.
> If instead, you were to return `null` on an empty list, what happens when
> it turns out that the sensor was down for all of April and no data was
> recorded?
This depends entirely on how you intend to handle a data set that has
missing values. Just as it is possible to have max() return NaN for
non-numeric input, it’s also possible to program it to *ignore*
non-numeric input. I mean, really, what does your wonderful
mathematical law say about any of that?
> April's value is now `null`, and the annual value is `null` or
> `NaN` or whatever you choose to return in this case. If you choose to
> throw, it's even worse. You're trying to get an annual value, from data
> which is perfectly legitimate, but you're implementation is causing you
> to throw an exception.
You haven’t even begun to define what is “legitimate” for mathematical
functions that aren’t operating on mathematical elements. Depending
on the program, it may very well be the correct thing to raise an
exception on the whole thing, or it might be fine to just discard any
values that are out of an acceptable range.
I mean, after all, it’s quite possible for a sensor to return not
only an empty value, but wildly high and low values as well. I
certainly know *I* have dealt with things like real-time GPS data
that falsely indicated I was momentarily *thousands* of miles away
from my actual position. Your desire for mathematical purity is out
the window the instant you have to put error bars on your data.
> > It is *wrong* to return a result *as if*
> > useful work was done when it is highly likely such a result is not only
> > in error, but will likely propagate that error.
>
> How would you define the maximum function? I would choose this: "max
> returns the smallest value that is no smaller than any element in the
> list." That seems succinct, clear and covers all cases (for Numbers, at
> least.) ISTM that this works for lists of any size, including empty ones.
No, that *doesn’t* cover the empty set. You can’t talk about something
like relative smallness when there are no comparisons to be made! It
only makes sense for numbers (for now, so as long as you neglect that
there are different sizes of infinity) because you have a pre-defined
range. For other data types, that’s not always the case. And the root
of my argument is *still* that it is wrong to return a value in the
range of valid input values if that value was not *actually* one of the
input values.
> > They are all fabricated. Done so to reflect their respective identity
> > element, sure, but all of them are equally *wrong* behavior from a CS
> > perspective.
>
> So it seems reasonable to you that
>
> sum(filter(isOdd, ints)) + sum(filter(isEven, ints))
>
> could have different behavior than
>
> sum(ints)
>
> knowing that `ints` is a non-empty list of integers, and every one
> matches either `isEven` or `isOdd`? To me, that's ludicrous.
I have no idea what behavior you’re trying to claim is ludicrous.
Again, from a CS perspective everything you say is ludicrous if you
don’t define what the actual behavior is intended for all of those
functions, including error conditions.
> > Internally, yes, they are useful in the way that many other hacks are
> > useful. But it is not the sign of a competent developer to architect a
> > library that *always* returns valid results like that.
>
> Sure, let's all sporadically returns some invalid results. We like to
> keep our users on their toes, right? WTF?
I’m arguing exactly the opposite, and I think you know that. Being
intellectually dishonest is not the way to make your case.
> In other words, I've been around. And yet, you seem to feel that you
> know my skill level based on a disagreement about one function, one which
> a number of other smart people on this thread are suggesting similar
> things as me. That makes me wonder if you're just trolling, or if you
> simply don't understand software design very well.
The more you keep trying to make an appeal to authority, the more you
undermine any authority you attempt to claim. Same goes for calling
people “smart” just because they agree with you. You’re all wrong
from a CS perspective, and it just makes me think any code you’ve
written is a nightmare to actually use. You’d do yourself and everyone
else a big favor if you could just admit to architectural mistakes like
this, and work to *fix* the problems rather than puffing your chest
out in interviews by way of silly trick questions.
> Javascript *is* amateur hour if you're coming from Haskell, LISP, OCaml,
> or some well-designed language.
Well, OK, we can agree on that. :-) But I’m not willing to accept
that it must continue to be this way. As a competent programmer,
certain *I* would mark this kind of behavior as a bug.
> > It seems I do know better, though. And, worse, I happen to know from
> > *experience* that your approach of just letting everyone do what they
> > want willy-nilly results in exactly what I said: an utter mess.
>
> Are you going to even let them determine how to order their elements? Or
> do you think you know better than them about that too?
Maybe I do. It depends on the system I’m architecting. For example,
I have some concurrent code that implicitly orders operations to
insure an object’s consistency. The last thing I want is someone
thinking they can get the length of an array *before* all the objects
have been added to it!
> You seem to be saying that this is perfectly reasonable:
>
> Ord a :: {
> lt :: (a, a) -> Bool,
> eq :: (a, a) -> Bool
> }
>
> But one that offers additional optional elements of `bottom :: a` and
> `top :: a` is ridiculous. I simply don't see why.
You haven’t defined what any of those operations *actually* mean, so
I can’t comment on any of it, and it is presumptuous of you claim I
would say anything about it. Ask a question of me if you have one;
don’t just create straw men.
> > My math is fine. It’s your computer science that isn’t up to snuff.
>
> Nope, try again.
Man, I *do* keep trying. I think that’s my mistake here.
> I think you're missing the point.
>
> Badly.
>
> -Infinity is a number.
Exactly the point I’m making. It’s a number that didn’t exist in
the input set, but it is being returned in the output set. As a
result, it makes any operations that follow it which *do not* have
-Infinity as the identity element *completely unreliable*.
> > Many other languages define similar operations more abstractly on
> > collections.
>
> Yes, they do. Now, if I were to interview you for a job, and were to
> say, "This is something of a trick question. Most people find it a
> surprising fact that Math.max() < Math.min(). Can think of why it might
> be so?" and then started to guide you through it, would you try to answer
> my question and engage in the problem at hand, or would you try to
> convince me that TC39 or Brendan Eich or whoever had fallen asleep on the
> job by not trying to make this a more generic function?
Because my background is AI, I also have a lot of experience with
psychology and theory of mind. As a result, I can tell you it’s a
mistake for you to think that I should think that the problem you
assigned is the problem you want solved. My experience in collecting
requirements and architecting solutions has made it clear to me that
getting at the *actual* problem to be solved is very much more
important than solving the surface problem that everyone *says* they
want to solve.
So, no, I’m not really sure *what* you’re really trying to get at when
you present a trick question. Do you just want me to agree that it is
the correct result? Do you want me to agree that code *you* write
should also be given a pass when it fails to give expected results for
a < operation? Do you want me to come up with an implementation that
gives a better result? Do you expect me to not see the bear that is
walking through the room?
> Because, believe
> me, while I might find that discussion interesting, I would also notice
> that you don't seem able to work on the problem assigned.
So stop with the pretense you’re looking for skilled developers. You
really want people who agree with you, don’t think too much, keep
their heads down, and just code what you tell them to code. No doubt
that has allowed you to surround yourself by people who make you feel
good about yourself, but you do both yourself and the company you
work for a *huge* disservice by not willing to be challenged when
you’re wrong.
> It's come up on this thread, and I work with a number of functional
> programmers for whom this is totally natural... for numbers. You're
> trying to abstract in a way that I find interesting, but not relevant to
> a discussion of the function `Math.max`.
I argue it *is* relevant because the identity element is only
meaningful on a per-function basis. Even if you stick to
mathematical functions, it is wrong to treat it as a useful value
in future calculations.
> > That’s just it: for an empty list, abstractly, there is no “type” of the
> > nothing it contains. The behavior you choose has to be consistent with
> > all kinds of objects. So, sure, it might make the most sense to raise
> > an exception, even for functions like sum() that might otherwise
> > commonly return a 0 value for numbers.
>
> That is only a concern if you are writing a generic `max` function. I'd
> actually be curious to see one you wrote. The more I think about it, the
> less trivial it seems.
Welcome to computer science. It’s a shame you’ve done so much work
in the field before realizing that not everything is simple numbers,
and that complex things are not easy to do.
> It sounds like a big job. Do you already have an implementation at
> hand? If not, do you think this is a simple task?
Yeah, I do. But so do *many* existing programming languages. It all
starts with getting your head out of the mathematical clouds. Until
you’re willing to do that, and actually talk about the useful work
that these functions are intended to do, the details don’t matter.
> If you cannot discover how something works, I don't want you on my team.
> Even if you could design something better from scratch, you're no good to
> me if you can't go in and understand what others have done in the system.
As I have said, understanding bad code is trivial. You’re not doing
a very good job of filtering candidates if you simply are looking for
them to determine *how* something got done badly. The biggest flaw
you have is that it does seems that that *is* all you really want
though, and you count it against a person if they actually want to
write better software. I mean, I certainly *could* “discover” how
to do all sorts of *awful* things in this world, but if that’s the
kind of team you’re really looking to put together, then I don’t
want to be on it.
> That doesn't mean that I don't want to know about how much better you can
> do. But if you can't understand existing code, I probably won't trust
> your designs anyway, because I have no idea if you really understand the
> requirements and the constraints.
But I have no idea whether or not *you* understand them. I’ve seen
a lot of effort wasted because clients keep insisting on getting what
they *want* rather than taking a step back and thinking about what
they really *need*. The more you try to make it about “existing
code”, the less I think you’re interested in actually solving the
problem the code was written for in the first place.
--
"Also . . . I can kill you with my brain."
River Tam, Trash, Firefly
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How would you prepare for javascripting interview? justaguy <lichunshen84@gmail.com> - 2016-07-18 09:10 -0700
Re: How would you prepare for javascripting interview? Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2016-07-18 18:37 +0200
Re: How would you prepare for javascripting interview? justaguy <lichunshen84@gmail.com> - 2016-07-18 11:09 -0700
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-07-21 01:04 +0000
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-07-21 14:24 +0100
Re: How would you prepare for javascripting interview? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-23 16:25 +0200
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-07-23 15:56 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-03 19:39 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-04 15:56 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-05 00:06 +0100
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-05 14:49 +0100
Re: How would you prepare for javascripting interview? $Bill <news@todbe.com> - 2016-09-05 10:01 -0700
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-06 09:36 -0700
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-05 15:05 +0100
Re: How would you prepare for javascripting interview? Andreas Bergmaier <andber93@web.de> - 2016-09-05 20:31 +0200
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-06 15:15 +0000
Re: How would you prepare for javascripting interview? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-09-06 19:40 +0200
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-06 19:25 +0100
Re: How would you prepare for javascripting interview? Andreas Bergmaier <andber93@web.de> - 2016-09-06 22:16 +0200
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-07 17:17 +0100
Re: How would you prepare for javascripting interview? Andreas Bergmaier <andber93@web.de> - 2016-09-07 20:07 +0200
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-08 14:36 +0100
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-05 18:46 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-05 20:32 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-05 17:27 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-05 20:12 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-06 16:48 +0000
Re: How would you prepare for javascripting interview? Andreas Bergmaier <andber93@web.de> - 2016-09-06 19:56 +0200
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-07 20:16 +0000
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-07 10:01 -0700
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-07 20:21 +0000
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-09 11:41 -0700
Re: How would you prepare for javascripting interview? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-09 15:35 -0700
Re: How would you prepare for javascripting interview? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-09 20:40 -0700
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-10 15:12 +0000
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-12 11:14 -0700
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-13 21:07 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-06 16:20 +0000
Re: How would you prepare for javascripting interview? Ken Tilton <kentilton@gmail.com> - 2016-09-05 11:37 -0700
Re: How would you prepare for javascripting interview? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-09-06 19:26 +0200
Re: How would you prepare for javascripting interview? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-08 12:41 -0700
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-05 20:37 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-05 22:13 +0100
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-06 02:33 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-06 16:02 +0000
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-06 09:50 -0700
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-07 01:36 +0000
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-07 10:07 -0700
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-10 00:03 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-10 00:12 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-10 15:34 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-11 01:32 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-12 19:26 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-13 01:02 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-13 21:38 +0000
Re: How would you prepare for javascripting interview? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-09-14 00:56 +0200
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-15 15:09 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-14 00:47 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-15 15:34 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-11 02:45 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-12 19:10 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-12 21:06 +0100
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-07 03:12 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-07 19:53 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-10 02:14 +0000
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-10 11:25 +0100
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-10 15:49 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-10 18:39 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-11 02:45 +0000
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-11 16:23 +0100
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-12 20:32 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-12 18:49 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-13 00:27 +0000
Re: How would you prepare for javascripting interview? Tim Streater <timstreater@greenbee.net> - 2016-09-13 08:51 +0100
Re: How would you prepare for javascripting interview? Jon Ribbens <jon+usenet@unequivocal.eu> - 2016-09-13 12:33 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-14 01:17 +0000
Re: How would you prepare for javascripting interview? Tim Streater <timstreater@greenbee.net> - 2016-09-14 11:15 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-15 15:02 +0000
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-13 10:06 +0100
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-06 19:53 +0100
Re: How would you prepare for javascripting interview? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-18 22:30 +0200
Re: How would you prepare for javascripting interview? justaguy <lichunshen84@gmail.com> - 2016-07-18 14:56 -0700
Re: How would you prepare for javascripting interview? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2016-07-19 16:01 -0300
Re: How would you prepare for javascripting interview? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2016-07-19 16:16 -0300
csiph-web