Help picking a programming language

In summary, you should try the languages that interest you the most in order to find the one that is easiest to learn.
  • #1
korni
10
0
Hello to every one,

I am looking through the threads for some information on which programming language to pick on
but I can't find an answer that covers me. So I was hoping you could help me out.

So I am a Civil Engineer doing a research degree. My work involves many numerical simulations.
I am currently making my codes in Matlab and the run finely. Matlab is a good tool but it runs really slowly.
So for example my codes take at the time minutes to half an hour for a physical system of a few hundreds of degrees of freedom, but I will soon be looking on systems of thousands and possibly millions of dofs, so I am looking at something faster.
At a later stage I will also be manipulating and getting information out of many different databases
and I might be willing to create a stand-alone program with a decent GUI for a company to use.

So far I have been trying to decide between python, fortran, C# and C++.
I seem to be closing down on C++ but I would like some contribution from people who know these languages better.

Any info is highly appreciated
~ko.rni~
 
Technology news on Phys.org
  • #2
In general you should pick whatever you find easiest to learn - so try the ones that interest you.
Out of your list, I would lean towards C++ over C# and python over fortran ... my bias is mainly ideological: I prefer free/libre software where possible. iirc the C# platform is still proprietary.

Have you had a look at GCC (the Gnu Compiler Collection) - GCC is an integrated distribution of compilers for several major programming languages. These languages currently include C, C++, Objective-C, Objective-C++, Java, Fortran, Ada, and Go.

You probably won't need all the features.
 
  • #3
Thanks for your reply Simon.

The main idea is to use a language that will do my work in the shortest time possible, calculation-wise.
I will be trying to combine high accuracy (academia-research) with speedy calculations (industry).

But what I am trying to avoid is spending say 3 months to get the basics of a language and create my algorithm
and then find that in another language I could have done the same in a fraction of the time.
That is why I want to establish the best possible route, at least for now.
A language that is easy to learn is not my concern tbh.
My understanding is generally good of how languages work and I also know that learning a language
as opposed to 'learning' a language is a long process, definitely longer than my projects time.

I will have a look at GCC ;)
 
  • #4
Cool - for just algorithmic number crunching you'll probably try C. I don't think I ever took advantage of object oriented stuff converting MATLAB scripts. afaict python is quicker to learn but generally slower in computation.

Of course the absolute fastest for computation, given you don't mind the learning curve, is to program directly in machine code :D
http://catb.org/jargon/html/story-of-mel.html
 
  • #5
Simon Bridge said:
machine code :D
Now, that would be hard-core stuff! :)

So you suggest C instead of C++?
 
  • #6
Don't just look primarily for speed look for maintainability, flexibility, organization and structure as well as prototype systems often become ugly production systems that are hard to maintain and extend without proper upfront planning and design.

You should also consider Java. Its cross-platform, a eeffective internet api, a rich GUI environment and has a large set of libraries to go with it. For Java databases look at H2 database. For modeling a physical system look at Open Source Physics (compadre.org) which has ODE solvers and graphics for creating interative visual simulations.

For development, you should invest in time to learn SVN or GIT and use an IDE like NetBeans or Eclipse. I use NetBeans and SVN at work and feel NetBeans is a tad better than Eclipse in that all the plugins I need are present and not third party.
 
  • #7
C++ is object oriented, supporting classes etc. Otherwise it's the same as C.
Most teach-yourself-C++ courses start with C anyway, though some people advocate going right to C++ to avoid picking up "bad habits".

gcc does both so...

I honestly cannot advise you because I don't know enough about what you are going to need or what basic programming knowledge consists of these days. A quick look should tell you where you feel at home.

jedishrfu has some good points - you should look to the future since you don't want to have to get good at a language you then discover won't let you advance.

There's quite a lot of advise in "similar threads" below if you really want.
 
  • #8
Thanks jedishrfu, I will have a look at those.
I installed Code::Blocks to experiment with, but at first I need to establish in what I want to work with.

Simon, thanks for the clarification. I tried the similar threads which do have info but didn't help me decide.
I did first steps with C++ and Python and both seem ok, meaning I didn't feel lost and understood the basic steps etc.

It seems so confusing as you have a lot of options with different advantages and disadvantages.
And I see that for every answer I am looking for, 10 more questions arise.
In the end what I would love would me a faster Matlab. M++ or JaMa would it be named, I wouldn't mind :D

Anyway, thanks for your comments guys
I'll keep on the look-out and see if something feels to match better.
I might just follow what will seem more interesting in a personal level.
 
  • #9
If you just want to play with java to see if you like it or not, try the processing.org IDE. Its designed for graphics artists to design interactive art in code using the OpenGL graphics api. They have a lot of examples and there are a couple of books on how to use it (Getting Started with Processing by the authors of Processing)
 
  • #10
korni said:
So I am a Civil Engineer doing a research degree. My work involves many numerical simulations.
Find out what language your school primarily uses for numerical simulations, and use that. There's probably a library of code in that language that you can take advantage of. Does your school have a super computer that you'll be using? If so, you may need to learn a second language, most likely Fortran, for that computer (or use Fortran for that computer and PC).
 
  • #11
Of the four languages you mentioned ( python, fortran, C# and C++ ), I have used the latter three extensively and Python only a little. C# would be better, IMO, than C++. The .NET Framework that it runs on (on Windows) is highly optimized for good performance, and it is a more modern, clean and safe language than C++. Once a C# program has "warmed up" (that is, once all its code has been called once and just-in-time compiled), it actually runs as native code just like a C++ program would, and is about as fast. And C# is just much nicer to deal with in every way by hiding, just for example, integer storage size issues from you (for the most part--you can still overflow an integer in ANY language).

It does sound like you are going to need to learn about multi-threading--a non-trivial side trip--if you want to develop user interfaces for your computations.

However, depending on the algorithms that you are coding, you might want to look into parallel programming languages such as Erlang (one of many examples) but only IF the algorithm itself can be analyzed to have parallel elements. I've used Erlang a little bit, which is why I mention it, and it allows for independent nodes that you can "call"; requests will queue up on a node in first-come-first-served order and then execute there. If your computations can be broken into a bunch of independent nodes that can work in this manner, this could save much time, because in modern computers, compilers for languages like Erlang can actually allocate different physical processing elements (think quad-code processors, just for example) to different nodes.

Finally, if you have a massively parallel algorithm, there are cloud-based languages (MapReduce is an example) that can allocate computations out to different "machines" in the cloud in parallel. Most cloud computing is not free, but if you are at a major university, you might find free cloud facilities. If you are interested in concurrent computing, you can read "The Art of Concurrency" by Clay Breshears to get a good introduction to the technology--which is radically different from traditional programming. Companies such as Google, who process enormous amounts of data, are relying heavily on concurrent software.
 
Last edited:
  • #12
According to the Computer Langauge Benchmarks Game http://benchmarksgame.alioth.debian.org/
programs written in C run the fastest but those are micro benchmarks that are very unreliable.
C# is good for creating GUIs under Windows. For platform independance Java is probably better. However Python is also great for creating GUIs. You can by the way use two languages to write your programs, e.g. C for the number crunching and some other language for the rest. Every language offers some way to make the code interact with C code. I also like Scala a lot. It's a high level language yet it's as fast as Java and it comes with features that make parallization easier.
 
  • #13
I will agree with DrZoidberg that Scala is a very nice language. It is a superset of Java, and includes several "parallel processing" capabilities, including a decent implementation of the "actor's model". The actor's model is similar to Erlang that I mentioned above, allowing for a kind of parallel processing for programs that can run as completely independent "nodes"--each node (basically, a program) automatically processes requests in the order they are received, asynchronously (which provides a performance boost, as multiple CPU's or cores can be used to implement the different processing nodes).
 
  • #14
Oh yes... then there's JAVA - which is probably the best all-rounder mentioned so far.
You are only talking about converting MATLAB m-files designed for number crunching right? Not so worried about the GUI for instance, or running fancy animations? In which case, all the options are very similar - you'll be using a small subset of the languages capabilities.

Part of the Gnu Compiler Collection is GCJ
GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile Java source code to Java bytecode (class files) or directly to native machine code, and Java bytecode to native machine code.

There are free/libre implimentations of the JRTE ... the main advantage being that it is cross-platform. JAVA is also the backbone of Android.

If you are absolutely stuck with windows, something that handles the dot-net framework is probably a good idea in the long run ... that would normally be C#, which is best at it. However, there are alternatives approaches.
http://www.mono-project.com/Main_Page
http://www.gnu.org/software/dotgnu/

There are free/libre implimetations of JAVA besides the GCJ approach:
http://en.wikipedia.org/wiki/Free_Java_implementations

What you end up doing really depends on the details of what you need and where you see yourself heading.
There are extensive howto's (even software) for converting MATLAB m-files to JAVA, C++, or python ... so any of those would suit your immediate purpose.

Everyone has their favorites though.
Happy hunting.
 
  • #15
Thanks for all of your replies.
They have been really helpful!

Simon, no I will not convert my m-files but write them from scratch in the language I end up using.

Happy Easter,
korni
 

FAQ: Help picking a programming language

1. Which programming language is the easiest to learn?

The answer to this question can vary depending on personal preferences and learning styles. However, some commonly recommended languages for beginners include Python, JavaScript, and HTML/CSS.

2. What is the best programming language for web development?

Again, this can depend on the specific needs and goals of the project. However, popular languages for web development include JavaScript, PHP, and Ruby.

3. What programming language is most in demand in the job market?

Currently, languages like Java, JavaScript, Python, and C++ are in high demand in the job market. However, the demand for specific languages can vary depending on location and industry.

4. How do I choose the right programming language for my project?

Consider the requirements and goals of your project, as well as your own personal strengths and interests. Research the various languages and their capabilities to determine which would be the best fit for your project.

5. Can I learn multiple programming languages at the same time?

It is possible to learn multiple languages simultaneously, but it may be more efficient to focus on one language at a time. It's important to have a solid understanding of one language before moving on to another, as each language has its own unique syntax and structure.

Back
Top