LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 11-17-2009, 11:00 AM   #1
Garry | K | E
LQ Newbie
 
Registered: Nov 2009
Location: location, location.
Distribution: Ubuntu, Back Track 4
Posts: 15

Rep: Reputation: 1
Python, C++ or Ruby


Hey,
I'm pretty new to Linux, about a month or so and I am really wanting to begin learning a programming language which I can use a lot while I'm on Ubuntu but I am unsure of which language to try and learn.

I have done a little bit of Python and even Pascal in the past but I don't know what the benefits of the languages in the title are.

I want something that I can use a lot, will find I can write my own programs or make addon-like codes for already existing programs so that they work how I want them to or something and that's not going to be so hard to learn and also, writing programs that can connect to the internet to do various things and also reading data from other files.

I was just wondering if someone would be able to help me a little bit in deciding out of these three which would be the best for what I am wanting to do?

Thanks.
 
Old 11-17-2009, 01:02 PM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 52
This gets asked a lot

And I hate to say it, but there's not going to be a definitive answer! The truth is eventually you'll end up learning several languages anyway, and it's probably fair to say that once you know one language you can easily pick up others.

For what it's worth I would discount Ruby. Don't get me wrong, I think it's a great language but it's lacking documentation (in comparison with the other two languages you mention), there are far fewer projects written in it (that aren't Ruby on Rails at least) and you say you want to be able to extend existing programs, and there's no real advantage in using it over using C++ or Python.

Both Python and C++ are very capable languages. Python is quite structured and tends to follow the philosophy that there is one good way to do something (in comparison to Perl's attitude that there are a million and one ways to achieve a goal!). It should teach you good practice.

C++ is very powerful but has certain idiosyncrasies that make it a bit harder for a beginner: things like pointers, references and a compiler whose error messages are not always the most intuitive when trying to debug some code.

I think you'll see results quicker with python which will keep you encouraged. There are lots of projects using python, excellent documentation, a wealth of tutorials online and a load of libraries to do everything from update a twitter status to writing games (pygame is very good). Once you're comfortable with python you can decide where to go from there: hone your skills with it or start learning a different language (maybe C++). It's always useful to have multiple strings on your bow

Good luck.

KK
 
Old 11-17-2009, 01:22 PM   #3
johnsfine
Senior Member
 
Registered: Dec 2007
Distribution: Mepis, Centos
Posts: 3,837

Rep: Reputation: 685Reputation: 685Reputation: 685Reputation: 685Reputation: 685Reputation: 685
Quote:
Originally Posted by Komakino View Post
there's not going to be a definitive answer!
There certainly will be at least a difference of opinion over the definitive answer. In my opinion, C++ is much better.

Quote:
Python is quite structured
The meaning of the word "structured" is unclear enough to allow that claim. But Python is quite unstructured and that makes it too easy for slapping together unmaintainable code and too hard for building larger well structured projects.

Quote:
C++ is very powerful but has certain idiosyncrasies that make it a bit harder for a beginner:
I can't argue with that.

Quote:
things like pointers
But I will argue with that. I think pointers are a fundamental requirement of a truly powerful programming language. Most languages lack pointers and that is a serious flaw in most languages.

Beginners in C do tend to make mistakes with pointers, partially because they are taught badly and partially because you need pointers in C in a few situations where C++ has better alternatives. A beginner does not need to be confused by pointers in C++.
 
Old 11-17-2009, 03:02 PM   #4
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,284

Rep: Reputation: 441Reputation: 441Reputation: 441Reputation: 441Reputation: 441
Quote:
Originally Posted by Garry | K | E View Post
Python, C++ or Ruby
Do you know what you want to do with this programming language? there are some applications for which the scripting languages (Python and Ruby) are more appropriate than C++, and some for which C++ is more appropriate.
 
Old 11-17-2009, 03:05 PM   #5
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,695
Blog Entries: 5

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by johnsfine View Post
But Python is quite unstructured and that makes it too easy for slapping together unmaintainable code and too hard for building larger well structured projects.
how long have you been coding in Python to make you say that? Have you coded a large Python project before?
 
Old 11-17-2009, 03:08 PM   #6
rweaver
Senior Member
 
Registered: Dec 2008
Location: Independance, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 160Reputation: 160
You may wish to look at Lua as something to consider too. Of the three listed however, I would be most likely to learn Python, it's the generalist of the bunch and has better documentation than ruby and is easier to learn than C++. Any of the languages will serve you well though it just depends on what specific use you want to gain out of them.
 
Old 11-17-2009, 03:10 PM   #7
Garry | K | E
LQ Newbie
 
Registered: Nov 2009
Location: location, location.
Distribution: Ubuntu, Back Track 4
Posts: 15

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Komakino View Post
This gets asked a lot

And I hate to say it, but there's not going to be a definitive answer! The truth is eventually you'll end up learning several languages anyway, and it's probably fair to say that once you know one language you can easily pick up others.

For what it's worth I would discount Ruby. Don't get me wrong, I think it's a great language but it's lacking documentation (in comparison with the other two languages you mention), there are far fewer projects written in it (that aren't Ruby on Rails at least) and you say you want to be able to extend existing programs, and there's no real advantage in using it over using C++ or Python.

Both Python and C++ are very capable languages. Python is quite structured and tends to follow the philosophy that there is one good way to do something (in comparison to Perl's attitude that there are a million and one ways to achieve a goal!). It should teach you good practice.

C++ is very powerful but has certain idiosyncrasies that make it a bit harder for a beginner: things like pointers, references and a compiler whose error messages are not always the most intuitive when trying to debug some code.

I think you'll see results quicker with python which will keep you encouraged. There are lots of projects using python, excellent documentation, a wealth of tutorials online and a load of libraries to do everything from update a twitter status to writing games (pygame is very good). Once you're comfortable with python you can decide where to go from there: hone your skills with it or start learning a different language (maybe C++). It's always useful to have multiple strings on your bow

Good luck.

KK
Thanks for that advice.
I may say though, that this is not my first programming language. I also done some work on Windows with Visual Basic .NET and also attempted Visual C# .NET which was a little confusing after VB but I think now is the time I tried not relying on the IDE so much and went for the languages that only really needed a text editor at least.

But yeah, thanks again. I think I'll go for Python and go from there in the future
 
Old 11-17-2009, 03:14 PM   #8
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,695
Blog Entries: 5

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by Garry | K | E View Post
But yeah, thanks again. I think I'll go for Python and go from there in the future
good choice. go for it.
 
Old 11-17-2009, 03:38 PM   #9
johnsfine
Senior Member
 
Registered: Dec 2007
Distribution: Mepis, Centos
Posts: 3,837

Rep: Reputation: 685Reputation: 685Reputation: 685Reputation: 685Reputation: 685Reputation: 685
Quote:
Originally Posted by ghostdog74 View Post
how long have you been coding in Python to make you say that? Have you coded a large Python project before?
The only thing I've ever done in Python (and far too often) is repair and enhance code in badly structured large programs written by others. I've never written any new Python program from scratch and have no interest in doing so. (When I write from scratch I can select the language).

I also programmed in C++ that same way for quite a while before ever writing a program from scratch, just fixing and enhancing code in projects that were large before I got near them.

Probably the difference in quality of structuring was magnified by the generally low skill level of the programmers who proceeded me on those projects. But there is a real difference in the language characteristics that led equally bad programmers to build worse project structure in Python than in C++.
 
Old 11-17-2009, 04:05 PM   #10
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,037

Rep: Reputation: 399Reputation: 399Reputation: 399Reputation: 399
Quote:
Originally Posted by Garry | K | E View Post
Hey,
I'm pretty new to Linux, about a month or so and I am really wanting to begin learning a programming language which I can use a lot while I'm on Ubuntu but I am unsure of which language to try and learn.

I have done a little bit of Python and even Pascal in the past but I don't know what the benefits of the languages in the title are.

I want something that I can use a lot, will find I can write my own programs or make addon-like codes for already existing programs so that they work how I want them to or something and that's not going to be so hard to learn and also, writing programs that can connect to the internet to do various things and also reading data from other files.

I was just wondering if someone would be able to help me a little bit in deciding out of these three which would be the best for what I am wanting to do?

Thanks.

Of course, Perl .
 
Old 11-17-2009, 04:35 PM   #11
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 52
Quote:
Originally Posted by Sergei Steshenko View Post
Of course, Perl .
I love perl Sadly it wasn't in the OP's shortlist
 
Old 11-17-2009, 04:44 PM   #12
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 52
Quote:
Originally Posted by johnsfine View Post
There certainly will be at least a difference of opinion over the definitive answer. In my opinion, C++ is much better.



The meaning of the word "structured" is unclear enough to allow that claim. But Python is quite unstructured and that makes it too easy for slapping together unmaintainable code and too hard for building larger well structured projects.



I can't argue with that.



But I will argue with that. I think pointers are a fundamental requirement of a truly powerful programming language. Most languages lack pointers and that is a serious flaw in most languages.

Beginners in C do tend to make mistakes with pointers, partially because they are taught badly and partially because you need pointers in C in a few situations where C++ has better alternatives. A beginner does not need to be confused by pointers in C++.
I don't disagree with you, C++ is my language of choice at home (at work I'm stuck with Delphi ) and I don't necessarily think pointers are difficult, but I do think there are more important things for a beginner to learn before having to worry about pointers, memory allocation, slicing problems, etc.

I would almost certainly encourage the learning of C++ at some stage, but I also believe there are concepts essential to programming that can be better learned elsewhere first to get a sound understanding of the basics before progressing onto more difficult concepts.

Were it on the list I would probably suggest Java (or C#) as having several of the benefits of C++, encompassing most of the essential programming concepts but essentially avoiding pointers.

I'll also say that I wouldn't tell the OP he'd made a mistake if he chose C++ as I do think it's a great language, and which ever language he chooses he's eventually going to have to get around to covering all the necessary concepts anyway

(I would still stay away from Ruby though, for the reasons I mentioned earlier)
 
Old 11-17-2009, 06:39 PM   #13
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,695
Blog Entries: 5

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by johnsfine View Post
The only thing I've ever done in Python (and far too often) is repair and enhance code in badly structured large programs written by others.
If you are able to repair and enhance large Python code, that tells you something isn't it?

Quote:
I've never written any new Python program from scratch and have no interest in doing so. (When I write from scratch I can select the language).
then how would you know something isn't what its supposed to be when you haven't even tried it.?

Quote:
I also programmed in C++ that same way for quite a while before ever writing a program from scratch, just fixing and enhancing code in projects that were large before I got near them.
Quote:
Probably the difference in quality of structuring was magnified by the generally low skill level of the programmers who proceeded me on those projects. But there is a real difference in the language characteristics that led equally bad programmers to build worse project structure in Python than in C++.
An example for you.
2 equally bad programmers, 1 using C++, the other using Python. Both write bad code. BUT the one who writes with Python has no choice but to indent his code properly, because otherwise his program won't work. Now you go and read their code, which one do you prefer, ( even though the other parts may be badly written ) ? the one which has at least indentation proper, or the one without?
 
Old 11-17-2009, 06:46 PM   #14
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 2,094

Rep: Reputation: 104Reputation: 104
C/C++ definitly python is a scripted language and scripted languages are really really really slow. python doesnt have that much purpose.
 
Old 11-17-2009, 07:23 PM   #15
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,695
Blog Entries: 5

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by smeezekitty View Post
C/C++ definitly python is a scripted language and scripted languages are really really really slow. python doesnt have that much purpose.
don't spout nonsense.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl vs. Ruby vs. Python vargadanis Programming 53 12-31-2010 01:37 PM
Perl or Ruby or Python? Or something else? MasterOfTheWind Programming 18 05-07-2009 01:43 PM
Lisp, Ruby, or python nesrail Programming 20 01-27-2009 03:49 AM
Python, Java, or Ruby? Doctorzongo Programming 9 04-01-2008 12:14 AM


All times are GMT -5. The time now is 10:21 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration