Click to See Complete Forum and Search --> : Powerful and useful easy to learn language, thats also distrubuted with lin distros??


iDavey
01-30-2001, 08:23 AM
Hi,

I want to learn a new programming language, but not sure which to to take up. I have used languages such as Pascal, Basic and COCO (weird I know, but needed it for old school project!). However they are are very limited and can be called newbie languages that are not the most powerful or versatile, or even moden and hip.

I know that people rave about Perl, Java, C, C++, C# (??? [edited] ok then, by MS anyway), asp, Python and the rest. All are geared to do specialed things, like Java to make whole apps, buut slow to be used in conjunction with the web. And Perl great for doing neat little things in you nix terminal and also useful to create cgi scripts. C low level and hard to learn, but powerful, but usless to use with the web etc? What should I go for? I want to learn a language that I can use for many things, like web pages (dynamic) with a free db such as MySQL, and that can be used to make programs to do all sorts of quirky things? What do you all think? The more opinions, the better!

------------------
- God created the integer, man made the rest.

[This message has been edited by iDavey (edited 31 January 2001).]

jemfinch
01-30-2001, 08:53 AM
You should learn python. It's not specialized for anything in particular, and it's excellent at anything from simple 5 line scripts to huge, 100,000 line applications.

And it's amazingly easy to learn, not to mention it (along with java) is the most cleanly cross-compatible language in your list.

Jeremy

klamath
01-30-2001, 01:05 PM
Java to make whole apps, buut slow to be used in conjunction with the web

Uh, no -- Java servlets are actually very fast.

I'd suggest Ruby. It's kinda like the best of Perl, the best of Python (nice clean syntax), and some damn cool stuff from Smalltalk, all in a cool package. I've just learned it recently, and it's been very impressive. www.ruby-lang.org (http://www.ruby-lang.org)

------------------
- Klamath
Get my GnuPG Key Here (http://klamath.dyndns.org/mykey.asc)
Looking for an open source project to contribute to? Check out the Tornado HTTP Server (http://sourceforge.net/projects/tornado)

nanode
01-30-2001, 01:10 PM
Even without using much myself, I'd say Python. Besides being extensible and easy to learn, I really like the philosophy behind it.

Also, that'd be a great stepping stone to Java later on (from my understanding).

osnap
01-30-2001, 01:16 PM
I'd agree with klamath and going with ruby. I tried and tried to learn python, but never could really get into it, so I tried php, but most of the cool stuff to write in it are alredy written, so I really didn't have a reason to learn it. Then I found ruby and read one tutorial and it all clicked, I understood everything and I can make sense of it. Very easy syntax and no stupid things like a ";" at the end of every line or making the whitespace count (like python) when programming.

kel
01-30-2001, 01:30 PM
This 'ruby' sounds impressive. I don't know it personally so I'd have to suggest Perl. You can definitely use it with an RDBMS like MySQL ( and also more high level RDBMS's like Oracle ). I've also used it to write very cool Data-Mining systems, text-processing scripts, and CGI-scripts among other things, so I know how diverse it can be. All the extensions may at first be intimidating but if you grind through it, I'm pretty sure you'll be happy with it. Also, Perl was the first language I learned(other than SQL, or HTML which I don't count), and transitioning from it to other languages like Java, or C++ has proved to be very easy. That may appeal to you in and of itself.

------------------
kel

iDavey
01-31-2001, 07:55 AM
Thanks Jemfinch, Klamath, Nanode, Osnap, Kel for your reasonings. I am going to have a look at some sample code of Ruby, Python, Perl. What about Tkl or is it tcl? Anyway, what is that normally used for? And is it comparable with the others we've mentioned? I know that Perl is now very useful for web stuff, things that html can't do (thats most things!), how about Python and Ruby? Can they connect to free db's such as mySQL, and maybe Oracle etc? Can you use them for shell scripting? I'm still not decided what to go for? But do you guys suggest that I try and learn as many of the languages as I can? Or is that a waste of time. You might ask why do I want to learn any of thhem in the first place, well I guess its just for the fun of it really. And then being able to write neat little progs to do all sorts of things?

Another thing, has anybody heard of GP (Genetic Programming) and GA (Genetic Algorithms)? Any languages that would be best to code in that line of thought? How easy would it be to code in Perl, Python, Ruby for that?

------------------
- God created the integer, man made the rest.

Craig McPherson
01-31-2001, 08:09 AM
Originally posted by iDavey:
I know that people rave about Perl, Java, C, C++, C#, asp, Python and the rest.

One little correction: nobody raves about C#.

jemfinch
01-31-2001, 08:38 AM
I'm primarily going to focus on the python/ruby comparison here, since they seem the comparable in goals/capabilities.

Python has far more users and way more useful standard modules. Compare Ruby (http://www.ruby-lang.org/en/man-1.4/bundle.html)'s with Python (http://www.python.org/doc/current/lib/lib.html)'s. And that's only including the standard distribution modules; python also has far more modules floating outside the standard distribution.

Python also "plays well with others". You'll find that it integrates with C and Java more easily than ruby, especially, and most likely every other scripting language (though I hear tcl integrates well with C.) In fact, there's Jython (formerly known as JPython, but the name changed due to copyright issues) which is python written in java, thus allowing python access to all kinds of java features like compilation to JVM bytecode and the Swing toolkit.

You'll find that python is generally more readable than other languages (including ruby, which still uses perl's icky "default variables" and such.) Despite what everyone who doesn't know python says, the syntactically significant whitespace is not a problem. In fact, I haven't found a single person who uses python regularly and says, "Man, I wish I could type my curly braces again." It greatly aids in the ability for a programmer to read code written by others (which is a great learning tool for newbies, considering how many python modules are included with the distribution, and are written very well)

If it matters to you, python has a very active Win32 community, and integrates very well with the windows environment. Also, if you care, python actually works on MacOS. It seems generally more cross-platform than ruby.

Here (http://www.python.org/doc/Comparisons.html)'s a link to some comparisons of python with other languages.

I've never regretted learning python, and I'm reminded every day I use my own computer or have to use another's computer of how great the language is.

Jeremy

iDavey
01-31-2001, 09:53 AM
Jemfinch - thanks for that responce and the links. It was helpful. Can Python be embedded like Perl into web page etc? I suspect that it can though. You can also wite shell scripts?? Does it come with most Linux distros? Have'nt check on mine yet. BTW, I use suse (v7.0). How is Pyton related to Tcl?? I know that there is a connection somehow, or I am talking rubbish?

kel
01-31-2001, 10:27 AM
Just want to clarify something. Perl is NOT embedded into HTML pages. CGI scripts are Perl scripts that create web pages. Believe it or not, there is a difference. Languages like PHP, or JavaScript are languages that embedded into HTML files. The difference may seem insignificant, but in fact its pretty important. http://www.linuxnewbie.org/ubb/smile.gif

------------------
* And the geeks shall inherit the Earth *
kel

iDavey
01-31-2001, 10:52 AM
Thanks Kel http://www.linuxnewbie.org/ubb/wink.gif
So Perl runs as scripts on the server, right. Pls correct me if Iam incorrect. What about Python?

nanode
01-31-2001, 11:33 AM
I've seen some Python CGI.

Only one I know off hand: http://gslug.org/cgi-bin/msgbd/msgbd.py?enter_board

Nothing glamorous, but a proof of concept for Python/Web/DB integration if you are so inclined.

jemfinch:


which is python written in java, thus allowing python access to all kinds of java features like compilation to JVM bytecode and the Swing toolkit.


I'm foggy on details, but isn't it possible to all write Python wrappers for Java classes? I have a lot of Java packages with everything from GUI to custom utilities.

If I could re-use all that in Python, I'd be a happy Python coder!

kel
01-31-2001, 11:40 AM
So Perl runs as scripts on the server, right.

Yes, that is exactly right. http://www.linuxnewbie.org/ubb/smile.gif


------------------
* And the geeks shall inherit the Earth *
kel

jemfinch
01-31-2001, 11:54 AM
Originally posted by nanode:
I'm foggy on details, but isn't it possible to all write Python wrappers for Java classes? I have a lot of Java packages with everything from GUI to custom utilities.

If I could re-use all that in Python, I'd be a happy Python coder!


First a caveat: I don't use java or j{,p}ython, and probably won't (I'm not a java fan.)

I gave your question to some people from #python on OPN (irc.openprojects.net, the best network in existence) and here was there response:


<ry> <e`@ircnet> jemfinch: you don't need to do any wrapping with jpython/jython
<ry> <e`@ircnet> jemfinch: you can just use all packages and classes like they were python modules/classes
<ry> <e`@ircnet> you can even inherit from them, or inherit from python classes in java, or whatever


(the strange syntax is because "ry" is an irc bot [written in python, of course] that links the #python channels on efnet, ircnet, and opn.)

So yes, I imagine you could reuse all your already-written java code in python.

Jeremy

klamath
01-31-2001, 12:15 PM
I know that Perl is now very useful for web stuff, things that html can't do (thats most things!), how about Python and Ruby?

Yes, Ruby has an equivelent to Perl's CGI.pm, as well as mod_ruby (for writing Apache modules and handlers in Ruby), and eRuby and erb for embedding Ruby in HTML.

Can they connect to free db's such as mySQL, and maybe Oracle etc?

Yes, Ruby can do this. It can connect to most databases, including PostgreSQL, MySQL, and Oracle.

Can you use them for shell scripting?

Err... no - for that you'd need to use a shell script. But you can use Ruby for lots of system maintainence tasks, like Perl.

Just want to clarify something. Perl is NOT embedded into HTML pages.

It can be -- there are lots of modules like HTML::Mason, HTML::Embperl, Apache::ASP, ePerl, and others which do this. In fact, Ruby can be to -- it's up to the programmer to choose which techinique is best.

So Perl runs as scripts on the server, right. Pls correct me if Iam incorrect. What about Python?

So is ANY CGI script (written in Perl, Python, Ruby, or another language) -- as is PHP and Java Servlets. Only Javascript, VBScript, a Java applet, or a similar client-side app would only run on the client side.

I'll reply to Jemfinch's comments in a separate post so it doesn't get cluttered.

------------------
- Klamath
Get my GnuPG Key Here (http://klamath.dyndns.org/mykey.asc)
Looking for an open source project to contribute to? Check out the Tornado HTTP Server (http://sourceforge.net/projects/tornado)

[This message has been edited by klamath (edited 31 January 2001).]

kel
01-31-2001, 12:17 PM
Showoff.... http://www.linuxnewbie.org/ubb/biggrin.gif

iDavey
01-31-2001, 12:37 PM
Thanks for that link Nanode,
also thanks to Jemfinch, Klamath and Kel for your inputs.

------------------
- God created the integer, man made the rest.

[This message has been edited by iDavey (edited 31 January 2001).]

klamath
01-31-2001, 12:41 PM
I'm primarily going to focus on the python/ruby comparison here, since they seem the comparable in goals/capabilities.

To be honest, you seem to only have done a cursory inspection of Ruby -- some of your statements below are simply factually incorrect. I'd encourage you to take another look -- after all, didn't you curse Python frequently on this board, before you took a look at it? http://www.linuxnewbie.org/ubb/biggrin.gif

Python has far more users and way more useful standard modules.

First off, you're comparing the standard library included with Ruby 1.4 (which is old, 1.6.2 is current), to the current standard library of Python. Also, there is something wrong with that page: lots more modules are distributed with Ruby than that. A better list is here (http://www.rubycentral.com/ref/index.html), although it doesn't include lots of optional things, that are distributed with Ruby but not compiled when the system doesn't support them (like Tk or GTK support).

And you're only comparing the standard library -- the Ruby standard library tends to be fairly minimalistic, and most modules are distributed separately. Python has bundled support for silly stuff like XML, Sun .AU files, SGI IRIX stuff, etc. Sure, these are all useful, but why not distribute them separetly?

And finally, if the number of users or the number of modules was the primary concern, we'd all be using Perl -- it has 10x more users and at least 5x more modules than either Perl or Python. And as for users, in the first place Ruby was introduced, Japan, there are currently more Ruby users than Python users. It's been slower catching on in North America, but it seems that when both languages are available, many people choose Ruby.

Python also "plays well with others". You'll find that it integrates with C and Java more easily than ruby

Java -- fine, I'll give you that. But do you have any basis for saying that integrating Python with C is easier than with Ruby? From what I've heard, it's considerably easier to write C extension modules in Ruby than in Python, simply because the internals of the language are better designed. And also, since Ruby uses a mark-and-sweep garbage collector (rather than Python's reference counting), you don't need to manually increment and decrement references to your object's when writing Ruby extensions in C, unlike with Python.

You'll find that python is generally more readable than other languages (including ruby, which still uses perl's icky "default variables" and such.)

Actually, using the default variables is *entirely* optional - AFAIK, there is usually an OO alternative. It's TMTOWTDI -- you can use the convenient, Perl style shortcuts, or use the verbose, clear OO-style approach. Ruby lets you choose -- rather than Python, which tends to remove that flexibility and say that there is "One True Way" to do a given task.

I haven't found a single person who uses python regularly and says, "Man, I wish I could type my curly braces again."

For clarity, curly braces are rarely used in Ruby: they don't delimit blocks, like they do in Perl/C/C++/Java. Most people find Ruby's syntax *very* nice, and very convenient.

I'd encourage everyone to check out Ruby. Unlike jemfinch, I've looked pretty extensively at both Python and Ruby, and Ruby comes out ahead in my opinion.

------------------
- Klamath
Get my GnuPG Key Here (http://klamath.dyndns.org/mykey.asc)
Looking for an open source project to contribute to? Check out the Tornado HTTP Server (http://sourceforge.net/projects/tornado)

iDavey
01-31-2001, 01:06 PM
Thanks guys, I appreciate all your input and views into Perl, Ruby and Python. Anyway, I am going to look into all of them and learn!

jemfinch
01-31-2001, 01:59 PM
Originally posted by klamath:
First off, you're comparing the standard library included with Ruby 1.4 (which is old, 1.6.2 is current)


Then perhaps www.ruby-lang.org (http://www.ruby-lang.org) should update its website. Go there and click on the "documentation" link. You'll be linked to this (http://www.ruby-lang.org/en/doc.html) page.


To be honest, you seem to only have done a cursory inspection of Ruby -- some of your statements below are simply factually incorrect.


It's not my fault if the information at the ruby website is out of date. I made a good-faith effort.

In all seriousness, the documentation on ruby seems horribly inadequate. I need go no further than python.org before I find multitudinous high quality documents related to python. The same obviously can't be said of ruby.


And you're only comparing the standard library -- the Ruby standard library tends to be fairly minimalistic, and most modules are distributed separately. Python has bundled support for silly stuff like XML, Sun .AU files, SGI IRIX stuff, etc. Sure, these are all useful, but why not distribute them separetly?


Why distribute them separately? What's the marginal cost of adding another 15k source file to the distribution tarball for python? Why make it harder for people to do useful things with a language?

You consider XML "silly stuff"?


And finally, if the number of users or the number of modules was the primary concern, we'd all be using Perl


I never said that the number of users or the number of modules was the primary concern. However, as a feature of a language, it's fairly high on the importance list. It took python quite a bit to overcome the ubiquity of perl; it did so, however, through an easy-to-read syntax and powerful set of standard modules.


It's been slower catching on in North America, but it seems that when both languages are available, many people choose Ruby.


Both languages are available in north america, and yet people still choose python. On my debian system, 457 package descriptions mention perl; 125 mention python; 52 mention ruby. And debian is a very worldwide effort.

Ruby began in japan, and python began in the netherlands. Python, however, is more popular in north america. I think that says something.


But do you have any basis for saying that integrating Python with C is easier than with Ruby?

http://www.python.org/doc/current/ext/ext.html
http://www.python.org/doc/current/api/api.html

That's my basis. I can't find a description of the ruby/c api. Feel free to offer a link so people can compare the api for each of them.


I'd encourage everyone to check out Ruby. Unlike jemfinch, I've looked pretty extensively at both Python and Ruby, and Ruby comes out ahead in my opinion.


Ruby doesn't have enough advantages to outweigh python's advantages.

The syntax of ruby is more complicated syntax than that of python.
Ruby's standard library is much smaller and less useful.
Ruby has fewer users.
Ruby isn't as portable as python.
Ruby doesn't have an easy to use line oriented shell (that is, a useful REPL.)

The above are hard, incontrovertable facts. These are things that can be verified by anyone who wants to look at both languages. What does Ruby have that counterbalances these facts?

Jeremy

Jeremy

klamath
01-31-2001, 03:20 PM
First off, sorry if I was a bit harsh before.

* Ruby doesn't have an easy to use line oriented shell (that is, a useful REPL.)

Not sure what a REPL is, but 'irb' (interactive ruby) is almost exactly the same as using 'python' from the command-line.

* The syntax of ruby is more complicated syntax than that of python.

Perhaps more complicated, but also more powerful. Also, this is not a "hard, incontrovertable fact" -- syntax is a very subjective thing.

Why distribute them separately?...You consider XML "silly stuff"?

No -- but I don't think it should be distributed with the language. XML is a complex, rapidly evolving topic. Any XML tools will probably need to be frequently updated to keep up with the latest W3C specs. Also, the number of people using XML (or Sun AU, or SGI IRIX stuff) is, IMHO, too small to justify bloating the distribution package with it. However, I realize that there is an advantage to having a large standard library: however, I think this should do stuff that really belongs in the standard library -- things like data structures, date/time manipulation classes, and other general utilities. Other more specific modules should be distributed through a place like CPAN.

In all seriousness, the documentation on ruby seems horribly inadequate.

I agree, the documentation for ruby does need to be improved. However, check www.rubycentral.com (http://www.rubycentral.com) , as well as the book "Programming Ruby" -- that's where most of the docs are. That's also where the C API is documented.

You made some good points about the current problems with Ruby. I'll add a few (this is compared with Python):

Ruby Disadvantages:
- poor docs
- not much commercial support
- small standard library
- fewer users
- not ported to as many platforms

I think these will all be solved as Ruby gains mark share: none of them are issues with the actual language. And that's where I think Ruby shines: when you get down to it, I find Ruby more convenient and faster to use than Python. I find it easier and more enjoyable to program in Ruby than in any other language I've tried, including Perl, Python, Java, and C. This is obviously a subjective assessment, but personally, that's enough for me to use Ruby whenever I can.

------------------
- Klamath
Get my GnuPG Key Here (http://klamath.dyndns.org/mykey.asc)
Looking for an open source project to contribute to? Check out the Tornado HTTP Server (http://sourceforge.net/projects/tornado)

jemfinch
01-31-2001, 04:07 PM
Originally posted by klamath:
Not sure what a REPL is


Read, Eval, Print Loop. It's got a more well-defined definition than "line oriented shell" so I threw it in there http://www.linuxnewbie.org/ubb/smile.gif


Perhaps more complicated, but also more powerful. Also, this is not a "hard, incontrovertable fact" -- syntax is a very subjective thing.


First, it is a hard, incontrovertable fact that Ruby has more complicated syntax than python. It has many more special cases; parsing it is a harder operation than parsing python code.

As far as power, why do you think ruby has more powerful syntax than python?


XML is a complex, rapidly evolving topic.


Actually, XML is a very small standard, and doesn't really evolve.


Also, the number of people using XML (or Sun AU, or SGI IRIX stuff) is, IMHO, too small to justify bloating the distribution package with it.


I can agree with those feelings about the sunau or sgi stuff, but perhaps XML is packaged with the standard distribution to promote its use -- certainly more people will look into using it if it's right there.

Again, however, the marginal cost of adding another module to the standard distribution is practically nil. It's not bloat because it does nothing to make the language slower or heavier; if you don't feel the need to use a module, you just don't import it.


I agree, the documentation for ruby does need to be improved. However, check www.rubycentral.com (http://www.rubycentral.com) , as well as the book "Programming Ruby" -- that's where most of the docs are. That's also where the C API is documented.


So you think ruby is so much better than python that you'd buy a book rather than the use the extensive free documentation (and very helpful user community) of python?


Ruby Disadvantages:
- poor docs
- not much commercial support
- small standard library
- fewer users
- not ported to as many platforms

I think these will all be solved as Ruby gains market share


Those are significant disadvantages that will probably hinder ruby from gaining "market share" (as much as there can be said to be a market for free programs).

On the other hand, Python has the advantage in all those areas, and the community is growing very quickly.


none of them are issues with the actual language.


That doesn't matter. You could have God's own language, but if you and God are the only ones who use it, it's not going to be very useful.

(actually, God probably has a pretty big standard library to draw from http://www.linuxnewbie.org/ubb/smile.gif)


And that's where I think Ruby shines: when you get down to it, I find Ruby more convenient and faster to use than Python. I find it easier and more enjoyable to program in Ruby than in any other language I've tried, including Perl, Python, Java, and C. This is obviously a subjective assessment, but personally, that's enough for me to use Ruby whenever I can.


It's great that you feel that way, but looking at the growth of the two languages, I'm fairly sure you're in the minority. And given ruby's significant set of disadvantages at the moment (especially the dearth of documentation), I definitely don't feel that it's an appropriate language to recommend to a relative newbie.

Jeremy

klamath
01-31-2001, 04:37 PM
Actually, XML is a very small standard, and doesn't really evolve.


Perhaps XML itself (the actual 1.0 spec), but take a look at all the related stuff: XPath, XSL(T), XML Schema, XSP, XML-RPC, SAX, DOM, etc. Few, if any, of these specifications are stable, and they are all evolving rapidly.

It's great that you feel that way, but looking at the growth of the two languages, I'm fairly sure you're in the minority

I'm not so sure. Not very many people know about Ruby -- I don't think Ruby's slow growth is due to everyone hearing about it, taking a look at the language, and then rejecting it. More likely, few people know about Ruby, so there are consequently a relatively small number of users. However, as it gains more popularity, I'll wager we'll we a corresponding increase in the number of users -- and thus, the quality of the documentation, the number of modules, and the commercial support will all increase.

And given ruby's significant set of disadvantages at the moment (especially the dearth of documentation), I definitely don't feel that it's an appropriate language to recommend to a relative newbie.

I recommended Ruby because I think Ruby, the language, is the best designed, most flexible language I know of. For a newbie, it should be both easy to learn, easy to work with, and provide an introduction to basic programming concepts.

------------------
- Klamath
Get my GnuPG Key Here (http://klamath.dyndns.org/mykey.asc)
Looking for an open source project to contribute to? Check out the Tornado HTTP Server (http://sourceforge.net/projects/tornado)

nanode
01-31-2001, 04:58 PM
Jemfinch:

FYI: Although I haven't recently, I use irc.openprojects.net
my old LUG from San Diego is there - #kernel-panic

I'll look you up some time http://www.linuxnewbie.org/ubb/smile.gif

BTW: sorry you hate Java so much - if I seem to talk about it a lot, it because I code in it for 10 hours each day http://www.linuxnewbie.org/ubb/frown.gif