3 ms·
The documentation that you link to states that there is an "occasional misinterpretation", that sometimes people don't understand how to apply max and min corre
by uberman 7y ago
The documentation that you link to states that there is an "occasional misinterpretation", that sometimes people don't understand how to apply max and min correctly in certain situations. That is thankfully, not "most people" nor do I believe it is even some significant number of people most of the time.
People who can't understand max() probably can't see that -10 is less than -9 either. That does not make the "<" operator counter intuitive. This actually has nothing to do with CSS and to me demonstrates a crazy fundamental mis-understanding of math and logic.
For someone confused about what max() might do, you should be clearly stating that it does exactly what is expected, however you might caution a particularity novice coder that they might want to double check that they truly want the greatest of two numbers rather than the least of two numbers. Framing these functions as counter intuitive when they are crystal clear makes it more likely that a novice gets it wrong.
"That person on hacker news told me that max does not work like I expect. I should use it to get the least of two numbers"
With advice like that I guess I can see where novices might be confused. I'm sure you believe at this point that I am some sort of ass, but truthfully I would never hire someone who could not intuit what max() did.
- SimeVidas 7y ago(Of course I don’t think you’re an ass. You’re arguing your point quite well. I couldn’t ask for more.) I think you’re overestimating how flawless people are mentally. Take a look at this: https://twitter.com/mxstbr/status/1038073603311448064 https://twitter.com/mxstbr/status/1038073603311448064 This is absolute HTML and CSS basics, and yet only 43% of over 14 thousand people got it right. What gives? Are most of these voters a bunch of amateurs? I don’t think so. My explanation is that people make mistakes. Constantly. Basic mistakes. That’s part of being human. Our brains aren’t machines that produce flawless results. We forget things. We get confused. Is this a problem? Should all of these people be fired? No. As long as they can find and correct their mistakes, and produce a correct result in the end, it’s fine. The first sentence in my first reply to you was a quote from the CSS spec editor: “If that confuses you, congrats, it confuses me too, which is why I wrote that note…” This is Tab Atkins. A Googler. The main CSS spec editor. Probably one of the most knowledgeable people about CSS in the world. How is it possible that min()/max() confuses him? Is he secretly a noob that doesn’t understand basic math? My explanation is the same. He’s human. His brain doesn’t work perfectly. I am not suggesting that most people don’t understand max(). I’m saying this: * When people see something like max(80%, 200px), they get confused, even if it’s just for a moment. * I have explained in my previous comment why that is (max() + absolute value = minimum value) * Then, after they look at the code for a few seconds or more, look up max() on MDN, etc., they eventually figure it out. How many do? Most? I don’t know. But in that first moment, instinctively, most people get confused. I have wasted a bunch of time on these comments, but I’m not going to let some IQ 200 genius convince me that min()/max() isn’t counterintuitive in this specific scenario.