4

I was wondering whether it is possible to give any advice as the the maximum number of lines of code at which one should consider switching from say MATLAB to a more low level language?

Is it even the case that at a certain point it makes more sense to manage a certain degree of complexity of a given program in a proper object oriented language rather then MATLAB?

I should say I am a newbie in both MATLAB and Java, so I have no hidden agenda in this question even though I m aware of the heated discussions that people sometimes engage in over whether MATLAB is a proper programming language. I'm not experienced enough to even think about participating in such an exchange and I'm just looking for advice whether there is a cut off point where one really needs to go to a different language?

Also I should add I understand the code may become longer when you move to lower level, however I was under the impression that object oriented programming makes it easier to manage the complexity of bigger programs. (Maybe lines of code was a bad choice as a proxy for complexity?) Is the choice of low vs. high level just one of performance? (which in the end you have to pay for with a bigger programming task at your hands for the low level language?)

gnat
  • 20,543
  • 29
  • 115
  • 306

5 Answers5

3

Why not use both? With a Java-to-Matlab API you can use all the algorithms and visualizations of Matlab, but still design using features of an OOP language.

Although, it's always nice if you can avoid mixing languages, multiple languages can give you the best of both worlds. On the web, multiple languages is almost a given.

Garrett Hall
  • 2,192
2

Is it even the case that at a certain point it makes more sense to manage a certain degree of complexity of a given program in a proper object oriented language rather then Matlab ?

No.

Avoid thinking of languages as "proper" or "improper". Languages are just tools to solve problems. For a given problem, some will be more effective than others.

Is the choice of low vs. high level just one of performance ?

Mostly yes. Ceteris paribus, it is less expensive to formulate a solution in a higher-level language. Performance and other considerations may make it less expensive to deploy a solution written in a lower-level language.

kevin cline
  • 33,798
1

There's really no absolute threshold in terms of lines of code. Matlab provides functions that would required a LOT of Java code to mimic, specially for matrix manipulation. However, if you are not taking advantage of them, complexity may be higher than Java and it's going to be slower.

Diego
  • 111
1

I do not think it has to do with the number of lines of codes because in case of Java and most probably MATLAB, a number of lines can be automatically generated.

I think you should take in consideration other criteria like:

  1. How much time is going to take in the given language ?
  2. Should I have to write all the algorithm or some parts of the algorithm is already implemented by the language ?
  3. Am I going to plot my results in a graph ?
  4. Do I want to share the algorithm dynamically with others ?

The list is probably not complete

Rook
  • 19,947
Amine
  • 211
0

The only reason to ever switch a language after even one line of code is that the language being used can't do what you need it to do. With the single exception of no one knows how to use the language something is written in.

Ryathal
  • 13,486
  • 1
  • 36
  • 48