views:

1453

answers:

12

I am thinking to learn programming language with dynamic type system.

Which one should I learn first?

Criteria:

  1. I can learn and start programming in a day or two
  2. Easy, Concise
  3. In few days I should be able to write small scripts for some batch jobs with file systems.

To mention, I am normally a quick learner.

+19  A: 

I recommend Python. It easily fits all your criteria. Great documentation and tutorials are available on line.

I have little experience with Ruby. I guess a Ruby programmer would recommend Ruby.

F#? Not so sure about that. I have a feeling that you would probably have more concepts to wrap your head around before being productive on F#.

codeape
Python is easy to pick up in a day or two. It's concise (supports OO, tuples, lambdas, some functional programming). Has good file system support.
gradbot
If you pick up Python, I would recommend deciding between 3 and 2. There are minor differences. I find 3 more elegant, but most libraries don't support it, so you might be better of with 3. I can tell you from experience that it is super easy to pick up, but incredibly annoying to debug. Make sure to get a good IDE (like PyDev) and arm yourself with a lot of patience.
Uri
@Uri: "so you might be better of with 3"... I think you mean "2"
User
+2  A: 

Both python and ruby meet the criteria. F# will have more of a learning curve if you've never done functional programming before.

sepp2k
+6  A: 

F# is a statically typed language - which is not a drawback per se. However, its functional paradigm might not be best choice if your main objective is writing programs for manipulating files, and could be hard to grasp if you've programmed in a procedural language before. Another disadvantage of F# is that it isn't entirely cross platform (yes, there is Mono, but it's lagging behind).

Python and Ruby seem quite similar really (even though I only know some Ruby basics), especially for your purpose. Python's main advantage would probably be a larger community and hence a larger body of libraries and learning material.

oggy
+8  A: 

Def look at Python if you are going to do a lot of scripting from a terminal. Dive into python is a very useful book to start with.

The newest version of Python is the Python 3000 version (Python 3.1), but I'm still doing the bulk of my work on Python 2.5. There are a lot useful libraries that haven't been migrated yet.

I'd recommend installing version 2.5 or 2.6 to get started. Once you have an interpreter installed, you can start in on the file system right away.

wongo888
+1 for Dive Into Python
kRON
+1 for (accidental?) joke in first word
Supertux
+4  A: 

F# is both statically typed and more complex.

Python and Ruby are both good fits for your requirements. Note, however, that Python 2 and Python 3 have some significant differences -- if you choose Python, you need to choose which one. I prefer Ruby myself.

Alexey Romanov
+17  A: 

F# is obviously incredibly bad for learning a language with a dynamic type system, because it doesn't have a dynamic type system. Quite the opposite: it's got a much more advanced static type system than the current mainstream languages, for example Java, C, C++ or its cousins C# and Visual Basic.NET.

As for the other two, I don't think that there is a clear winner.

However, for your first dynamic language, I would recommend Self, Newspeak or Ioke. All three of these are incredibly dynamic, much more so than Ruby or Python.

Unfortunately, Ioke and Newspeak are very new and Self hasn't been updated in a while (although it has picked up steam in the recent months), so, as an alternative I would suggest Io.

I personally find that when I want to learn about some new concept, it's easiest to learn it with a language that takes it to the extreme: static typing, functional programming and lazy evaluation in Haskell, OO in Self, class-based OO in Newspeak, syntactic metaprogramming in Scheme, concurrency in Clojure, fault-tolerance in Erlang, Design-by-Contract in Spec#, concatenative programming in Factor and so on.

One of the biggest problems newcomers on the Ruby mailinglists have, is that they are still writing Java, C#, PHP, C++, C, Pascal, but just with Ruby syntax. That won't happen with Self! The language is just too different, so that it will force you to embrace its dynamism. In Ruby or Python you will have to force yourself.

Jörg W Mittag
why not smalltalk? it's as object oriented as newspeak, a lot more mature, and has beginner-friendly tutorials.
Martin DeMello
What does object-orientation have to do with the question? The question was about dynamism, not object-orientation, and Newspeak is more dynamic than Smalltalk. In Newspeak, *everything* is a dynamic message send. In Smalltalk there are quite a number of things that are *not* dynamic message sends, e.g. lookups in the class dictionary (`Array` is always the same, whereas in Newspeak `Array` is just a method and can be overriden like any other), instance variable access and local variable access. Newspeak doesn't have variables, just message sends.
Jörg W Mittag
Also, even in its very early current state, Newspeak's IDE (Hopscotch) is a significant step forward from any Smalltalk IDE. I believe that a good IDE is paramount to explore the dynamism of a system. (Which is one of the reasons why I don't think Ruby or Python would be a good candidate, because their IDEs quite frankly suck. And I say that as a very happy Ruby developer.)
Jörg W Mittag
I believe you haven't inspected PyDev in a long time then, if you still think Python doesn't have a fitting IDE ;D?
kRON
Actually, I *am* familiar with PyDev. Let me turn your question around: I believe *you* haven't inspected Hopscotch, if you think PyDev could be even in the same ballpark. Just the fact that PyDev is an Eclipse plugin already means that it inherits all of Eclipse's problems. Also, any Python IDE that is not built on top of PyPy will have a very tough road ahead of it if it wants to compete with even a 1980s Smalltalk IDE.
Jörg W Mittag
+8  A: 

If you're going to consider Python, here are some of the things that you'll like:

  • Fantastic documentation, that makes for a great and readily digestible reference
  • A handful of built-in types and functions that you can cover in a matter of hours
  • The standard library ships with modules that already handle almost anything you need (helps you to become productive almost immediately)
  • Great community sites, such as PyPi
  • The free Dive Into Python ebook, as mentioned by wongo888, should make you a seasoned Python programmer in days if you already have prior experience
  • It's very easy to interface with your own or existing C/C++ libraries--for when you need that raw speed. When I say easy, it's just a matter of including Python.h and your set to go.
  • There's already a plethora of Python software in the open. Whatever your needs may be, there's probably someone who's already done it. You'll be surprised with the ease of using someones distributed code: you hook it in and it simply just works.
kRON
A: 

The best one language i seen to fun and learn is Scheme. It's described by nice and classic SICP book (it's free and video course free also). Scheme implementation for scripting in Unix environment is named Scsh. Current language definition and it's library described by short standart known as R[56]RS. Language is LISP based, has macro system, continuation and tail call support.

Do you really think this is the easy way to write small batch scripts?

If you know scheme then scsh is perfect tool to write small batch scripts. Just see examples here

ssp
Do you really think this is the easy way to write small batch scripts?
FarmBoy
A: 

I'm a python developer. It's quite good if you want to earn money in science, finance. At the bank where I work there are major projects both in F# and Python. Both are proven platforms.

If I HAD to learn a pure functional language alongside python I'd probably go for Haskell rather than F# - it's the daddy when it comes to advanced type-systems.

Salim Fadhley
F# isn't pure (not that it matters in these topic, but just saying).
fsanches
Also, F# has a pretty advanced type-system. :) After all, it integrates OO and functional types.
Nathan Sanders
+2  A: 

Python, IMHO. F#, as has been mentioned, is "right out" (to be pythonic ;). Ruby has more magic characters in its syntax than Python, you have to worry about braces, etc. On the other hand, it's closer to being 100% object-oriented. You can't go wrong with either Python or Ruby.

Kevin Little
+8  A: 

I was in the same position a couple of months ago.

I found Ruby easier/nicer to learn than Python, basically because I found the OO characteristics more refined ( and I have strong OO background having programming in Java all my [professional] life )

Python is multiparadigm, which means some things are not as I expect them.

For instance to know the length of a string I would type:

 "oscar".length()

In Ruby this worked fine.

In Python you have to type:

len( "oscar" )

Also from the interpreter if I wanted to display the available methods for a given object in Ruby what I expected did work

"oscar".methods()

But I Python I have to spend some time to find out I have to type:

dir( "oscar" )

I found also the constant need of using the "self" a bit annoying ( just a little because I don't really use Python that much )

I did a couple of scripts with Ruby, to extract information from log files, fetch data, etc. etc.

Currently I know too little about both anyway, and right now my choice is Python just because of the "Google App Engine" :)

Still, I think they both terrific languages. Learn both if you can. As for F# no comments.

OscarRyz
You wrote: '''"oscar".lenght() ... In Ruby this worked fine.''' WOW! Ruby has "do what I mean"!!??
John Machin
Try reading carefully what you wrote. You have missed the point -- you misspelled "length".
John Machin
A: 

Having been a Perl programmer for years who converted to Python, I would like to throw in vote for Python as it is my favorite language I know. Some people hate that it forces readable code on you by the required indentation, but I love it.

In many ways the sheer elegance in which Python gets the job done is in itself a lesson.

Down with braces, up with spaces!!

jathanism