this post was submitted on 31 Dec 2023
61 points (87.7% liked)
Programming
17511 readers
274 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I definitely concur. Scientists often write functional but abominable code that follow no style-guide, no conventions, no rules, just "get'er dun" mentality. Short obfuscated variable names, enormous functions, no comments, no build instructions, no tests, no edge case handling, no modules, no separation of concerns, etc.
They often write the most job secure code on the planet.
I get it, it's because they come from a world of
f(h) = g(h) + i(h) -> assoc = 1
or whatever. Maths, physics, biology, computer science, etc. all have the most obtuse, unvarnished, terse expressions ever. They aren't teachers (most professors have no didactic training whatsoever), nor do they write stuff that has to be understood by anybody outside of their field.Especially if people from that field become researchers, only their results and number of papers for their peers count. They spend most of their time getting grant money and under pressure to release something that passes peer review.
Their entire system is more about money than actually expanding our realm of understanding and they are caught up inside of that.
IMO, the most dangerous specimens to exit that system are mathematicians as they believe maths is the purest form of science (everything is maths after all), that they are smart, logical, and can solve anything. They treat software development as a practical application of their formulas and, in my experience, see it as beneath them to follow rules they consider superficial.
Code doesn't have to readable, it has to be correct, functional, and at best pure. It's why functional languages, especially Haskell, attract them so much. There are those of course who just want something that works and feel like they're in the rat race of research.
That's been my experience anyway with making code written by scientific minds production-ready (tested, maintainable, documented, functional, extendable). It's a task I actually do wish upon my worst enemies because I want them to suffer like I did.
CC BY-NC-SA 4.0
For real, though, I wish maths in general, in all fields, adopted the way things are written in programming.
So, instead of something like:
Just write it out:
And I mean, that's still a harmless formula. I've had to learn so many formulas, where not the formulas were the problem, rather it was knowing what φ means in this field/context. So many scientific papers are just extremely hard to read for anyone from a different field, because the formulas are obfuscated like that.
And the thing is, I get that pure mathematicians don't care. Their formula inputs usually truly don't have much of a meaning beyond
a
andb
.But their conventions, in particular multiplication being implied when two random letters are written next to each other, that just fucks up the option for anyone in any other field to use legible variable names.
You're absolutely correct, and in my experience authors with physics background are even worse.
I've seen algorithms that I know by heart, understand fully and have implemented tens of times represented in such a way that I can't even recognise them.
"So many papers are extremely hard to read because the formulas are obfuscated like that"
This isn't really an issue though, of you don't have enough foundational knowledge to understand what the formula means or how it could be conceivably derived, does knowing how it's calculated matter?
I do think so, yes.
For one, not everyone needs to be an absolute expert. You do want some person with expert knowledge to sanity check what you're doing, but ultimately you'll have engineers, programmers etc. that are tasked with putting a formula into reality. If they can intuitively read formulas and more easily read up on the surrounding context, that helps a lot.
In that sense, I may also be very programmer-biased in how I read papers, but generally I prefer to look at a given formula and then read up on why it is formulated like that. Maybe I also have some form of ADS, but for the life of me, I cannot linearly read a paper front to back. And I'm not alone in that.
From computer science papers / academic texts, I know that this method of reading works perfectly fine. But if I try to delve into any other fields, it's always a matter of first decoding the formula before I can try to figure out what it means.
Ultimately, it just feels like unnecessary hindrance of understanding, even if theoretically you're just hindering those who supposedly wouldn't understand anyways.
"From computer science papers/academic texts I know this method of reading works perfectly"
This is almost certainly due to pure familiarity. CS papers are just as indecipherable to unfamiliar persons. Possibly even more since things like complexity are heavily used, without any explanation of what it is. Data structures are another common one that the vast majority of non-CS people would not understand when referenced.
I know because this is exactly how I felt coming from an intermediate mathematics background.
Your first paragraph likely also applies to many senior software developers, especially if they primarily worked in small companies / freelance.
I can see that, yeah.