
Tom, Dick & Harry - ubasu
http://www.jasq.org/2/post/2013/01/the-mathematician-the-monoid.html
======
dxbydt
Author here. Story is loosely based on my real life. As in, I was/am the
Harry. At bofa, my previous employer, I tried to be a nice quant & find math-y
solutions to what turned out to be plain accountancy problems that a simple
nested sql query or a stored procedure could have solved.

So I quit, and here at my current employer, once again I mess around with
monoids, rings & vector spaces, though I'm not really sure how any of this
adds to my employer's bottom line:)

Matter of fact, my latest pull request (<http://bit.ly/14EXMaA> ) allows you
to do weird shit like

    
    
          add("twenty three", 
               "two million three thousand four hundred fifty five")
    
      to get "two million three thousand four hundred seventy eight", because add is defined like so -
    
          def add(a:String, b:String):String =       EnglishInt(EnglishInt(a).asInt+EnglishInt(b).asInt).get

~~~
taylorbuley
Thanks for sharing your story.

> Tom was a PHP/JS programmer. He worked on rapidly prototyped web-apps and
> didn't give a rat's ass about efficiency.

Although I'm happy you quit and did not get fired, know this now does pull
some of the poetry out of the above line, which I had previous read as some
sort of backhanded a compliment given the other (fictionalized) ending.

Perhaps I'm being overly-sensitive but Harry comes off as really looking down
your nose at "good enough". For example, there certainly seems no love lost on
you and Tom fictionalizing (?) the character as Dick's "secretary."

------
tikhonj
You'd think a reasonable math person--or any halfway competent programmer--
would not throw in a call to math.random in the definition of their monoid!
(Or, really, deep inside any normal code at all.) He deserved to be fired just
for that :P.

Anyhow, if we're playing at parables, chances are Harry took advantage of the
job market and his knowledge and went to work for a trading shop or hedge
fund, making more money than any developer at the old company (150,000,
really?) and not being hated for knowing stuff. And hopefully using a nicer
language like Haskell or OCaml.

Also, if Dick's a "systems" programmer, chances are his code would actually be
written in C, longer than the monoid Scala code and harder to read. It _would_
be fast though.

~~~
darkrho
I agreed. Harry can't talk about a Monoid with that non well-defined function.
He deserved to be fired :D

(As I pointed out in my comment: [http://www.jasq.org/2/post/2013/01/the-
mathematician-the-mon...](http://www.jasq.org/2/post/2013/01/the-
mathematician-the-monoid.html/#comment417394799938876705))

------
astangl
Am I the only one who finds the requirement ambiguous?

Oldest guy who has been at the company the longest time? If I got a
requirement like that I would first push back for a clarification, i.e., if
employee A is older but employee B has been with the company longer, which is
more of a candidate for elimination?

------
atto
Interestingly, Dick's code is by far the fastest using those implementations.
For a sample size of 1,000,000 employees (to highlight the efficiency
difference):

Tom (sorted version): 1510ms

Dick (min-linear version): 113ms

Harry (monoid version): 995ms

~~~
graue
If it's fair for you to benchmark this, it's surely also fair for me to point
out that in a lazily-evaluated language (Haskell!), Tom's approach is O(n) and
equivalent to Dick's. :)

~~~
fusiongyro
That's true if you pick the right sort algorithm. I'm not sure if it is true
of whatever happens to be in Data.List; I wouldn't be surprised either way.

------
kerno
If the point is that Harry solved the problem but failed to consider the
politics of the solution, and so was fired, wouldn't it make more impact if he
was the only one to declare that the Boss should be fired, instead of all
three of them doing so?

If that isn't the point, then I don't know what the point is meant to be.

~~~
bengillies
I believe the point is that he was fired because he spent a full day coming up
with a complex solution to a trivial problem and that when he eventually did
arrive at a solution, it was impossible for everyone else to understand and
verify.

~~~
yen223

        "Well", Harry said, "If you are asked to add 
        two employees, return the guy who is older. But 
        if both of them are the same age, then return the 
        guy who has been with the company  the longest. 
        But if both guys have been working for us for the 
        same number of years, then return the guy with the 
        lowest salary. But if they both earn the same as 
        well, then just randomly pick one over the other"
    

I didn't think that was very hard to understand or verify.

~~~
jpatokal
Except the obvious: why the hell is he "adding" employees, and what does that
even mean?

~~~
nilkn
Who knew there was such a bias against mathematics on Hacker News?

The basics of abstract algebra need to be disseminated more widely. These are
not hard concepts.

Adding employees means exactly what it was defined to mean in the article.
It's an associative binary operation.

~~~
jpatokal
Since my point obviously flew straight over your head: the problem is not
whether _we_ understand monoids, or even that "Harry" used monoids to solve
the problem, but that he's using completely inappropriate terminology to try
to explain his solution to non-technical people.

~~~
nilkn
Actually, he's using completely appropriate terminology. Your mathematical
education is just sufficiently limited that you don't know that. Rather than
getting angry, you'd think your reaction would be to absorb the new
information.

To me, your complaint is like someone saying it's inappropriate terminology to
discuss time complexity in big-Oh notation, because we're programmers, not
mathematicians.

------
unreal37
I was hoping this was someone who actually thought that was a good idea, not a
dig at math nerds who know what a monoid is.

~~~
cheald
At least one moral of the story is "Clever solutions are bad when a less
clever solution can accomplish the same task".

~~~
pyre
The 'clever level' of a solution doesn't necessarily speak to it's
maintainability which I would consider one of the strongest things to
consider.

------
randallsquared
After the title switch, this link is essentially opaque. This has to be
automated. No one would carefully consider whether this title was more
informative than the preview title and decide it is.

~~~
ColinWright
Out of interest, what was the original title?

~~~
randallsquared
I don't remember exactly, since it was a paraphrase of something in the
article. It was close to "Fire the oldest guy who has been at this company for
the longest time and is still not making six figures."

Now, admittedly, it's a little baity in that people who click might expect an
age discrimination screed, rather than a programming parable. But even so, I
think it's obviously better than "Tom, Dick and Harry".

~~~
ColinWright
Thanks

------
officemonkey
>Fire the oldest employee who is not making six figures

And, if you're in the U.S. and the employee is over 40 years old, you
automatically set yourself up for an age discrimination suit.

~~~
yareally
While I agree that is what is supposed to happen, it rarely does. My father
worked for a company for 30 years and was fired for age discrimination (his
reviews were always good, well liked at the company). He basically wrote
everything there was for training new employees at the company as well and was
the head of their training department.

However, they brought in a new HR director and CEO that wanted to "shake
things up" and the HR guy had a buddy from his former company that wanted to
come in and work with him and happened to do a similar job that my dad did.
You can probably guess what happened next, my father was fired without much of
a reason. Those in executive positions that could have stood up for him were
either in the minority or retired, so he had little help to back him up.

My family pushed him to sue, but he felt pressured into taking their severance
package because he had to support my brothers and my mother and was worried
about his prospects of getting a job in his 50s at another company (despite
having a Bachelor's and Master's degree from well-known schools). He ended up
taking the severance and waived his right to sue (at least according to the
agreement he signed). He was also afraid that suing would blacklist him from
employment elsewhere and it was hard for him to bring himself to sue the
business he once loved. Coming from the age when many were loyal to their
companies, even if the company was not loyal to them, he just couldn't do it.

Since then, he's applied at numerous employers for similar jobs to his own as
well as other ones he could segue into. However, no one wants to hire him
basically because of his age despite no intentions of retiring anytime soon.
Now, he works a low wage job he could get without a degree from a university
and it just kills me to see him like that. My only wish is to eventually grow
my own business enough I can hire him myself so he can do something more
respectable. He's not a huge tech guy like me so getting him into software
development with me is a bit more than possible, but he's a smart guy that
would fit into many other business and training related roles. However, those
roles are something I can't pay for when I'm either working for clients, my
own projects or with a friend right now.

Although age discrimination is against the law in the US, it's much more
complex than it appears for most cases and suing is a difficult question that
could hurt as much as it could help. I've always been reluctant to talk about
my father's ordeal, but I felt I had to get it off my chest at some point.

edit: few grammar errors

~~~
officemonkey
True, most discrimination suits are not cut-and-dried, but a document that
says "Let's fire the oldest worker that makes less than six-figures." is the
smoking gun most cases salivate for.

------
mquander
The sample code doesn't show up for me, but I don't agree that using foldl is
some kind of weird egghead solution. You don't need to know about monoids in
the abstract to write that code.

~~~
jvm
You may need to unblock scripts from jasq.org.

------
myhf
It seems like all of the programmers interpret the business decision
backwards. Doesn't the company want to eliminate the biggest cost center
(greatest salary under $100k), not the smallest cost center (least salary over
35 years old)?

~~~
matwood
Maybe in a small company. In a company with any size the difference of 20k-30k
isn't very much in the overall scheme of things. Generally what a company will
do at that point is keep the more senior employees with the assumption that
they know more and are more likely to keep things going with less help.

------
javert
I feel like the punch line was ruined. Harry should have been the employee
whose number was selected.

The boss thing is cool, but it just doesn't fit with the suspenseful and
ironic narrative that is being set up.

------
ajross
Hm... I read through this twice before it occurred to me that it was sarcasm.
Does it say more or less of me that I really wanted there to be some deep
truth in there about monoids or foldLeft()?

------
daenz
None of the sample code is rendering for me.

------
yen223
If it were the company I'm working in, the problem neatly reduces to "Fire the
oldest engineer".

------
tomcoates
I'm sorry, this may sound like a stupid thing to say given that I understand
absolutely nothing about the maths involved in this joke/parable/whatever-the-
fuck-this-is, but seriously, "Fire the oldest employee who is not making six
figures?!" I must be missing, something, right? Seriously? Please god someone
explain to me how this isn't as unbelievably dickish as it sounds.

What sort of terrible, euthanasia-based, Logan's run-like, horrific fascist
company are you describing in this bizarre little parable, and how come more
of you people aren't looking at this with horror?! Are you so interested in
the maths that the fact that the narrative surrounds it is so completely
fucked invisible to you?! It's like a bloody survivalist post-apocalyptic
zombie horror company. I'm surprised none of you are advocating mulching the
thirty-five year old and using him to fertilize the office plants!

Why don't we shift it around a bit, Republicans are a bit dumb, right? And
they care about money a lot. So if they're not earning 100k, they're
definitely shit! Or maybe women? Not many of them are engineers, so clearly if
they're earning too little, it's probably because their breasts get in the way
of the keyboard.... Oh hang on, no, those things I just said were crazy
insane. Like firing a thirty-five year old who doesn't earn very much.

There are people in the world who don't want loads of responsility, don't want
to rise up a company and still do good work. People who want to spend time
with their family and not work twenty-four seven and still do good work. There
are people who are valuable holders of institutional knowledge, but are
content to be junior engineers or whatever. If they do a good job, who the
fuck cares how old they are?! How is that even relevant?!

And while we're at it, have you ANY idea how entitled this makes engineers in
Silicon Valley sound?! I mean, engineers in the rest of the US don't make half
as much money as the ones in the Bay Area. Even in London, a very expensive
city, most engineers are not earning the equivalent of $100k within a few
years of leaving college.

This story and the responses to it WEIRD ME OUT. It sounds like something that
young dicks in the banking industry would talk about to make themselves feel
really important. "Yah cos like he was only bringing home like three-hundred
grand and he was like thirty five, so what a loser, right? Ha Ha. We totally
got him fired and laughed at him because he's like totally old and by the time
I'm thirty five, I'll be totally different because I'm really amazing and
special and important, right??"

This whole thing is so depressing. Ive been wondering to myself for a while
why it is that such a large proportion of twenty-somethings in tech around SF
behaved like such idiots, and this has made me wonder even more. I'm halfway
seriously thinking after reading this that all sensible companies should start
thinking about how you should always fire any engineer under thirty earning
more than 100k because, lets face it, they're fucking precious, self-
important, entitled, whiny little unproductive fuckers who can't keep their
genitals to themselves, get drunk too often during the week, and who've never
had to do an honest days work for a reasonable salary and will remain smug,
boorish twats until the day a proper grown up gives them the spanking they so
clearly need.

~~~
dylangs1030
Hey...relax. It was a thought experiment. No need to blast it.

What you are apparently so shocked by, and what you describe as "unbelievably
dickish," is actually fairly common throughout the United States. A concurrent
problem is the difficulty older people have in finding jobs after such a
thing.

Do I agree with it? No, I'm not saying that. But your other examples are much
more outlandish and, frankly, not on the same level of injustice. You seem to
be crying out against this with the same passion that consumed many people
during the Occupy Wall Street protests - this has been happening for a long
time, it's not a recent development, and just now you are demonizing it to a
much greater degree than it needs to be.

Again, I'm not saying you should be happy about it. But your parallel examples
aren't parallel at all. It's age discrimination, yes, but what are you
changing by posting this huge rant? And whose mind are you changing?

The author of the blog post wasn't trying to implicitly advocate for ageism.
He wasn't make it a de facto axiom of proper business protocol just because he
included it in his example. It's just a real world example.

My underlying point here is, in your shock at what is really a common
phenomenon, you seem to have missed the point of the post itself. In fact, you
have the opposite reaction...it was actually supposed to be a bit amusing, my
friend.

------
gsg
Of the three solutions, minBy is the only one likely to handle the empty
sequence/database case at all gracefully. Returning a fake "zero" is
particularly awful.

It probably doesn't matter much since it's a throwaway problem and the
database is known not to be empty, but it bugs me.

------
Kiro
10,000 employees all making over $85,000? Where do I apply?

------
jbrichter
Real math majors find all this weird category-theoretic jargon in programming
pretty dumb. Just so you know.

~~~
tikhonj
Real math majors are also some of the last people I'd ask about programming--
if they care about it at all, it's just as a means to an end.

If a math major was interested in programming itself, in the meaning of
programs or in neat abstractions for programming, they'd be in theoretical CS
instead.

Do real math majors find the category theory in physics pretty dumb too?

~~~
jbrichter
Yeah, this is basically my point. You're more likely to find Harry's kind of
silliness among CS people than math people.

~~~
fusiongyro
"No true Scotsman" and all that. The dual major in my FP group is the only one
besides me that cares about category theory. The rest are CS majors and don't
care. Just so you know.

