views:

283

answers:

11

I've taken a course in C++ in my freshman year in undergrad. However once it was over I never employed it in any project or use. I am familiar with some average topics in C++ prior to where 'link list' starts. Once I got the opportunity to do my first project after Sophomore year, I was suggested by my prof. to learn Matlab which is widely used in mathematical and engineering projects. Now I am pretty comfortable with using Matlab for my research. But I often hear from people that Matlab is not a language and that it can't take the place of any programming languages like C++, Java, Fortran etc. I am also concerned that Matlab is hardly used in industry (any!) because of its costs and its inability to run using executable files unlike Fortran, C++ etc.

I am wanting to learn a programming language:

1) Which takes care of the above, and other, issues which Matlab lacks in many aspects.

2) Which is widely used and available in industry and research centers.

3) Which is relatively easy and quick to code, and powerful in its capabilities.

Also please:

1) Give the advantages and disadvantages (over Matlab) for the language you suggest.

2) The best way to learn it.

3) The proper sequence of topics to learn knowing that I am familiar with the programming concepts.

4) A source, which is easy, good and interesting, to learn from.

EDIT: My area is not software development or computer engineering. My purpose of learning a new language is based on engineering and mathematical projects. Though there could be some scope of development of simulation software, or integration of scripts to make some changes in already existing software.

Thanks for your suggestions.

+4  A: 

Hi,

Well Matlab is widely used in industry to do simulations and especially in R&D departments. Of course in a software company, you're not going to sell Matlab scripts if the client has nothing to do with Matlab.

I would go for Java:

1) Platform independant, easy to use. As you said, Matlab is a scripting language living in a software, so the advantages of any language over Matlab should be obvious. (If you're thinking about applications outside of the engineering / simulation world).

2) Use the language and program!

3) Take a little project and start working on it. The best way to learn is by doing it.

4) To be honest, buy a good book and use Google. In the end, that's what I would do even though one could go and talk pages and pages about what is in theory the best way of doing it.

Kind Regards,

Trefex
+4  A: 

Python.

The syntax is relatively similar to Matlab (not exactly, but fairly easy to get used to).
You also have the matplotlib python library, which gives some of Matlab's functionality while trying to provide the same API (i.e. function names etc.). This could be a starting point for you to start using Python, while staying in a familiar ground.

To learn Python, I'd recommend the Official Python Tutorial - which IMO is quite good for beginners.

adamk
If coming from Matlab, to do numerical simulations, http://www.scipy.org/ (and NumPy) could also be useful.
Bruno
Thanks for your answer.
Harpreet
+2  A: 

I would personally recommend Java.

Adv:
1) Easier to learn compared with C++
2) Powerful and up-to-date, with a lot of libraries to use and wide range of functionalities
3) It is mature and stable, suitable for research 4) very well documented disadv:
1) not the fastest kids around

The best way to learn it:
: read a book, and program with it, maybe rewrite one of your existing project

The proper sequence of topics to learn knowing that I am familiar with the programming concepts:
: again get a good book. it should be all there.

A source, which is easy, good and interesting, to learn from: : again get a good book. and Google and Java's official website

You could start another question for good Java book for beginners. I am sure you will get a lot of good answers

Viele
+12  A: 

From matlab, I would go to python.

First, I want to dispel of a myth. Matlab is used in industry. However, it isn't as common, and is pretty specific. It's often used for prototyping and proving mathematic analysis, not to deploy systems to customers. Once the smart mathematicians prove their ideas out in Matlab, it falls to developers to build a real system out of it. That real system is usually done in C,C++,Java and deployed to the customer.

But, first, ask yourself why you want to learn this language.

  • Is it just to get exposure? To learn more about programming? Almost any language will get you that.
  • Do you want to be able to quickly fire off some scripts? Python would be better.
  • Do you want to develop large scale systems that leverage every ounce of processing power at the expense of development speed? C/C++/Java would be a better path.
  • Do you want to become more attractive to recruiters? Java probably has the highest amount of "want-ads", followed by C++, then maybe Python or C#.
  • Do you want to remain in a specific industry (e.g. scientific computing)? Pick out a few companies that interest you and find out what they use in-house.

Remember, the language is not really a goal in itself, it's just a tool to get you where you're going! :)

1) Which takes care of the above, and other, issues which Matlab lacks in many aspects.

Yes, Python is an industry acceptable programming language with many great programming features - list comprehensions, duck typing, a strong standard library.

2) Which is widely used and available in industry and research centers.

It is fairly widely used, and growing. Especially for research and prototyping. Very large scale systems will still mostly be in Java or C++, but those are harder languages to learn.

3) Which is relatively easy and quick to code, and powerful in its capabilities.

This is python in a nutshell.

And:

1) Give the advantages and disadvantages (over Matlab) for the language you suggest.

Matlab has some really cool features, but as an industry programming language, I wouldn't call it top of the line. However, the syntax is probably closest to python. Python can give you true object oriented development, and has a much richer standard library to go beyond matlabs walls.

2) The best way to learn it.

Start with a tutorial and move on to coding small projects. Move up from there. Learn by doing.

I've recently taken to learning Scala (just 'cuz) by doing problems at http://projecteuler.net, and it's been fun! (for an extremely nerdy definition of fun)

3) The proper sequence of topics to learn knowing that I am familiar with the programming concepts.

Read code, read questions on StackOverflow. Read blogs and books about programming concepts - how to structure code, how to refactor, how to design, etc. Then, just solve problems you encounter. If you can, find a mentor or ask a lot of questions on SO.

4) A source, which is easy, good and interesting, to learn from.

StackOverflow. A mentor, if you have one accessible. Open source is good too.

Stephen
Thanks for your nice answer.Can Python codes be run using executable like FORTRAN or C++? It seems I would like to go for Python :)
Harpreet
Yes. You normally just run it as an executable script, but if you want to deploy it (e.g. to windows clients) you can use http://www.py2exe.org/
Stephen
Thanks Stephen. Yours was the best answer :) . As you can see the comment below which says "Python is for amateurs, C and C++ (and Matlab) are for professionals". How true is it and what is the dividing line between, if the comment is true, amateurs and professionals? To let you know I am an engineer and not a software developer or computer engineer.
Harpreet
Thanks! That comment is truly laughable. While it's true that large scale computing is done in C/C++/Java - e.g. Google's web search servers, Photoshop, MS Windows. A large part of the world is not about optimizing space and speed. "get it done fast" is quite often more important than "get it done so it's fast". It's true that Python is easier for amateurs to learn, but that doesn't mean it's not valuable to professionals. I do most of my professional work in c++, but have used python for a _lot_.
Stephen
The fact that you're not a software developer is important in that you will be using this language as a tool to get your day job accomplished, not as a product in itself. Use a language to get a task done quickly, one that comes with a significant toolbox. That's python.
Stephen
BTW: I have used all these languages in my professional experience (among others). Every language has its strengths and weaknesses. One thing is for sure, learning _anything_ will help you in the long run.
Stephen
Yes! I agree with that :)
Harpreet
I read once that Google has 3 "official" languages the most development is done with: C++, Java and Python. EDIT: link http://panela.blog-city.com/python_at_google_greg_stein__sdforum.htm
Mikhail
@ Stephen and Mikhail: Is there any website or link to lecture notes etc you know which are interesting and/or brisk in picking up Python? I just want to give some spare time learning it as I don't have full reserved time to learn from lengthy notes :D
Harpreet
Mikhail
Thanks Mikhail.
Harpreet
+3  A: 

I often hear from people that Matlab is not a language

If that's the case, then the people around you are often wrong. Matlab is a real programming language. It's never going to replace C++ or Java because they're used for different things. But Matlab works quite well for the kind of work it's designed to do.

I mostly used Matlab for calculations when I was getting my degree in physics. Now I do web-based development mostly using C# and ASP.Net. But perhaps my transition is atypical.

My recommendation is this: Find an industry you want to work for, look at the job listings, and see what languages they ask for. Then learn one of those. In my experience it's not too hard to learn enough to land an entry-level position, and then you'll learn a lot more during the course of your employment.

Tim Goodman
+3  A: 

Matlab is extremely widely used in industry for scientific and engineering computing. It has its faults, certainly, but it provides a good platform for rapid development of algorithms. I work in the oil industry with a team of research geophysicists; they all use Matlab all the time, developing computational electromagnetic codes. Defence, the car industry, increasingly the biosciences, and many others are heavy users of Matlab. Check out the job ads.

So if your sole concern is getting a job, I suggest that your next programming language should be Matlab -- it hits at least 2 of your 3 desiderata. I suspect that your understanding of Matlab's deficiencies is, in part, based on your lack of in depth knowledge of the product.

Having said all that, what do you want to learn another programming language for ? If you want to continue to develop sci/tech/eng programs then Fortran is a good choice, as too are C and C++. I'll leave others to support C and C++, since we use Fortran for the heavy lifting here.

The main advantage that Fortran has over Matlab is speed of execution; where I work that matters a lot, some of our computations take days on 100s of processors. Which indicates another advantage that Fortran has, which is that Fortran, through OpenMP and MPI (and similar) is one of the most easily parallelised languages around.

To learn modern Fortran, I suggest the book 'Fortran 90' by Ellis et al, and the book 'Fortran 95/2003 Explained' by Metcalf. Then, in your situation, I'd start translating some of my Matlab programs into Fortran. This will give you a good appreciation of the relative strengths and weaknesses of the two languages. Your Matlab programs also provide a good specification for what your Fortran programs are to do, so you have the tests already written.

High Performance Mark
How is Python in comparison to C and C++ for sci/tech/eng programs? Thanks for your answer.
Harpreet
Python is for amateurs, C and C++ (and Matlab) are for professionals. Now let's see the flames start :-)
High Performance Mark
Why should anybody learn Fortran which is TIOBE #31 http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html and is on the way into irrelevance?
Mikhail
You can write Matlab functions (mex functions) in C or C++. These can take advantage of the vast computing power even in complicated equations. (You can use loops without worrying about vectorization). If you have learned those languages individually but never tried using them together, I strongly recommend it.
rwong
+12  A: 

I often hear from people that Matlab is not a language

You're hearing nonsense. Matlab is a perfectly good language, if a bit strange to people who've been conditioned by FORTRAN, C, or C++. Also, it is heavily used in engineering and in many of the natural sciences. Your question as stated gives no good reason why you should go on to something else except the nebulous objections of people who sound like they have axes to grind.

I strongly recommend that you continue using Matlab until it stops being effective for you. At that point you will have a particular problem (scale, parallelism, performance, whatever) which one hopes will also be representative of problems you will encounter in the future. You'll be much better off learning a new language at that point than you will guessing what language might help you with unknown problems you might encounter in the future.


P.S. There have been a number of papers on compiling Matlab to executable binaries containing native machine code. I don't know if this work has made it out into the wild yet.

Norman Ramsey
"perfectly good" is a poor description of Matlab, maybe "adequate" :) It has its virtues, but from a CS perspective, it has its share of deficiencies (although maybe they've been addressed in the past 5y since I've used it). I did like the reflection. Most of what you say, I agree though :)
Stephen
@Stephen: Maybe that's because so many people using it don't come from CS backgrounds. Matlab does a good job meeting the needs of most of its users, which I think should be the goal of any language.
Tim Goodman
@Norman: +1 for the defense of Matlab, although I do think there's some value in learning a new language even if you don't really *need* one, just for the exposure to different programming paradigms and different ways of thinking.
Tim Goodman
@Tim : I don't disagree. It is certainly successful at making non-developers productive. If you are interested in CS, it's good to get another perspective.
Stephen
@Stephen: Regarding "perfectly good", I wasn't meaning to comment on the quality, just to assert that Matlab is definitely a programming language, however good or bad it may be. Not sure I want to edit the answer as it will change the meaning of all the comments...
Norman Ramsey
@Norman : Got it. My comment was meant more tongue in cheek ;)
Stephen
+3  A: 

Another vote for python here, from a heavy user of both Matlab and Python. Something that no one mentioned yet is that both languages play very well together, and have compatible strengths.

I'll often use python scripts to pre-process data that will be fed to Matlab (python parsing functions are much more pleasant to work with than Matlab's, in my opinion). Or I'll use python to simulate a process (since our production system is in C++ and python), and use the graphing and analysis power of Matlab to handle the visual display or the statistical analysis.

Also, as Stephen mentioned, in the industry, Matlab is often used in the prototype stage. The concepts are then translated to another languages; in my company, that other language is python, and translation from one to the other is generally very straightforward.

Python is also a good all purpose scripting language for command line automation, file management, etc... (think bash replacement), so it's a good language to have in one's toolbox.

Kena
Thanks for letting me know that your industry uses Python as 'other language' :)
Harpreet
+2  A: 

A source, which is easy, good and interesting, to learn from.

If you choose Python, Dive into Python is a good source. Many of the examples have a practical flavor, and you can get a free electronic copy of the book.

Alejandro
Thanks for the source and the link.
Harpreet
+2  A: 

Ill just throw JavaScript into the mix here purely because it's the most widely installed language in the world. Its gaining momentum in non browser installations. I predict there will be a real shortage of quality JS programmers in the next few years.

James Westgate
Thanks for your answer. But as you must have noted, if it relates to what you intend to point out, I am not into software development :)
Harpreet
Its a bit of a wild card Ill admit - but there are so many libraries out there - and it is potentially so easy to setup, use and even cluster that I think in the long run it may be a surprise contender on this thread.
James Westgate
A: 

The language that you should learn depends on what your research entails. If you are doing lots of numerical work, then MATLAB, R and Python are the three obvious languages to work in. See this other SO question for a comparison of them.

Python has been mentioned a lot in the answers, so I'll just quickly touch upon R. R is free, open source software that is the de facto language for statistics and data analysis. It also has (imho) the best data-vis tools around.

You other option is to learn web-programming, since it is very useful to be able to share your research with others via a web app. Try some basic HTML coding, then look into a JavaScript framework like jQuery.

If you aren't a software dev, then forget compiled languages like Fortran and the C variants (C++/C#/Java). You won't need them.

In terms of learning to program, it's almost always worthwhile taking a look at Software Carpentry.

Richie Cotton
Thanks Richie for your input. I've decided to go with Python.
Harpreet