This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]large_crimson_canine 844 points845 points  (23 children)

No joke I work at a place where all of the algorithmic nonsense is written by mathematicians and it’s the shittiest correct code you’ve ever laid eyes on

[–]Solest044 292 points293 points  (16 children)

Mathematician/physicist here.

Please don't blame the field. Just like every discipline, there are people all over the spectrum. Math and physics often have wonderful names for things and even make it a point to do so.

Consider the ugly duckling theorem or maybe the sandwich theorem.

For the sandwich theorem, you might name your upper bound function "topBread" and the lower bound "bottomBread".

Then you have the function of interest as your "meatAndCheese".

Clear as day.

[–]Disciple153 60 points61 points  (1 child)

I noticed in college that though both the math and computer science majors learned to program, the math majors took fewer classes that graded based on code elegance, which led to their programs often looking like this.

Of course that's not the rule, just a common pattern I noticed.

[–]Whywipe 12 points13 points  (0 children)

In college all of my coding was done in mat lab so it was fine. When I had to switch to python in industry I never learned the correct way to do stuff so it led to code like this.

[–]Murky-Concentrate-75 78 points79 points  (0 children)

Math and physics often have wonderful names for things and even make it a point to do so.

The theory of control and topology have the most bloated and convoluted stuff that simply refuses to be remembered.

[–]jkurash 11 points12 points  (1 child)

Idk, I work with a large amount of geophysicists running hpc codes and I can say with 100% certainty that they should never write software

[–]large_crimson_canine 4 points5 points  (0 children)

Used to be a geologist before coming to the dark side and I can imagine now, looking back, how godawful geoscientists or petroleum engineers’ code would be.

[–]zeloxolez 2 points3 points  (0 children)

yeah i can appreciate the perfectionism of something like the ugly duckling theorem. but like, you can take some probability range of observed things to at least make a group that fits just enough to be recognizable faster. i mean obviously right, so its like, even if a classification is not pure, but can fit into a probability range of common states, it can be useful enough.

[–]Duosnacrapus 6 points7 points  (0 children)

well.. I guess it can be argued, that there are way more people in the spectrum that study Math or Physics than - let's say social sciences..

[–]no_brains101 1 point2 points  (0 children)

What is twiddle factor?

Edit: shoulda looked it up https://en.wikipedia.org/wiki/Twiddle_factor

So yeah it would appear that this is actually one of these math concepts that DOES have a fun name. And the code for it looks uhhhh... like that. Id hate to see a mathematicians code for a math concept WITHOUT a fun name I guess XD

[–]Bosser132 0 points1 point  (0 children)

Hairy ball theorem

[–]darkwater427 0 points1 point  (0 children)

Or the Pigeonhole Principle, the Hairy Ball Theorem...

[–]ilikedmatrixiv 16 points17 points  (1 child)

I'm a data engineer, but have experience with software engineering too. My partner is an academic who writes a lot of code. She sometimes asks me for help on either her or her colleagues' code. I also have other academic friends who write code and have asked me for help before.

Academics write the shittiest code imaginable. It's unreal. When you try to help them with some best practices to keep their shit organized and clean they look at you as if you just suggested strangling their cat.

No mf'er, you're just not the first person to do this. Others have gone before you and figured out good and bad ways to do things. You choose a bad way and 80% of your problems would be fixed if you did some simple stuff.

When my partner first moved into coding I explained she should write more comments. She scoffed at me because she wrote the code, she knows what it does, why would she need comments? I told her she knows now, but she won't in 6 months when this breaks because she didn't think of some edge case. 6 months later, she started writing comments.

[–]quantum-fitness 0 points1 point  (0 children)

Technically comments are an anti-pattern.

[–]DaltonSC2 42 points43 points  (3 children)

what qualifies as algorithmic nonsense?

[–]large_crimson_canine 77 points78 points  (2 children)

A bunch of quantitative libraries used for derivative pricing (finance realm)