43

My code review nightmare is reviewing C++ code that was written by Matlab people. Letting them commit code without reviewing it will surely bring Armageddon, but having to watch these horrors...
Functions signature like 'void func(int arr[3])'. Nononononono.

Comments
  • 2
    Well...

    std:array<int, 3> is legit
  • 6
    @iiii Yes, but that guy used c-style array as argument, where you can't query the actual size or know that memory was really allocated for this array....*shudder*.
  • 2
    @NickyBones yeah, I understand. I just mean that it's pretty easy to correct
  • 6
    @iiii *I'm playing the narrator*

    After seeing values passed around without evidence of their allocation, lil Nicky fight her urge to imagine what's next...

    Little did she know that the memory allocation issues should be the last of her worries... Praying to Jesus, she looked at the diff stats, only to feel hopeless defeated by the 20 k plus lines of new code in the following commits of the PR.

    In two files.

    Anger overcome lil Nicky....

    Puny devs should feel her wrath!
  • 3
    @iiii It is when you do the code review. But when someone else doesn't notice and approves it, and suddenly you wake up to fucked up memory corruption bugs, and you need to track it down...Can be very unpleasant.
  • 1
    @IntrusionCM I refer to myself as lil Nicky X.
  • 4
    @NickyBones

    Don't hurt me Mistress 😱

    (I'm high as a kite, sorry xD)
  • 2
    arr... must be a code pirate matie!

    I saw the function sig and just laughed.
  • 2
    @NickyBones oh fuck... now that's an issue
  • 2
    Mathematicians aren't automatically good coders.
    That are different skill sets - even in Haskell.

    So why the fuck are the Matlab people writing C++ code?!
  • 6
    @Oktokolo There is a dangerous hybrid called algorithm developers.
  • 2
    @NickyBones
    Yes, but there aren't actually that many of them.
    And they don't need to use low level languages, so they actually shouldn't.
    When the algorithm is done, translating it into any language is the easy part. Let the actual coders do that job.
  • 1
    @Oktokolo There are enough of them to cause damage. I worked with people like that in 3 different companies.
  • 2
    @NickyBones
    Tell them to use some boring high-level language like Math, Java or Python to develop their algorithms in.
    That way, the users of the algorithm can easily translate it into whatever language they need.

    Readability is king for any reference implementation.

    So if they only can do Matlab, they should just do it in Matlab.
    Get one or two of the coders to learn some Matlab instead. They then can properly translate the algorithms into whatever language they are needed in.
    Still a lot more easy than translating poorly written C++...
  • 1
    @Oktokolo I am not important enough to tell people what to do.
  • 2
    @NickyBones
    Everyone is. Might want to do it informally though.
    They (of course) may ignore you.
    But then you at least tried.

    Chances are, nobody ever told them and they just expected C++ to be the convention or industry standard or whatever.

    May also be the case, that someone actually told them to do it that way. In that case you can spare the company a lot of money by convincing that person to drop that stupid requirement and go the translation route instead.
  • 1
    @NickyBones Wait, there is a specialization for that? Are they bad at coding?
  • 2
    @Oktokolo Even better, Matlab can export code in C. I've seen that with Simulink models.
  • 3
    @Demolishun Just guess which devs gave Fortran code its legendary bad name.
  • 1
    @Demolishun Usually it's people with M.Sc/PhD degrees working in fields like computer vision, NLP, optics, control....
    They are bad at coding because it's not their specialty, they were just ordered to do so because some higher-up manager thought it was a good idea.
  • 1
    @NickyBones that’s how C++ is taught in most Italian schools: everything C style (strings, array, malloc…) but with classes
Add Comment