7 ms·
Tom, Dick & Harry
- unreal37 14y agoI 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 14y agoAt least one moral of the story is "Clever solutions are bad when a less clever solution can accomplish the same task".
- pyre 14y agoThe 'clever level' of a solution doesn't necessarily speak to it's maintainability which I would consider one of the strongest things to consider.
- speednoise 14y agoThe author mentions that he was Harry in another comment, so a little of both
- ajross 14y agoHm... 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()?
- kerno 14y agoIf 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 14y agoI 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.
- rbehrends 14y agoAnd the fact that it being a monoid is actually irrelevant to the solution. It is a lattice with an artificially created lower bound [1], which does induce a monoid structure via its join operation, but by thinking about it as a monoid, you abstract out the one relevant property (ordering!) that you actually care about. [1] Assuming that there aren't any duplicate elements, in which case it technically isn't either a lattice or a monoid, unless you consider equivalence classes modulo attribute equality.
- yen223 14y ago"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 14y ago
- tikhonj 14y agoYou'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.
- groby_b 14y agoIf Dick is a systems programmer, his code would look pretty much exactly like Harry's, except he'd call it a priority queue of capacity 1. And he'd have written it over breakfast, while Harry was still pondering the side problem of analytically defining the volume of his bath tub :)
- jQueryIsAwesome 14y ago> 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! Yeah, just pick 'a'; if he was in the database before 'b' chances are that he is the one who has been with the company for the longest time; and if that's a lie then is just as random as math.random anyway.
- darkrho 14y agoI 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-monoid.html/#comment417394799938876705 http://www.jasq.org/2/post/2013/01/the-mathematician-the-mon...)
- myhf 14y agoIt 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)?
- rickyc091 14y agoHa, you'd think right? I think the reason the oldest, lowest salary employee was fired first was because he/she would have made the least contribution to the company. If that employee had done a great job, then he/she should technically have the highest salary.
- matwood 14y agoMaybe 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.
- dxbydt 14y agoAuthor 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 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 14y agoThanks 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."
- atto 14y agoInterestingly, 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
- greendestiny 14y agoI don't think the point is the implementation itself, just what the author finds interesting in a problem. After all the 'plus' operator just does a series of ordered comparisons like the minBy solution does.
- atto 14y agoSure. However, it does represent problems I've seen before with "overly" (subject to the person, I guess) complex solutions that end up being significantly less efficient. In this case, the problem is actually the `.toSet`, which forces a second iteration of the dataset. If the Monoid class was rewritten (yes, to be less mathematically pure) to use Seqs, it's nearly identical performance (as expected) as the linear solution. Fun performance graph: http://i.imgur.com/2rOvb6V.png http://i.imgur.com/2rOvb6V.png
- greendestiny 14y agoThat is interesting. Personally I didn't find framing the original problem as monoid enlightening at all, but that's what I thought the author was getting at.
- jes5199 14y agoI find that to be pretty typical - naive solutions are bad for Big-O reasons. If you solve the math on paper and implement a straightforward algorithm, you get the fastest possible solution. If you push some of that math into the type system of your language, you get something that should be Big-O equivalent to the fastest possible solution, but the machinery of the type system never gets fully optimized away. There might be other advantages, though, of having that machinery - your compiler might be able to detect errors in your code, or you might be able to use higher-level constructs to make more concise code. Maybe.
- daenz 14y agoNone of the sample code is rendering for me.
- javert 14y agoI 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.
- officemonkey 14y ago>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 14y agoWhile 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
- mquander 14y agoThe 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 14y agoYou may need to unblock scripts from jasq.org.
- astangl 14y agoAm 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?
- yen223 14y agoIf it were the company I'm working in, the problem neatly reduces to "Fire the oldest engineer".
- jbrichter 14y agoReal math majors find all this weird category-theoretic jargon in programming pretty dumb. Just so you know.
- tikhonj 14y agoReal 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 14y agoYeah, this is basically my point. You're more likely to find Harry's kind of silliness among CS people than math people.
- fusiongyro 14y ago"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.
- tomcoates 14y agoI'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.
- gsg 14y agoOf 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.
- randallsquared 14y agoAfter 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 14y agoOut of interest, what was the original title?
- randallsquared 14y agoI 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 14y agoThanks
- Kiro 14y ago10,000 employees all making over $85,000? Where do I apply?