views:

630

answers:

22

I'm trying to learn C++, but it's hard. I'm thinking about trying to learning something else instead of C++. I prefer programming languages similar to Ruby.

+1  A: 

There are a lot of scripting languages out there, but Python comes to mind quickly.

If you want other programming languages that are different than Ruby, but closer to C++, I would recommend Java, simply because there are a lot of resources out there aimed at people of all skill levels (from no programming experience through seasoned veteran).

Thomas Owens
+8  A: 

Perl is fun. And very similar to Ruby.

Some people think that using perl automatically means that your code looks like spaghetti. Maybe for them it does. Perl has a lot to offer for everyone. It has some aspects of imperative programming (like C), some object oriented programming (like C++, Java, C#), some functional programming (like Lisp) and lots in-between (apologies to the many languages that I left out). And if you are really good, bits of your programs might even read almost like an English sentence (it's creator, Larry Wall, is a linguist with an interesting sense of humor). For advanced text handling/munging, I can't think of a better tool. I use Perl regularly for various utilities that I keep around to help me work more efficiently.

Perl doesn't enforce any stylistic conventions (unlike Python), in fact for almost any aspect of perl, "There is more than one way to do it". I believe this is what scares a lot of people off from the language. There may be a perfectly easy way to write a beautiful piece of code, but there may be an equally easy way to write an ugly piece of code to perform the exact same task. Back during the first internet boom, Perl was very popular, but apparently learning to program properly (like writing maintainable code) wasn't.

Getting started with perl is quite easy, as there is no required boilerplate:

print "Hello World!\n";

I also usually prefix my programs with:

use strict;
use warnings;

Which tells perl to be more strict and verbose about potentially programming problems. The book Learning Perl (now in its 5th edition) seems to be one of the more popular ways to learn the language, but there are also plenty of guides on the internet, and Perl itself comes with very good documentation.

For completeness, I should add that I also like Python. As a language, and also from the perspective of third-party libraries (I work with Red Hat/CentOS/Fedora a lot, and it seems like most of the tools and infrastructure are written in Python), Python has much to offer. Contrasted to Perl, Python offers a more rigid syntax structure, and the general trend seems to be toward "there should be a single canonical way to do it". There are strengths to that argument, but remember, everything in moderation, your mileage may vary, etc...

Python is often used as a counter-example to anything Perl. Python's strict syntax rules mean that for most programs, most of the time, your program will be formatted nicely. It's still quite possible to write unreadable code in Python, just as it is easy to write readable code in Perl. There are times (rare though they may be) that Python's rigidity means that you can't format your source code in the most readable way possible.

As always, pick the best tool for the job. And learn lots of programming languages.

Adam Batkin
+1 - Not many fair opinions about Perl on this site.
Chris Lutz
but Perl is a site programming language
Delirium tremens
You can do a lot more than web programming with Perl.
Thomas Owens
@Delirium tremens: That is just one of its uses.
Alan Haggai Alavi
If he finds C++ difficult, he's going to find Perl even worse. I don't understand how anyone can look at all the spaghetti code with string computation and regular expressions all over the place and figure out what the hell is going on in the program.
Michael Aaron Safyan
Hi @Michael Aaron Safyan, if you do not know anything about Perl, then probably you shouldn't comment.
1800 INFORMATION
Write once, read never!
cfeduke
@1800 INFORMATION, I have used Perl enough times to comment.
Michael Aaron Safyan
Reading your previous comment makes me think otherwise. I however have forgotten more Perl than you obviously ever will know. Programming well in any language (not just Perl) requires skill, a sense of design and taste.
1800 INFORMATION
It saddens me to see that people have such uneducated opinions on Perl :(. Yes it's possible to write unreadable code in Perl - it's possible in any language.
Falaina
@Falina, yes, but not many languages encourage that as Perl! XD
fortran
@Michael Aaron Safyan: there's a difference between "exploded guts" and "spaghetti code". Any language that supports a `goto` allows spaghetti code. Perhaps you just knew a lot of spaghetti-*coders*.
Axeman
+6  A: 

Smalltalk.

Python.

Justice
+3  A: 

Ruby. just to be smart.

WalterJ89
+2  A: 

There is Groovy with at least closures and the last statement of a block is the return value of the block if I recall it correctly so they are somewhat similar.

Janusz
+1  A: 

Grab the PickAxe book (you can find it online for free but for an older version). Ruby is a pretty good little language and has a VERY good community. Don't give up yet!

Brian
He knows Ruby, and wants to learn something else.
Thomas Owens
+15  A: 

Python, Perl and Smalltalk each have several points in common with Ruby, because Ruby's designer was inspired by each of them in some measure.

Alex Martelli
+3  A: 

Why not use Ruby? If you have a specific reason, then you could try Python, Perl, or even Scheme.

EDIT: Lua is also a good option!

akway
Is it wrong to want to learn something new?
Thomas Owens
I wasn't aware he already knew Ruby... I never said not to learn something new.
akway
Ruby is a site, not a software programming language. I want to program softwares.
Delirium tremens
Is it actually "learning something new" to learn something similar to what you already know? :)
Roberto Bonvallet
Ruby IS a programming language. What are you talking about?
akway
oh, i mean that Ruby is a site programming language, not a software programming language.
Delirium tremens
Is there really that much of a difference? You can write non-web software with most "web scripting" languages, including Ruby.
mipadi
There isn't really a difference, just a lot of people use Ruby for server backend programming. I suggest using Python though specifically for desktop apps, as it is faster than Ruby and with unladen swallow coming out, you will be able to compile it and have it run very fast.
akway
Alex Martelli
+4  A: 

Lua might be worth a look.

Stephan van den Heuvel
A: 

I guess your question was What is Ruby like- is it difficult to learn or easy? If that's the question - Ruby is easier to learn than C++ because it is a higher level language in many respects than C++. You have lots of options from the core language and easy to get stuff done. But C++ is more basic and it will enable you to learn a lot of core CS material and better aligned with Java, C# etc.

satyajit
+1  A: 

They're not like Ruby but if you're finding C++ to hard you might try Java or C# they both have similar syntax to c++ and so would be easy to move to from C++.

Tom
+1  A: 

Learning a dynamic language like Ruby or Python won't teach you much about C++.

The initial fear of languages "being hard" goes away after a little getting used to.

I'm curious, why do you want languages like ruby, but not ruby? Ruby is awesome :)

Ben Scheirman
I want Ruby, but later. I already know PHP, so I already know a site programming language, but I don't know ANY software programming language.
Delirium tremens
Most languages can be used for general purpose programming - even PHP. Ruby is no different. You are confusing Ruby with Ruby on Rails. Learn Ruby.
cfeduke
A: 

Maybe Processing? I don't know it very well myself so I'm probably in a bad position to recommend it, but given its graphics/visualization focus I can see it being something that will grab your attention better than writing Hello World command-line apps. The syntax is like the C/C++/Java language family though.

Whatever
+5  A: 

According to the Greenspun's Tenth Rule of Programming, you should take a shortcut - and look at Common Lisp.

p.s. this is intended as a joke, not as a flamebait :-)

Andrew Y
This is not a joke. I wanted to propose Common Lisp myself, in all seriousness.
Svante
The origin for suggesting Lisp was not a joke for me either (e.g.: http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp), but I thought the "Tenth Rule" might sound a bit arrogant if not explicitly clarified.
Andrew Y
+1  A: 

Before you completely give up on C++, give Accelerated C++ a read first. It tries a new approach at teaching C++ that is actually pretty good.

Anyone have bets on how quickly this gets down voted?

D.Shawley
A: 

Python is a great lightweight language thats easy to pick up and be productive with.

I generally think of ruby as Perl + Smalltalk + Python.

So, if you like the scripting (just hack and go) feel of ruby, defiantly check out either of those two. On the other hand, Ruby's object model really comes from Smalltalk. If you like dealing with ruby objects in a clean, consistent way and languages like C give you the heeby-jeebies, defiantly look at smalltalk. The syntax tends to scare people with a C++/Java background, but coming from ruby you should feel pretty comfortable.

Alex
A: 

Groovy :)

it is as easy as ruby but with power of Java.

nightingale2k1
that argument is weak now that there are implementations of Ruby (JRuby) and Python (JPython) on the JVM.
banister
+1  A: 

I've been learning scala with Odersky's book. It's still very much JVM and java lib based, but the syntax, actor model and functional aspects are surprisingly flexible.

As far as the metaprogramming / DSL aspect of ruby, javascript and scheme fit the bill, for more mainstream dynamic/ scripting languages. And i think Ruby's debt to to haskell and smalltalk has been acknowledged

Gene T
+1  A: 

For things like this, I often reference Wikipedia:

Influenced by: Smalltalk, Perl, Lisp, Scheme, Python, CLU, Eiffel, Ada, Dylan

Influenced: Groovy, Nu, Madness Script

You might also refer Comparisons of Programming languages on Wikipedia. It may help to answer your questions in greater depth.

Frank V
+2  A: 

Quitting because it's hard? I really don't think Ruby or any other language will be easier. When you are starting out it is all about fundamentals and C++ has all the fundamentals (OO, non OO alike, generics, etc). C++ is a great place to start because you can branch out easily to all of the related languages (Java,C#, and C).

Give a look at the Savitch book http://www.amazon.com/Absolute-C-Walter-Savitch/dp/0201709279

Is a great book for learning C++

Maestro1024
+1  A: 

Scala is a statically typed language that is quite similar to ruby in many ways

banister
+2  A: 

Scala - inspired from many languages such as Ruby, Erlang, Groovy, Java, LISP etc

JRomio