Tech IndustryOct 7, 2021
Newida

Does Matlab just blow?

For context I have a few years of work experience primarily in Java and Python, but have also worked with a smattering of other languages professionally. I’ve also worked with a few proprietary languages with limited documentation and it was fine. At my current position I’ve been tasked with updating, maintaining, and supporting a large pot of Matlab spaghetti and I’ve never been so overwhelmed. I can’t really untangle whether it’s just poorly written Matlab or if large Matlab applications just should not exist. It’s gotten to the point that I’ve had Tetris-effect style nightmares of trying to keep all the nested struct arrays in my head. It’s drained all the joy I used to get out of programming, and it’s pushing me out the door. Has anyone else had to work with large Matlab applications and if so is this just par for the course or my own little ring of hell? All Matlab hate welcome TC 🥜

Microsoft FAvl67 Oct 7, 2021

Matlab is the only way to go when you are at the cutting edge of academic research and there are literally only like 3 people in the world who understand what you're doing and they all use Matlab. You can technically start from scratch and build everything over again with python or something but good luck getting the funding to do that lol

Intel 09kIWHv4 Oct 7, 2021

Yes, I got a 50k+ line single file MATLAB monster once. If you can do some minor refactoring and add a few useful tests, I'm not saying it's perfect, but it gets better. If you've got Simulink spaghetti though... good luck. I understand why that exists, but Simulink brings me little joy. Also, force line limits on yourself; some of my codebase was more than a 2k resolution 32" monitor wide before I rewrote those sections. MATLAB kind of enables that horizontal creep; avoiding it also helps on the sanity front. Edit: One trick, if this doesn't need to be optimized, is that tables have more quality of life friendly syntactic sugar compared to arrays. If it's not in the actual computational part of the code, taking the performance hit can help your sanity. Also, pre-configure parallel code to pass data in and out and set up the parpool options; yolo'ing with parfor lead to more headaches than it avoided for me. For math, using the built in vectorization instead of any explicit parfor stuff is much better; I/O sometimes doesn't have an easy built-in parallel option though.

U.S. Department of Energy MemeCream Oct 7, 2021

MATLAB is industry leading for it's intended purpose. But it is not a replacement for a traditional coding language like C++ or Python, it sounds like your company attempted yo do that.

Bosch USA zzzxxxyyyw Feb 15, 2022

It is awful. There’s no real package manager to break monorepos into something more manageable. Build system is rubbish. It’s not even particularly quick at computation (slower than NumPy/pandas in Python). There are a few 3rd party things to make life better (linter/auto-reformatter/auto documentation) but it is painful supporting matlab projects