Friday, May 15, 2009

Starting up in Operational Research: What Programming Languages Should I Learn?

A ThinkOR blog reader asked me some questions about getting started as an Operational Research professional. The reader is in his final year studying Mathematical Statistics, and is preparing to get into an OR master's degree upon graduation. I think these might be some common questions about starting up in OR, so I'm publishing my answers here as a mini-series on "Starting up in Operational Research".

Question 1: What programming languages should I learn?
"I'm a bit interested in what programs and programming languages you would recommend to learn? May seem like a silly question, but since we use a few different programs in university, I'd like to focus on the programming languages which are most widely used/accepted. Our main tool at the moment is R, with some Matlab thrown in for Econometrics and larger matrix calculations. Would you consider R a well used tool in OR or is it mainly used in academics but not in real life?"

I think it is not so important as to what language to learn, but to learn the basics of programming well, so that you can pick up any language easily in the future.

The reason I say that is because:
  1. The OR application and software world is very fragmented. There are many different applications, and they seem to like having their own proprietary languages. However, most of them are developing a Graphical User Interface (GUI) for non-programmers, since they are often aimed at business users (that's where the money is). That said, if you want to fully utilize a software's potential, especially in the case of simulation software, you'd better learn its own language, which is usually proprietary. This would require you to pick up a new language.
  2. Most of these proprietary languages are quite low level languages. Therefore, it is important to have a solid foundation in programming. It will help you understand the language and learn it fast.
My undergraduate degree was in Computer Science (CS). I learned quite a few different languages, but did not really get to use them in Operational Research. However, my CS education helped me to pick up the programming languages needed in OR very quickly. Here I will list the main languages that I encountered in OR:
  • VBA
  • SAS
  • R
VBA is the number one, since a lot of models are done in Excel. SAS is probably the most used in business and a required skill by many employers. Matlab is more for researchers, I believe. I haven't seen it used in any commercial setting so far. I do believe R is used in some commercial settings though.

Note: needless to say, these are only my thoughts on the topic. Please feel free to chime in.

8 comments:

Larry (IEOR Tools) said...

I would encourage to look into some Open Source programming languages. Python is a very good one. There are excellent modelling libraries and kits such as OpenOpt and PyMathProg. R is Open Source and that is a very good and stable software package for statistics and applied mathematics.

I agree with Dawen that the emphasis should not be the particular language itself but to learn the basics of good programming. Programming is a learned skilled and requires practice. It shouldn't matter the tool that ones use. The language itself is only the "flavor". Good programming habits should be the priority.

Dawen said...

Thanks for your thoughts Larry. As you have reminded me of Python, I think I should really mention Perl. It is a very powerful language, especially when one has to chew through massive amount of text. Perl's regular expression comes in very handy for tasks like that. It is fast and efficient, and certainly a good language to have under your belt.

In my own experience, there are a few main languages that any programmer should be familiar with:
- C
- C++
- Java

Once you've got these languages down pat, if you are a good programmer, you should be able to pick up any other language within a matter of 1-2 weeks. It will take you much longer to be masters at the new languages you learn, but you will definitely have enough to get most of the tasks you need done.

It is also beneficial to know a very low level language. In my school, we learned Dr Scheme. It was a good foundation building language. I don't think it's by any means popular. Maybe someone else can recommend another similar, low level language to learn.

Personally, I don't focus *too* much on the language. Because as an operational research professional, programming is only one of your tools. However, it is a rather crucial tool.

Mike said...

Thanks a lot for this mini-series Dawen, will be great value for students to follow!

I'm a bit worried that my lack of programming background might come as a disadvantage to me. There are tons of programming gurus who have been programming their whole lives.
Or is it rather that I have to feel comfortable at an intermediate level of programming, to be able to implement/use the algorithms/models I create in other software?

About R and SAS, do you think both will stay around? Do they server different purposes? When reading comparisons on blogs and forums it seems like a lot of people are moving more towards R nowadays.
It seems to me that R is evolving faster, but that SAS is already very well established and trusted in businesses.

I do agree that it's probably a good idea to keep your mind open and have a general idea of how programming is structured to be able to learn new languages quick. But my intuition tells me that you still probably have your "go to" language for a specific task.

I'm very grateful to have learned that I need to focus some on the heavier languages like C++ as well since I still have 2 years to go for my MSc in OR which should make me more prepared/attractive in the future. I would have had no idea if it weren't for bloggers like yourself!

Michael Trick said...

Worrying that there are people who have programmed far longer than you is the equivalent of wondering whether you should learn to read since there are those around who have read longer than you. Programming is a basic skill in OR.

But the language itself is not so important. If you go with C, C++ or Java, you can help out at places like coin-or. Python also seems a good language. The nice thing about languages: once you pick up one or two, programming in the rest (at least at some level) is much, much easier. I have written code in perhaps a dozen languages, but feel I only know a couple very well at all.

Dawen said...

Thanks for the comment, Mike. You said exactly what I wanted this post to convey. I listed 3 main languages, just from personal experience. However, if you get moderately good at 2-3 languages, you should have the foundation to pick up any programming language from there. An operational research professional do not need to be experts in programming. You can always hire programmers, you know. ;)

Yingjie said...

The homepage of PyMathProg has an easy tutorial: http://pymprog.sf.net/

Unknown said...

I thought I would throw in my two pence. Or is that 1.1 pence given the exchange rate?

In full agreement with the others that programming skills are far more important than the language. As a current job seeker I wish HR departments would realize this.

In my master's class about half of the students had no programming background. Each student learned some basic coding during the program and all are succeeding in their subsequent careers.

That said, I think that programming is an extremely valuable skill. It serves me personally and professionally. It's an amazing tool as well as (pardon my geekery) a joy to do.

One comment on the SAS/R question: I can tell you from reading job descriptions alone (read: my frustration with HR departments) that SAS experience is highly valued in the European job market.

Anonymous said...

Dear Dawen,

I would like to ask a relevant question to the topic, despite the fact that it is quite old. I have knowledge of Java,a currently i am working as an IT/ERP Advisor in a multinational company. During my time in this job, i have seen programming in real life practice, but in C/AL language, which is a Navision ERP language, but with similar "function" to languages such as Java, C++ etc. Through working experience i have learned some coding tips, but i would like to buy a book that includes some fundamental thoughts on programming and various tips. Would you please recommend such a book, by your experience?

Kind Regards,
Stelios