PDA

View Full Version : Which programming language should I learn?



A Rainy Knight
2009-05-31, 02:22 PM
Since programming once again has not been offered as a class at my school, I was thinking about trying to pick up at least some basic programming skills over the summer. The problem is that I have next to zero starting knowledge on the subject and have no idea as to what programming language to study.

So, Playgrounders, what are your suggestions for me? Which languages would you say are the most useful/easiest to start with?

Lupy
2009-05-31, 02:26 PM
HTML is quite easy and easily self taught. I learned it by taking the courses at W3C schools in fact. I you're interested in web design it's the must have.

If you know HTML, it depends on what you want to do. Python is powerful and intuitive, if you want an object oriented language.

PHP is also quite useful (for web design) and a bit easier than Python.

Tirian
2009-05-31, 03:05 PM
If you just want to dip your toe in the water to get some elementary understanding of structured code, Scratch (http://scratch.mit.edu/) rocks. It is self-contained to the point of seeming pretty juvenile, but like building a suspension bridge with Tinkertoys it will give you the flexibility to learn the fundamentals but have enough structure to be accessible. You don't have to spend the first two months of your programming career worrying about compilers or syntax errors when you should be learning about loop structures and events.

Once you've got that down, there are plenty of useful and easy languages like Python, JavaScript, and Visual Basic out there. The right one for you depends on just what sort of problems you want to solve. But once you make that decision, the learning curve will be three months shorter because you will already be a programmer.

Collin152
2009-05-31, 03:18 PM
I suggest Truespeech, so you can reprogram reality itself.

Mr. Mud
2009-05-31, 03:22 PM
HTML is quite easy and easily self taught. I learned it by taking the courses at W3C schools in fact. I you're interested in web design it's the must have.

If you know HTML, it depends on what you want to do. Python is powerful and intuitive, if you want an object oriented language.

PHP is also quite useful (for web design) and a bit easier than Python.

I can't describe how much I agree with Lupy...

But binary, or at least a rough understanding of it, can be useful... But as he said, HTML and PhP are both very useful. As will be Java, but that's circumstantial on what you want to really do.

Castaras
2009-05-31, 03:23 PM
Heh, you're in the same sorta dilemma as I am atm. To be honest, it's up to you what language you learn - you should learn what you feel would be best for you.

There's a few things you'll need to consider; It is best to have projects in mind that you could Use the language for - trying to learn to program with nothing in mind is a horrible experience, and you aren't going to learn as well as if you actively have an end result in your head.

As to which language you use, it entirely depends on your preference, what you have available to you, and what you want to use it for.

Here's an extract from an email that I was sent which explains in detail various languages;


A quick tour of the Zoo... or at least the most popular parts of the menagerie...

'C' -- the most popular language for big open source projects. It is a comparatuvely simple language to learn the syntax of; whose virtue and vice are that it is a portable encoding scheme for machine assembler; and the popularity stems from its having a standard definition of how libraries look (so any 'C' project can consume the output of other 'C' projects). The first downside is that being at so low a level, you have to do most of the housekeeping yourself : you have to know that characters take 1 byte, except when they take 2, that integers are 2, 4 or 8 bytes, and if you reserve a block of memory, not only do you have to remember to release it when you're done, but if you don't keep track of the size -- or get the size wrong -- you can start reading, or, worse, writing memory meant for some other part of the program.

I have written GUIs using 'C', but only when people have been paying me money -- having to manage so many the details of thing for yourself can make this tedious.

C++ -- Takes 'C' and adds a lot of extra material : classes to hide data, and provide some mechanisms to automate resource management; templates, allowing you to generate new classes on demand (such as vector<fill in the type here> which serves as an array-like container for the type of thing you specify), exceptions (for dealing with error conditions). The trouble is that you still have to do a lot of the care and feeding of the new features yourself.

It is less popular in the open-source world because there is no standard for how libraries should look (unless you just make the library look like a 'C' one). There is a GUI toolkit which I have used in my hobby programming for C++ (the FOX toolkit). The .net UI libraries are available if you use the .net version of C++, but that drags in a whole bunch of new .net specific language syntax.

The two above are "native" languages -- the libraries or executables you build are specific to the platform (Windows, Mac, ...)


Java -- I learned this language because it has what I feel to be the GUI libraries with the most intuitive way of working. It is like a simplified C++, with most of the simplifications being to do with how memory is managed for you. Other external resources (graphics being the most obvious), you have to manage for yourself. It comes with a vast library of useful functions built in. The main downside is that it can be quite verbose.

C# -- In the broader scheme of things, a second try at Java, which has managed to reduce the verbosity. This is the language I use for most of the stuff I write at work. Personally I don't like the GUI libraries approach quite as much (but then I don't often have to use it).

The two above are "managed" languages (memory is looked after for you) running in virtual machines (VMs) -- the same Java or C# application can be used on different types of computers, so long as the appropriate runtime (the program that mediates between programs in that language and the hardware) is installed.

All four above are compiled languages -- you write the code, compile it (fixing syntax errors), and then run the code in a separate step.

Python -- this almost gets you back to 'C's level of simplicity of syntax (actually, the canonical "Hello World" for Python is simpler), which giving you as much as you can do with C++ or C#, and in some cases, more. It supports a REPL (read-eval-print loop) -- you can type code fragments at a prompt and have then execute then and there. This is good for testing a step of a program while you're writing it. There is an extensive set of libraries that come along with the language, and for the first time one of these standard libraries supports unit testing (writing functions that can test that other parts of the code work as you meant -- "If i call this function with these values, the answer should be this; if I call it with those, then I expect it to give me that error).

The very interesting thing about this language is that not only does it have its own VM -- but there are implementations for the Java VM (Jython) and the .net one (IronPython) as well, which allow you to write Python code (still using the REPL and unittest library as you go), but using the Java or .net UI libraries (and all the non-UI ones).

Ruby -- Everything that goes for Python goes for Ruby too. The syntax is a little bit funkier -- it uses odd punctuation marks where Python uses keywords, and often presents more than one way of doing the same thing, which Python tries to avoid -- but that's about it. There are JVM and .net versions, too. In fact the JRuby implementation is in some ways ahead of the original Ruby.

There are a couple of other new(-ish) languages that I'm learning myself at the moment that I would recommend as being good mental discipline to start out with (Scala and F#), but at the moment they both lack good books or tutorials for the pure beginner.


Python and Ruby are both languages that I've picked up recently enough that the beginners' books I have about them are not hopelessly out of date, so if you wished I could loan them to you. They both also have good on-line support (http://docs.python.org/tutorial/ for Python, and the less conventional _why's (Poignant) Guide to Ruby by _why the lucky stiff and more -- including a very easy to use GUI toolkit intended to be simple for new programmers to pick up and use.

I would suggest that you opt for one or the other of these to start with. There is always plenty of time to learn the others in years to come

Note: I'm currently, after my exams, gonna be teaching myself (with help from said friend) Python. I however already have the advantage that I learnt to program in Visual Basic at a young age, which means I have a grounding in basic programming.

*shrugs* Dunno if this will help. Should at least get you started.

SDF
2009-05-31, 03:24 PM
C++ is useful, but a difficult one to start with. Java is relatively simple and a good one to learn. So is vi.

Starscream
2009-05-31, 03:26 PM
Ooh, something I'm actually qualified to talk about! This has never happened to me before.:smallbiggrin:

Yeah, Python pretty much rocks and is very easy to pick up.

Html is super easy, although there's not a ton you can do with it by itself. Still, you could learn the basics of that language in a day, so why not? After you've picked it up, PHP is a good place to go from there.

I love Perl. It's not the easiest out there, but it is awesome.

Same goes for Java. My beginning programming classes actually used Java, so if you want to study programming in college, it can be very good to know.

A lot of my classes used C, C++ and C# as well. But first they made us learn this stupid C-based training language called Resolve. It's a trap! Resolve is useless, and you'll have to unlearn pretty much everything when you move on to the better stuff.

And, um, I guess Visual Basic is pretty simple. It's mostly for creating Windows applications, though I've done some web stuff with it as well. I am not a huge fan of it, but I really can't put my finger on why. But a lot of people enjoy it.

Lupy
2009-05-31, 03:33 PM
I can't describe how much I agree with Lupy...

But binary, or at least a rough understanding of it, can be useful... But as he said, HTML and PhP are both very useful. As will be Java, but that's circumstantial on what you want to really do.

When I started programming last summer (and I was 12, it's not like I knew any math to speak of or had any useful skills) I wish someone had punched me in the face for learning VBScript first. HTML is useful, it teaches you all the basic stuff, you can actually use it in pretty much any computer field, and no one regrets learning it.

While I plan on finishing up with Python (which I needed for some stuff, I wouldn't recommend doing it before PHP) I'll be learning PHP.

Python and Ruby are both easier than Java or Perl (but accomplish similar things) and have huge, helpful fan communities. They also both have massive amounts of books written for beginners (Python especially) available.

I cannot recommend this (http://www.amazon.com/Python-Programming-Absolute-Beginner-Second/dp/1598631128) book strongly enough for Python.

Another note: Python 2 is much easier to pick up on (in my opinion) and the transition to 3 is easy after learning 2.

Mr. Mud
2009-05-31, 03:36 PM
When I started programming last summer (and I was 12, it's not like I knew any math to speak of or had any useful skills) I wish someone had punched me in the face for learning VBScript first. HTML is useful, it teaches you all the basic stuff, you can actually use it in pretty much any computer field, and no one regrets learning it.

While I plan on finishing up with Python (which I needed for some stuff, I wouldn't recommend doing it before PHP) I'll be learning PHP.

Python and Ruby are both easier than Java or Perl (but accomplish similar things) and have huge, helpful fan communities. They also both have massive amounts of books written for beginners (Python especially) available.

I cannot recommend this (http://www.amazon.com/Python-Programming-Absolute-Beginner-Second/dp/1598631128) book strongly enough for Python.

Another note: Python 2 is much easier to pick up on (in my opinion) and the transition to 3 is easy after learning 2.

I don;t really like Python... I actively speak out against it really. I loves me some java, and PhP is probably the easiest to code with... in my ridiculously unquailfied, but back up by limited with experience opinion (IMRUBBUBLWEO).

Oddly, Python 2 is a lot better to me.

Lupy
2009-05-31, 03:52 PM
I don't like where they're heading with Python 3 really, the whole point of Python 2 was that anyone could read it, it made sense, and there were set ways you did things.

Python 3 is harder to read, and more confusing.

Not that I'm at all qualified.

Hazkali
2009-05-31, 04:36 PM
HTML isn't really a programming language per-se. In order to get the most out of it, you'll quickly need to learn JavaScript, or at least enough bits and pieces to add interesting bits to your pages.

I had to learn Python as part of my physics degree, and it was fun. I haven't done any other programming, but it was fairly intuitive, and with a bit of intelligent structuring, programmes were neat. Plus, no compiling.

A Rainy Knight
2009-05-31, 04:41 PM
I guess I should have already said that I have a pretty good understanding of HTML. I got about two weeks of HTML last year in school and I taught myself some more of it. So, I won't be going with that one.

From what I'm hearing, it seems that either Java or Python might be a good one to start with. Er... right?

Jack Squat
2009-05-31, 04:53 PM
If you haven't learned one before, I'd suggest Python or Java.

kamikasei
2009-05-31, 05:30 PM
Go with Python. It's the best available combination of simplicity, cleanliness and popularity, so you can learn the basics and advanced programming concepts without having to struggle with the language itself, and then the lessons and habits you pick up will be easy to transfer to other languages. Don't waste mental effort on learning the intricacies of C++ or Java - if you learn the concepts first, individual language quirks will be easier to learn afterwards.

I would definitely recommend Python over Java.

pendell
2009-05-31, 05:48 PM
Since programming once again has not been offered as a class at my school, I was thinking about trying to pick up at least some basic programming skills over the summer. The problem is that I have next to zero starting knowledge on the subject and have no idea as to what programming language to study.

So, Playgrounders, what are your suggestions for me? Which languages would you say are the most useful/easiest to start with?

First of all, I note that I am a professional software engineer who has been in the business since 1994.


I recommmend Java. It's very hot in the job market right now, it's far easier than a lot of other object-oriented languages, and it's free at Java.sun.com. It'll also teach you good object-oriented habits.

Another recommendation -- based solely on job advertisements -- is C#, but that is not free. So I would say Java.

I would also get a book on Design Patterns (http://en.wikipedia.org/wiki/Design_patterns) -- or just read about them on the web. They are the building blocks of solid programming. If you can demonstrate knowledge and skill of patterns, you'll be a step ahead of your competition.


Respectfully,

Brian P.

Lupy
2009-05-31, 07:30 PM
Python is going to overtake Java soon.

A Rainy Knight
2009-05-31, 07:37 PM
All right, I think I'm going to go with Python for the summer. Thanks for all the help, guys. :smallsmile:

Lupy
2009-05-31, 08:36 PM
Good choice. :smallsmile: Look into that book I mentioned above.

InaVegt
2009-05-31, 09:31 PM
I'd like to suggest Lua.

Lua is easier to learn than both Java and Python, and there is an alternate environment available that beats both of them in the speed department, which is 99% compatible with standard Lua.

It's also very small, and is used by a large number of games as their scripting language. (WoW comes to mind.)

Lupy
2009-05-31, 09:34 PM
Lua looks quite interesting, I may have to look into it. Thank-you for the heads up.

I still highly recommend Python though, it is going to replace Java by the time we are out of college in tennish years.

Starscream
2009-05-31, 10:53 PM
I still highly recommend Python though, it is going to replace Java by the time we are out of college in tennish years.

I kind of hope it does, that would be awesome.

InaVegt
2009-06-01, 03:16 AM
Python needs some major speed improvements before it's going to be anywhere near viable. LuaJIT has those speed improvements, though.

valadil
2009-06-01, 09:09 AM
Why not figure out what you want to program and then pick a language that works well for that project? I've read through mroe programming books than I can count, but nothing sticks unless I'm using it for a project at the time.

And as a general note, HTML is not a programming language, but a markup language. It's used for formatting text. It is still worth learning, but should not be confused for programming.

bosssmiley
2009-06-01, 09:20 AM
Seriously? C, PERL, Python, Java or LISP (http://www.retrologic.com/jargon/L/languages-of-choice.html)

If you're wanting to play the long game: COBOL.

"So now, dear reader, you know our dirty secret. Large parts of the software ecosystem that sustains our critical infrastructure is written in a language that practically no one knows, almost no one can fix, and is effectively immortal. (http://blindcyclistsunion.wordpress.com/2009/05/28/sooner-or-later-cobol-will-kill-us-all/)"

Mysterious, ancient and half-forgotten? Any gamer knows there's money to be made in that kind of situation. :smallwink:

-----

edit: Shamus Young addresses the OP's question (http://www.shamusyoung.com/twentysidedtale/?p=3519). How's that for timing?

pendell
2009-06-01, 11:32 AM
Python is going to overtake Java soon.

What makes you say that?

Respectfully,

Brian P.

RS14
2009-06-01, 10:17 PM
I'm a bit late, but if you're serious about programming, I recommend C++. It's a beast, but it is low enough level to force you to learn how things work. Get a good book, to avoid learning bad habits. C++ Primer, perhaps? The 3rd edition is cheap. You can learn about useful things like pointers and iterators and templates and memory allocation. Then move on to a high-level language like Java or Python.

But Python is a good choice too, and a good introduction.

Trazoi
2009-06-02, 12:01 AM
I'd also recommend Python as a good starting point language. It's quick to pick up and start doing simple things with, it's got an interpreter where you can mess around typing simple lines of code to get a feel of the language, and it's good enough to do a lot of small programming tasks. Python is the language I use for writing small simple programs of my own, such as if I want to convert a text file into a slightly different format.

Java is another popular beginner language, but when I've tried using it there's something about it that just rubs me the wrong way. I'm not sure why - maybe I just didn't find the right introduction to the language, or the apps I've made weren't snazzy enough. It is however one of the most popular starting languages at universities, although I wouldn't be surprised if they did shift to another language like Python in a few years.

For game development, C# is another popular choice. It's a bit more involved than Python to learn, but it's a strong language for development for .NET and the Xbox.

C or C++ are often suggested, but I wouldn't recommend them as a beginner language. There's some tricky management issues with those languages which is best to leave until after you've picked up some programming basics. They make good second languages, though.

Lua is in slightly rarer use, but it's got a strong following as a game scripting language in a role which it butts heads with Python (there's a lot of Lua vs. Python discussions for that role). For a first language though, I'd pick Python over Lua simply because the community is a lot larger; you'll be able to get a lot more help with Python.

RMS Oceanic
2009-06-02, 05:34 AM
This seems like the best thread to ask...

I learned to code in Java, and my job uses Java as well. However I was thinking of expanding my horizons and picking up another language, perhaps C++. Does anyone know what sort of compiler/executer/development platform I should use to practise on?

Tehnar
2009-06-02, 05:51 AM
What, no one mentioned Fortran? :smalleek:

Well it would not be my choice to causally pick up and learn, but still suprised no one mentioned it.

InaVegt
2009-06-02, 08:25 AM
This seems like the best thread to ask...

I learned to code in Java, and my job uses Java as well. However I was thinking of expanding my horizons and picking up another language, perhaps C++. Does anyone know what sort of compiler/executer/development platform I should use to practise on?

Depends on your target environment.

For windows, I'd recommend MS Visual C++ Express Edition.
For Unix, I'd recommend GNU C++ combined with an IDE of your choice.
For other platforms, no clue.

BugFix
2009-06-02, 12:16 PM
Python needs some major speed improvements before it's going to be anywhere near viable. LuaJIT has those speed improvements, though.

De-lurking for a moment to issue a warning:

Knee-jerk pronouncements about a software system's "speed" or "performance" are, and I say this without exaggeration or emphasis, guaranteed to be wrong. Always.

Performance analysis in modern systems is a black art. If your explanation doesn't contain a discussion about things like cache line size, memory bandwidth, memory/syscall/network/interrupt latency, locking overhead, parallelism, resident set size, etc..., it is incomplete. CPU cycle counting is, except for a small subset of problems (almost none of which are appropriate for a scripting engine like Lua or Python), essentially never the limiting factor. Other stuff comes first.

That's not a dig at Lua per se, which is a nice, pleasingly small language. But choosing it over Python (or Ruby, or Perl, or Javascript, or PHP...) on the basis of a JIT compiler instead of things that actually matter (like, say, library/framework coverage for intended problem) is leading your audience astray.

pendell
2009-06-02, 12:56 PM
This seems like the best thread to ask...

I learned to code in Java, and my job uses Java as well. However I was thinking of expanding my horizons and picking up another language, perhaps C++. Does anyone know what sort of compiler/executer/development platform I should use to practise on?

C# ( a Microsoft product, so that means Microsoft Visual Studio ) seems more 'hot' as far as jobs go. I'm having a devil of a time, and I'm a primary-C++ secondary-Java guy.

Respectfully,

Brian P.

InaVegt
2009-06-02, 01:21 PM
That's not a dig at Lua per se, which is a nice, pleasingly small language. But choosing it over Python (or Ruby, or Perl, or Javascript, or PHP...) on the basis of a JIT compiler instead of things that actually matter (like, say, library/framework coverage for intended problem) is leading your audience astray.

I'm sorry I did not source my claim, I also did not base my claim on the fact it has a JIT, but on benchmarking data I have seen.

Now, benchmarking isn't perfect, but for general performance comparison, it's the best we have.

LuaJIT vs. Python 2 (http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=luajit&lang2=python&box=1)
LuaJIT vs. Python 3 (http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=luajit&lang2=python3&box=1)
LuaJIT vs. Psyco (http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=luajit&lang2=psyco&box=1) (A JIT implementation of Python)
LuaJIT vs. IronPython (http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=luajit&lang2=iron&box=1)

Now, the only one that comes close is Psyco, which is memory intensive. I'd say those are roughly comparable in speed, based on these tests, (forgot to check Psyco) but Psyco still loses.

Now, of course, choice of language depends on requirements, but the claim was that Python was going to replace Java, which sounds pretty unlikely to me, and all I was trying to say is that Lua is closer to beating Java than Python.

Guru
2009-06-02, 02:32 PM
If your looking to learn a language, it depends on what your looking for.

Web Design
To design and make websites, you usually need these things,

HTML
CSS
PHP
Java
SQL (for databases)
People to read support emails so you don't have to


Usually, start off with the most basic of HTML. html dog (http://htmldog.com) is where I learned my basics of HTML, but that isn't enough to get making a website. CSS is also listed on that site, and should probably come next in learning. Some people specialize in CSS though, and if you have people like that, or your a good Photoshopper, then you don't have to worry about doing the CSS, but it's always good to know some. PHP is for all the advanced stuff. Login's, data storage, and lots of things like that. Java is also something some people tend to specialize in (I don't know Java, so you're gonna need to find someplace for a tutorial to learn it). Java is used at times, but it's not essential to making a website. SQL is for advanced stuff (I don't know that one either).

Application/script Programming
For programming an application or a script, you can use a wide range of languages, but mainly what are used is


C
C++
Python
Ruby
Perl
Ect.


Those are nowhere close to every a few of the languages to program with, but there all good starter languages.

Robot Programming
Robot programming is more advanced, but what I know of being used for it is


C
C++


Granted, there are applications such as LabVIEW (http://www.ni.com/labview/) that make this process easier/harder (for my friend, it turned out to be harder for him in LabVIEW then just doing it in C) and there is also much more to learn there then a simple programming language, but that's just touching on this.

There are tons of other thing for programming, but it all depends what kind of programming your talking about.

Tirian
2009-06-02, 02:40 PM
There are an awful lot of irrelevant factors in this discussion. When you're contemplating your first language, performance is a complete non-issue. Optimization is a fascinating topic, but is irrelevant for the majority of projects and has even less of a role when the OP is writing code that converts Fahrenheit to Celsius.

Also, who really cares about where the jobs are? The jobs are going to be somewhere else ten years from now. By the time you're ready for a job, a programmer is going to know six languages and had better have the skill to be quickly productive in a seventh after a frantic weekend of self-directed study. A properly trained programmer is going to know Python AND Java AND C/C++ and which is the right tool for a given application, just like a carpenter has to know how to use a hammer and a saw and a drill.

Anyway, learning Python first is a respectable choice. There are a lot of people in the world who are very able and willing to help you pick it up and lots of places online that have fun challenges that will test your skills.