Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?)

share|improve this question

migrated from stackoverflow.com Feb 15 '12 at 21:20

This question came from our site for professional and enthusiast programmers.

closed as not a real question by Robert Harvey, Justin Cave, gnat, rjzii, Walter Feb 16 '12 at 17:51

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
After writing those many lines of code in one language, I won't go to any other language, I will just finish the job :) –  Learner Feb 15 '12 at 21:21
10  
Switching to a lower-level language will increase your lines of code, not decrease them. Are you sure you understand what you are asking? There is no well-defined cutoff point. Like so many other things in programming, you have to weigh the tradeoffs involved, and make your own decision based on the information you have available to you. –  Robert Harvey Feb 15 '12 at 21:27
    
How good is Matlab support for programming-in-the-large? If you expect your project to reach a size at which $other_language is easier to extend/maintain/deploy, you should switch now before it is too late... –  comingstorm Feb 16 '12 at 1:29

5 Answers 5

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

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.

share|improve this answer
6  
Or the exception that you realize that you could do better in another language. Just because you started writing that text-processing program in C doesn't mean you shouldn't switch to Perl. –  David Thornley Feb 15 '12 at 21:34
1  
No, but the fact that you'd then be writing in Perl means you shouldn't switch to Perl! :-) –  Jerry Coffin Feb 15 '12 at 23:27