Useful programming languages to learn?

  • Thread starter Arsenic&Lace
  • Start date
  • Tags
    Programming
In summary: C++ is a horrible, ugly, badly designed language that was scarred for life by design constraints such as the desire to make it backward-compatible with C.That's certainly a valid point.
  • #1
Arsenic&Lace
533
37
The universe keeps (emphatically) yowling at me to learn a progamming language. As part of my research in computational biophysics I'm attempting to learn python as rapidly as possible. But I'm trying to figure out which languages are most useful to learn, and which languages I should learn, since the universe has also rudely informed me that my odds of becoming a researcher in physics are somewhere between 0 and 1, but waaay closer to 0 than 1.

C and C++ are mentioned frequently. My father is a bit eccentric but he makes his bread by programming in Scheme and feeding it to a C interpreter while working for a big tech giant. He vigorously suggests I learn scheme.

Any others? Would two languages suffice (C, python and scheme)?
 
Physics news on Phys.org
  • #2
Hi A & L :smile:

Honestly, I would think that learning to program very well in just one language would be sufficient. It is much less important which language you use. They all do the same things, they just use different "words" to do them. Once you know how to program in one language, it is relatively easy to switch to a new one.

That being said, sometimes learning two different languages will help you to understand programming concepts better. Seeing the way each language handles things can give you a lot of insight. Kind of like using two textbooks to learn a new subject (which I also recommend).

I think since you have a head start on Python, you should stick to it. C++ is also a good one, but if you think your dad will be a good resource in learning, then maybe the second language should be Scheme.

Best of Luck!
 
  • #3
Saladsamurai's remarks are bang on.

Saladsamurai said:
That being said, sometimes learning two different languages will help you to understand programming concepts better. Seeing the way each language handles things can give you a lot of insight. Kind of like using two textbooks to learn a new subject (which I also recommend).
The nice thing about doing some C is that it get you close to the hardware and let's you understand how certain things work that are hidden from you in a language like python. Scheme might help you to learn a style of looking at programming called functional programming: http://www.defmacro.org/ramblings/fp.html . C++ is a horrible, ugly, badly designed language that was scarred for life by design constraints such as the desire to make it backward-compatible with C.

Saladsamurai said:
I think since you have a head start on Python, you should stick to it.
Yes. Many people who get through an undergrad CS curriculum actually can't program their way out of a paper sack in *any* language. Learn how to program in one language, python, and you're one up on them.
 
  • #4
Thanks guys! I'm actually quite fascinated by this point of view that many CS majors can't program worth beans, it seems utterly unexpected. A lot of my physics friends are panicking that they won't stand a chance against a full blown CS major, but I suppose I can tell them otherwise...
 
  • #5
As others have commented, what you really want to learn is /programming/, not a programming language. And if you go into a field with "computational" in its name, you'd better learn it good. In order to become a decent programmer, you generally have to be "fluent" in multiple languages, as different languages are good for different problem domains. And in order to be a good programmer, you have to be at least a decent computer scientist (that means you need to know at least all the stuff taught in a BS course in Comp Sci, in particular algorithms and data structures to get started)

The most useful languages if doing numerics are likely Python or Matlab (choose one), C++, and C or Fortran (choose one). You should not start with C[1] or Fortran, as starting with either one will make you learn bad programming habits. You should start with Python, as this has the best effort-to-outcome ratio, and even when knowing only Python, you can get quite far. But you should be aware that there are things which simply cannot be done with it, many of which are important in fields with "computational" in their name.

About scheme: While scheme and common lisp are undoubtedly very powerful programming languages, you need to be aware that about 95% of the stuff they are good at can be done just as well in python (and much cleaner), and that if you seriously try to use them, you will quickly learn that you have to re-invent every single wheel (unlike in Python) and that you will be the only one in your lab using those languages. If you have some time, learn a LISP dialect by applying it to some toy project. It is fun and will make you grow as a programmer. But those are not good languages for everyday use, and nothing to get started with.[1] (as most of C is a subset of C++, learning C is mostly a question of learning how the C++ constructs are actually implemented. Pure C itself is redundant.)Edit: Yes, C++ is a horrible abomination straight out of hell (it is also a good example how you can arrive at a horrible result by doing only perfectly reasonable decisions.). However, it is still by far the best language for many kinds of applications, in particular all applications which call for *both* a software design (i.e., large applications) and raw performance (you can 100% performance in C++ if you know what you are doing). Most big applications in Windows, including Windows itself, are written in C++. There are good reasons for that.
 
  • #6
Python is the best place to learn programming, then you can move on to which ever language you please. I don't know what your level your programming expertise is, but Coursera will be running at least three free online Python courses in the next two or three months, two provided by University of Toronto (a "the very basics" type course and a "crafting quality code" type course), and one provided by Rice University (event driven programming and object oriented programming). Unless of course you have already taken them as they ran this autumn as well.
 
  • #7
  • #8
For the record, I did the FizzBuzz program (from Ben's first link) in C++ in nine minutes. If I hadn't succumbed to "oh gee, maybe this would be a better way to do it" after I was halfway through, I would have finished in five minutes. :tongue:
 
  • #9
Udacity is a good place to learn python.
 
  • #10
cgk said:
About scheme: While scheme and common lisp are undoubtedly very powerful programming languages, you need to be aware that about 95% of the stuff they are good at can be done just as well in python (and much cleaner), and that if you seriously try to use them, you will quickly learn that you have to re-invent every single wheel (unlike in Python) and that you will be the only one in your lab using those languages. If you have some time, learn a LISP dialect by applying it to some toy project. It is fun and will make you grow as a programmer. But those are not good languages for everyday use, and nothing to get started with.
Do you think co-learning scheme while focusing most of my efforts on python would be a good idea? I was told that scheme will alter the way I think about solving many problems.
 
  • #11
Arsenic&Lace said:
Do you think co-learning scheme while focusing most of my efforts on python would be a good idea? I was told that scheme will alter the way I think about solving many problems.

I think you should concentrate on python to learn programming in general if you are new to programming. Co-learning anything else is fine. But if you don't get python you probably won't get anything else.
 
  • #12
Ah okay, so far python is a breeze but it may just be I'm not pushing hard enough/working on any interesting projects.
 
  • #13
Arsenic&Lace said:
Ah okay, so far python is a breeze but it may just be I'm not pushing hard enough/working on any interesting projects.

That's probably the point about python. It is easy. It has sort of a minimum of syntactic formality about it and it's expressive. Take a python program and try to translate it into say, C++. Using STL classes will probably make it not that hard, but it's definitely a challenge.
 
  • #14
To throw a cat amongst these pigeons, I think Java would be a good language to learn after Python.

This is because it is purely object-oriented and will teach you good project design. Its major limitation is its slow processing speed, but this is less of an issue nowadays than it used to be.

I am not a strong programmer, but I learned on java and can still knock out useful code when I need to (this being said, i use python scripts daily)
 
  • #15
I've heard from some that object-oriented programming is overrated. Is this true?
 
  • #16
Arsenic&Lace said:
I've heard from some that object-oriented programming is overrated. Is this true?

it's main strength is when coding in a group, so you can write code that uses someone else's code without needing to see their code.

I guess it would be overrated if you were involved in every aspect of the project and weren't worried about other people being able to use your code.
 
  • #17
Since you mentioned using you're programming for computational biophysics then I'd suggest Java and by extension Groovy. Groovy is fairly new to the scene. Its a scripting language based on java using java syntax, able to call upon java classes and fully interoperate with java without the hard requirement of using the class structure for your program. It also supports functional programming.

I've used groovy with the Java Open Source Physics library (www.compadre.org/osp) as part of a graduate level computational physics course and it worked quite well.

Groovy is also the base language for Grails, a web application framework with backing database which could be useful as your get further along in your project and you need to export results to the web for others to work with. That route would extend you into the realm of javascript and HTML using jquery, jsxgraph and other notable software.

If you do go this route then I'd also suggest Eclipse or Netbeans IDE tools as they make life of a programmer more bearable and productive.

More info on groovy can be found at: http://groovy.codehaus.org/

and grails at: http://grails.org/
 
  • #18
[1] (as most of C is a subset of C++, learning C is mostly a question of learning how the C++ constructs are actually implemented. Pure C itself is redundant.)

This is a great way to start a flame war. Let's NOT do that, please.

Consider another idea:

Maybe you can think of programming languages like this: a few have become well-adapted (analalgous to Natural Selection and Adaptation) to particular niches. Example: C is mandatory if you want to do UNIX system programming or UNIX/Linux kernel development.

COBOL is likely never going away, no matter what you may think of it. These niche languages are not likely to fade away because MEL is cooler'n all-get-out, or Numpy is your idea of perfection because GSL sucks, and Mathematica and Maple cost too much.

There has been a proliferation of programming tools, languages, and dialects. Some new entries will fade, others will find a niche and become another de facto standard.

to the OP:
Pick a language - one - that has been around for a while. Learn that really well.
You would far better off longterm to pick a language that has a standards group (e.g., ISO) behind it.
 
  • #19
The main advantage to knowing multiple languages is that you can read source code for programs you use more easily. For computational biophysics, you'd probably beniefit a lot from knowing fortran, as I imagine a lot of the heavy-duty codes you'll be using are written in it. Python and C are also common in computational physics.
 
  • #20
A lot of the advice in this thread amounts to "I think you should learn my favorite language" (or even "I think you should learn the only language I've ever used").

It doesn't matter much what language you start with, because if you do a significant amount of programming you will soon have to learn another one. And another. And another. In 30+ years of programming, I've learned and used at least 20 languages, and I've forgotten almost all the "trivia" about most of them.

The question "which language should I learn" is a bit like "which make of car should I learn to drive in". Unless you choose a Model T Ford, or an F1 race car, the answer is "it doesn't really matter".
 
  • #21
Arsenic&Lace said:
I've heard from some that object-oriented programming is overrated. Is this true?

That's a matter of opinion. IMO it was oversold. The paradigm is a good fit for certain tasks, such as graphical user interfaces. It provides a natural way of organizing libraries and APIs, and of keeping namespaces uncluttered. If you're going to be a professional programmer, it's worth understanding how it works and having it in your bag of tricks.
 
  • #22
Arsenic&Lace said:
I've heard from some that object-oriented programming is overrated. Is this true?

Depends on who is doing the rating, no?

Let me agree with those who argue that you want to learn to program more than any particular language. There are already plenty of people out there who can write bad code in a dozen languages.

Python is a very forgiving language. That's its strength and its weakness. Learning another language which is less forgiving, such as C++ or even Scheme (just because your father suggested it doesn't make it wrong) will help. What will help more is understanding data structures.
 
  • #23
Yeah, I'm messing around with scheme here and there since I find it to be such an unusual programming language. There is a scheme compiler which compiles it into C which my pop swears by: http://www.call-cc.org/ so that could be a good way to kill two birds with one stone.

It's interesting, as I learn both python and scheme, I find that learning something new in scheme provides me with a new way of thinking about python, although not as much in the reversed direction.
 
  • #25
jim mcnamara said:
This is a great way to start a flame war. Let's NOT do that, please. [...]
That is not a good way of *not* starting a flame war :]. I think the statements I made might have been slightly exaggerated, but technically they are not very controversial: C89 is only not a proper subset of C++, because C++ has stricter type checking and due to that some programs legal in C89 are not legal in C++. But these are only minor points. For the most part, you can program C in C++ if you want--for the subsets of the code where this is sensible.

Additionally, if you are a good C++ programmer, you know how the C++ constructs can be implemented or emulated in C. Then you can also program decent C, so learning C by itself is technically redundant. The reverse is not at all true.

Note also that in many situations where C is chosen over C++ in new projects, the main reason for doing so is not technical: Often it is a deliberate choice to avoid the constructs C++ gives you, because they can be abused or turned into undefined behavior very easily. In C++ it can be much harder to see what exactly is going on under the hood. A very important point in kernel development---but not in scientific computing for the largest part of the code.

There has been a proliferation of programming tools, languages, and dialects. Some new entries will fade, others will find a niche and become another de facto standard.
yes, and C is actually not very common in scientific computing or numerics. There are reasons for that: In these fields, C is not really more powerful than Fortran, and it does have the same aliasing related optimization issues as C++ does (there are compiler/implementation specific workarounds for that, but you need to know about them). Fortran and C++, however, are widely used in these fields.
 
  • #26
Arsenic&Lace said:
Yeah, I'm messing around with scheme here and there since I find it to be such an unusual programming language. There is a scheme compiler which compiles it into C which my pop swears by: http://www.call-cc.org/ so that could be a good way to kill two birds with one stone.

It's interesting, as I learn both python and scheme, I find that learning something new in scheme provides me with a new way of thinking about python, although not as much in the reversed direction.

That is good progress! You should continue with both Python and scheme. While Python might seem like it is very natural and many problems have easy solutions, that is not a bad thing at all. It took many decades to arrive at a programming language like that, after all---where you don't have to fight the limitations of the language but just your specific programming problem.

Scheme (and maybe even more so common lisp with its CLOS) are very powerful languages. But while they may seem unusual and lead to new insights into how things can be done, it often turns out that these other ways of doing things are more or less equivalent to the imperative way of doing things. For example, classes can be implemented in terms of closures, but also closures can be implemented in terms of classes. Or tail recursion and iteration can be implemented in terms of each other. This even goes down to intermediate representations of the code, where the static single assignment form of a program (often used in compilers for imperative languages) can be shown to map to the continuation passing style used in compilers of functional languages. Of course, not all things are equivalent, and even if they are equivalent, one way of thinking about a problem may still be more natural or lead to better solutions than a different one. This is why it is helpful to know a set of different languages. If you can warm your heart for scheme, then this is a good one to continue.
 
  • #27
NigelTufnel said:
There are a couple of websites that attempt to provide popularity rankings for programming languages:

The popularity of languages only matters if you fall into the fallacy of believing that learning programming is about learning specific languages.
 
  • #28
bcrowell said:
The popularity of languages only matters if you fall into the fallacy of believing that learning programming is about learning specific languages.

Good point and quite true! It is useful though if you're a future programmer looking for a job to know what languages are/were in demand in the past couple of years.
 
  • #29
jedishrfu said:
Good point and quite true! It is useful though if you're a future programmer looking for a job to know what languages are/were in demand in the past couple of years.

Well, again, this is the same fallacy. HR bunnies may filter one's resume based on experience with specific languages, but for any halfway decent job (i.e., not a code-monkey job), the actual people doing the interviewing and hiring should be trying to figure out one's knowledge of programming and CS, not a specific language. Once a person has solid programming skills in *some* language, they can learn any other language in a weekend, and list it on their resume if it seems to be something that HR filters are looking for. But if HR filters want x years of experience in language y, then nothing you can do by self-study is of any relevance, because they want the y years documented on your c.v. as work experience.
 
  • #30
Since I am one of the younger members here, I'll chip in what I can on what's hip.

Python is a very good language to start it, it is dynamically typed making it very easy to use. The default Python IDE is very user friendly, and I found Python very nice when designing GUIs, performing my hobby cryptanalysis among various things.

There is also another language called Processing, which is amazing. It is basically Java with a very strong emphasis on computer graphics/animation/game design. So if you like to design a game to improve your programming, I would recommend it. Like Python, it is free also. However, Processing, unlike Python, is statically typed, making it a bit harder for noobs to work with.

Both Python and Processing are OOP, so they have huge advantages over the non-OOP languages. But do not learn OOP until you first learn basics like the "if","for","while" etc. and the methods,functions,modifiers etc. To grasp Python, try Michael Dawson's "Python Programming for the Absolute Beginner".

So start with Python, design a game on Processing if you can, then learn more languages. It's more important you learn about the different data structures, data types and different types of algorithms than it is about knowing the nuts and bolts of a multitude of languages.

Also, programming is a skill that should be practiced every now and then to make sure the skill does not wear out. So do something creative or useful to keep yourself sharp.

BiP
 
  • #31
From Bipolarity,

The default Python IDE is very user friendly, and I found Python very nice when designing GUIs, performing my hobby cryptanalysis among various things.

That is great to know. This makes Python more appealing to try to learn than it seemed before. (That it can create graphical user-interfaces).

Both Python and Processing are OOP, so they have huge advantages over the non-OOP languages.

(Read about oop, still never understood clearly).
 
  • #32
symbolipoint said:
From Bipolarity,



That is great to know. This makes Python more appealing to try to learn than it seemed before. (That it can create graphical user-interfaces).



(Read about oop, still never understood clearly).

OOP is just about the implementation of things like classes, class attributes, object instantiation and inheritance. It allows for a way to visualize elements of the code which would otherwise be very abstract.

BiP
 

1. What are the most popular programming languages to learn?

The most popular programming languages to learn are currently Java, Python, JavaScript, C++, and C#. These languages are widely used in a variety of industries and have a large community of developers.

2. Which programming language is best for beginners?

Many experts recommend Python as the best programming language for beginners. It has a simple syntax and is easy to learn, making it a great choice for those new to coding.

3. What are the benefits of learning multiple programming languages?

Learning multiple programming languages can expand your skill set and make you a more versatile and valuable developer. It can also help you understand different approaches to problem-solving and make it easier to learn new languages in the future.

4. How do I choose which programming language to learn?

The best way to choose a programming language to learn is to consider your interests and goals. If you want to develop mobile apps, learning Swift or Java would be beneficial. If you're interested in data analysis, Python or R would be a good choice.

5. Are there any programming languages that are becoming obsolete?

Some programming languages, such as COBOL and Fortran, are considered outdated and are not as widely used as they once were. However, they are still used in certain industries and can be valuable to learn for specific purposes.

Similar threads

  • STEM Career Guidance
Replies
16
Views
3K
  • Programming and Computer Science
Replies
8
Views
832
  • Programming and Computer Science
4
Replies
107
Views
5K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
12
Replies
397
Views
13K
  • Programming and Computer Science
Replies
16
Views
1K
  • STEM Academic Advising
Replies
12
Views
1K
  • STEM Career Guidance
Replies
10
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
Replies
3
Views
1K
Back
Top