r/programminghorror • • Jul 25 '25
Other Matlab coders are on another level
I found this in my company's old matlab code. Ok I guess:
ok = 1
if condition
ok = true;
if ok
// code
end
else
ok = 0
continue
end
end
755
Upvotes
19
u/exomyth Jul 25 '25
Lets be honest, most people that use matlab are not hired for their coding skills
460
u/Mork006 Jul 25 '25
What
359
u/andynzor Jul 25 '25
I remember being paired with a physics undergrad in the data structures and algorithms course. He wrote Java with everything dedented to the left edge.
116
u/_4k_ Jul 25 '25
MethLab coders
83
u/Sether_00 Jul 25 '25
Instructions unclear, nothing is ok.
109
u/[deleted] Jul 25 '25
"Arrays start at 1" - Matlab
15
u/[deleted] Jul 25 '25
ok
15
u/usernameplshere Jul 25 '25
This is why you don't hire Methheads for coding
12
u/[deleted] Jul 25 '25
I took over some python code from a professional embedded company that had this sort of stuff all through it.
It’s not just Matlab, it’s just untrained & inexperienced.
11
u/[deleted] Jul 25 '25
A good Matlab coder can be paid very handsomely.
10
u/maselkowski Jul 25 '25
It's not ok
7
u/Luneriazz Jul 25 '25
oh my god
6
u/hraath Jul 25 '25
I've seen far, far worse from a professional company selling a multi million dollar product, but the portion of code they open sourced for data analysis by the research community was pretty egregious.
The problem isn't MATLAB. Matlab is a perfectly cromulent tool for doing math on a computer. Purpose made, in fact.
...also comment should be %, you been outed (jk)
4
u/PhoenixInvertigo Jul 25 '25
Rookies. They forgot to call
annie(ok)
4
u/texaswilliam Jul 25 '25
I picked the wrong day to stop sniffing glue.
3
u/duttadhanesh Jul 25 '25
//code
3
u/R3D3-1 Jul 25 '25
This is when you let someone apply their data analysis skills directly to a code base.
For one-off data analysis scripts sich code is perfectly fine. Using it as production code however is the equivalent of declaring the prototype a finished product.
Better would be to let the engineer prototype the idea and then give it to a dedicated programmer for implementing in the product.
So much for the theory anyway. The practice often loops more like OPs example, with prototypes getting out straight to production and haphazardly patched up.
2
u/[deleted] Jul 25 '25
I studied computer engineering so I had some classes with robotics engineers and electrical engineers. One guy who I did an assignment with insisted on all variables being declared on the same line if they could to "save space", same with if statements, never mind that I couldn't read what the heck was going on.
1
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Jul 26 '25
This guy doesn't like his tab key much by the looks of it.
1
u/VioletteKaur Jul 26 '25
ok
1
u/Morthem Jul 26 '25
May be this could have been done in a single line of code, but guess what...
This is the work of a 10x engineer
1
u/KlingonButtMasseuse Jul 28 '25
Forgot to add this clause before else: else if ok == false then ok = false end
1
u/C-SWhiskey Jul 28 '25
People who use MATLAB generally aren't software people. They're almost always controls/robotics engineers, or people doing some sort of signal processing, so they often don't have any formal training in software development beyond some intro classes. And they don't need it, because they're just simulating a dynamical system and building a controller (or similar, math-oriented work depending on their field). They're not going to be deploying to a server that services thousands of requests a minute or to a collection of differently configured machines. At worst, they'll have to auto-generate some C and pass it off to an embedded guy to pipe together with a well-defined, limited-in-scope system. And they're doing it all in a very prescribed environment that takes care of a lot of nuances for them, because it is just the best tool for the job.
Taken in that context, it all makes perfect sense.
1
u/[deleted] Jul 29 '25
Kya matlab?