As a software developer, the less ambiguous your notation is, the better it is for everyone involved. Not only will I use brackets, I'll split my expression into multiple rows and use tabs to make it as readable as humanly possible. And maybe throw a comment or 2 if there's still some black magic involved
As a professor said, most programming languages don't care about readability and whitespace. But we care because humans need it to parse meaning. Thus, write code for people, not for the machine. Always assume that someone with no knowledge of the context will have to debug it, and be kind to them. Because that someone might be you in six months when you have completely forgotten how the code works.
Exactly. You read code way more times than you write it, so it makes all the sense in the world to prioritize readability.
Source code is for humans, then the compiler turns it into code for machines.
Python forcing end of line and tabs kinda does. Add Black auto-formatter and it's pretty good.
Yep, if you're writing code for a machine, just do it in binary to save compilation time (/s just in case). Also, you in six months will indeed be someone with no knowledge of the context. And every piece of code you think you write for one-time use is guaranteed to be reused every day for the next 5 years
And every piece of code you think you write for one-time use is guaranteed to be reused every day for the next 5 years
This. Always be kind to your future self.
I had someone submit a pull request recently that, in addition to their actual changes, also removed every single parenthesis that wasn't strictly necessary in a file full of 3D math functions. I know it was probably the fault of an autoformatter they used, but I was still the most offended I've ever been at a pull request.
Autoformatter? More like obfuscator
I genuinely hate being human for this stuff. So many things have such crazy computational shortcuts, it's sometimes difficult to remember which part represents reality. Outside of the realm of math, where "imaginary" numbers are still a touch of enigma to me, so many algorithms are based on general assumptions about reality or the specific task, that the programmatic approach NEVER encapsulates the full scope of the problem.
As in, sometimes if you know EXACTLY how a tool works, you might still have no idea about the significance of that tool. Even in a universe where no one is lazy, and everyone wants to know "why?", the answers are NOT forthcoming.
I, my head, shake.
- RPN user
Also known as: Japanese speaker
Also works if you dont trust yourself with correctly ordering your operations.
(I used(LISP)one time(and it(permanently))changed the way I (program(computers)))
This is why every calculator should be a RPN calculator.
I still have my HP 48 series calculator. It's a sturdy beast.
Improved readability is always good
(‿!‿) (‿O‿)
( . ) ( . ) ( . Y . )
The underlying truth of this joke is: Programming syntax is less confusing than mathematical syntax. There are genuinely ambiguous layouts of syntax in math (to a human reader that hasn't internalized PEMDAS, anyways) whereas you get a compilation error if ANYTHING is ambiguous in programming. (yes, I am WELL aware of the frustrations of runtime errors)
Internalized PEMDAS without knowing it's literally the same thing as BODMAS is exactly the problem!
My calculator says -2² = -4, so yeah...
Isn't the "-" order of operations the same as a multiply ? I think I learned powers take priority over the "-" so your calculator would be right.
But either way if it can cause confusion you should use parentheses.
I feel this in my bones
I've never seen a calculator that had bracket keys but didn't implement the conventional order of operations.
But anyway, I'm on Team RPN.
https://plus.maths.org/content/pemdas-paradox
Even two casios won't give you the same answer:
https://plus.maths.org/content/sites/plus.maths.org/files/articles/2019/pemdas/calculators.png
I just used the calc on window.. it cannot respect order of operation. Any simple calculator from 1980 was better than that
I recall that there is a myriad of memes of the form 'what is 4-2*3' under which there is always a never ending discussion of confidently incorrect dumbasses denying the existence of the multiplication before addition rule.
So your suspicion is at least not unreasonable
Science Memes
Welcome to c/science_memes @ Mander.xyz!
A place for majestic STEMLORD peacocking, as well as memes about the realities of working in a lab.
Rules
- Don't throw mud. Behave like an intellectual and remember the human.
- Keep it rooted (on topic).
- No spam.
- Infographics welcome, get schooled.
This is a science community. We use the Dawkins definition of meme.
Research Committee
Other Mander Communities
Science and Research
Biology and Life Sciences
- !abiogenesis@mander.xyz
- !animal-behavior@mander.xyz
- !anthropology@mander.xyz
- !arachnology@mander.xyz
- !balconygardening@slrpnk.net
- !biodiversity@mander.xyz
- !biology@mander.xyz
- !biophysics@mander.xyz
- !botany@mander.xyz
- !ecology@mander.xyz
- !entomology@mander.xyz
- !fermentation@mander.xyz
- !herpetology@mander.xyz
- !houseplants@mander.xyz
- !medicine@mander.xyz
- !microscopy@mander.xyz
- !mycology@mander.xyz
- !nudibranchs@mander.xyz
- !nutrition@mander.xyz
- !palaeoecology@mander.xyz
- !palaeontology@mander.xyz
- !photosynthesis@mander.xyz
- !plantid@mander.xyz
- !plants@mander.xyz
- !reptiles and amphibians@mander.xyz
Physical Sciences
- !astronomy@mander.xyz
- !chemistry@mander.xyz
- !earthscience@mander.xyz
- !geography@mander.xyz
- !geospatial@mander.xyz
- !nuclear@mander.xyz
- !physics@mander.xyz
- !quantum-computing@mander.xyz
- !spectroscopy@mander.xyz
Humanities and Social Sciences
Practical and Applied Sciences
- !exercise-and sports-science@mander.xyz
- !gardening@mander.xyz
- !self sufficiency@mander.xyz
- !soilscience@slrpnk.net
- !terrariums@mander.xyz
- !timelapse@mander.xyz