tags:

views:

1101

answers:

20

I've been trying to learn Python and/or Ruby since I read about they characteristics, my problem is that I always learn more when I actually need to solve a problem, than working on merely theoretical problems.

I've tried to make some scripts for file management, and actually did some good scripts to copy files or parse HTML but at the end or I don't have the time or I get bored because I don't really need them in my daily job.

I have about 8 yrs. of Java and I think I'm very proficient in it. So when I really really need something I end up doing in Java (for instance start with a directory and walk through the file hierarchy and read o bunch of jar files in to find out where a particular class is, when I got the ClassNotFoundexception). I tried both Python and Ruby at the beginning but since I do not know the API for reading zip files I ended up by doing in Java.

Same thing happened to me when I tried to learn some java specific technology , like ORM, EJB, Java Server Faces ( which I still don't know ) or Spring ( which I don't know neither ) . I only learned the first two until I worked on a project that needed them.

I think that going through a tutorial, reading a book and that kind of stuff bores me.

Do you have any suggestions to actually learn any of these two beautiful languages, other than change my job and start from zero as junior-- programmer? :P

Thanks and regards.

+4  A: 

What are your interests? Develop an app to track your DVD collection, your Scuba dive profiles, your marathon training - who knows it could become a business!

Martin Beckett
Gee..I'm a developer I dont' have a life, remember :P .. Just kidding. mmmhh let me see... . o man... :( .. Source code files???
OscarRyz
Thats why 99% of software startups try and develop developer tools!
Martin Beckett
+15  A: 

How about this to get started: Python Challenge

I have spent the last week working through the first 10 puzzles and its fun to solve and then study the solution people come up with. You learn alot!

EDIT: I also try to do every day things with Python now. Even if it takes longer than doing it manually or using any other way. For example, I wrote a little app that I pass a link from www.archive.org (great free live shows!) and it downloads the songs in SHN format or mp3 to my hard drive. I am using html scraping to find the links and then process the link list one after another. Fun project...and useful. :)

cschol
A terribly good way to learn more Python than you ever wanted to know. When you finish the last level you WILL know how to do most day-to-day programming tasks with Python. HAVE FUN!
Joe Skora
2 38 ???? WTF.... ohhhh I seee..... mmhh now I'm interested.. How would I do this in java... ehm... I mean Python??... I'll take a deeper look .
OscarRyz
Well. After 5 hours I've managed to solve 5 riddles. I give up for now to challenge #6... :S :S.... Very interesting indeed.
OscarRyz
+1  A: 

Don't give up when you don't know how to do something. For instance, manipulating zip files within Python is really really easy:

Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from zipfile import ZipFile
>>> zip = ZipFile('Archive.zip')
>>> zip.namelist()
['bmc_article.pdf', 'fig1.pdf', '__MACOSX/', '__MACOSX/._fig1.pdf', 'fig2.pdf', '__MACOSX/._fig2.pdf', 'fig3.pdf', '__MACOSX/._fig3.pdf', 'response.txt', '__MACOSX/._response.txt']
>>>
daniel
+2  A: 

An IRC bot is a great first project! It's quite rewarding too, instant gratification from talking to the beast you crafted out of the ether. See this thread for some other suggestions.
Pander to your own intrests though! Pick something you find exciting!

(Also, a bit of googling would have turned up the solution to your zipfile problem. Don't give up so quickly!)

William Keller
+2  A: 

I suggest solving algorithmic problems at sites like Project Euler and SPOJ. You won't get bored because the problems are relatively short and there are many of them to choose from. It's also a good way to improve your skills as a programmer.

Alexander Kojevnikov
+2  A: 

Do something worth while. I find that I am more motivated when working on something that isn't just throw-away. Find a non-profit or cause with a need that you feel compelled to support and offer to develop something for them for free.

mbrevoort
+2  A: 

There are a couple of sites that have versions of "These are the exercises to learn a new language"

Like This One

And This One

I use a version of this method for each new language I come across.

KevDog
A: 

If you really want to pick up a scripting language AND leverage your Java knowledge, take a look at Groovy. Similar to Python and Ruby in many ways, it is a dynamic/scripting language, but it has been design for the JVM from the start.

Joe Skora
I tried some time ago, but being so close to java and lacking of IDE support drove me crazy. I'll give it a try again.
OscarRyz
A: 

I was lucky enough to be given a rather large, challenging project that simply begged for a good, object-oriented scripting language. I'd been programming in PL/I or C/C++ since '77, but I knew the project really demanded a language that could be used to orchestrate lots of tasks under Linux, and work closely with the available shell commands. I also knew I did not want to do it in bash! (ugh!). So I gleefully dove into Python, and have not looked back in 5 years.

So, what projects could you find where you currently are that would benefit from a more flexible language like Python or Ruby? Java's gotten rather, um, "large", IMO. Find a non-trivial project that is "just right" for a dynamic scripting language, and convince your managers to let you test the waters.

Good luck!

Kevin Little
+2  A: 

If you can't think of a real problem, try to find a problem which is:

  1. Someone else's
  2. Interesting!

My first real foray into sitting down and writing Python from scratch was writing a bunch of web scrapers for someone who posted a request in the "Ask The Forum" section of a mostly-gaming forum I post in. I did my Masters dissertation on Robust Web Scraping, writing the practical component in Java, so that was a perfect fit for me (hugs for BeautifulSoup).

Sitting in an IRC help channel for a while can also present you with some interesting problems to solve (and you'll also learn many, many solutions to common problems which people keep coming up with).

Stack Overflow itself would be a goldmine of interesting questions to be solved as an introduction to a language, were it not for its denizens being so quick on the draw with knowledgeable and helpful answers ;)

It always pays to have a good rummage through the standard library too, as your zip file example shows.

insin
+8  A: 

Check out Project Euler

benPearce
+2  A: 

I'm always looking for an opportunity at work to use a new technology on my projects. In fact I assert that my employer owes me these learning opportunities and I consider them to be a crucial part of my compensation.

With respect to Python and Ruby, I found myself more or less in the same boat. Starting from scratch is frustrating. I was able to use Python on the job when authoring some plug-ins for Trac, some Subversion commit hooks, etc. I enjoyed it, but there's still quite a gap to bridge between the small projects I completed using Python and the much more substantial Java work that makes up the bulk of my responsibilities. There just is no reasonable opportunity at all for me to use Ruby at work.

I found this to be quite troublesome, as those languages (Python, at least; I know much less about Ruby) offer features that enable programming techniques that just are not usable in Java, like first-class functions. I deliberately say 'usable' rather than 'possible' because you can emulate functional programming using functors, but the effort is so substantial that it may exceed the benefit. You can emulate object oriented programming by passing a struct around as the first argument to every procedure, too, but that doesn't mean anyone actually does it.

I've recently started using Groovy, which is a more gentle transition to the world of dynamic languages for Java programmers. It is 100% interoperable with Java. All the Java code, idioms, libraries, etc. that I already know are still available to me with Groovy. At the same time it exposes me to the idioms common to dynamic languages like Python and Ruby, including closures, dynamic typing, meta-programming, etc. Even within a single project I can mix Groovy and Java code transparently. As a very trivial example, today I wrote a Java class that inherited from a Groovy class.

I've only been looking at it for the past month or so but I've already used it to very good effect in at least one place where Java code would have been brutally unwieldy.

I know there are other dynamic languages that run on the JVM and can take advantage of the Java libraries etc., such as JPython and JRuby, but those languages were not designed from the ground up to run on the JVM. I find working with Groovy to be very comfortable, much more so than my work with Python. My IDE supports it, there's a Maven plugin ... I don't have to learn a new build system, a new IDE, a new standard library, new frameworks, etc. all at once.

I could become proficient in any language, but the investment makes it impractical, at least at my job. Using Groovy allows me to enjoy the real benefits conferred by using a dynamic language without impairing my productivity.

You should check it out.

I've tried Groovy as well some time ago... but being so close to java and don't have IDE support drives me crazy. I think know things have changed, at least on Intellj IDEA and I believe in Netbens too. I'll give it a try again.
OscarRyz
I use IntelliJ. The Groovy support is really good.
+1  A: 

Open source projects. Get started by reading the code and writing additional tests. Check out the Refactotum series from Relevance.

MattMcKnight
+1  A: 

On Ruby side, check out this screencast series. Very inspirational on the power of dynamic languages. I think you're just not inspired enough :)

ryw
A: 

Thanks everyone... It looks like the coding challenges are quite interesting....

I'll let you know the results.

OscarRyz
+3  A: 

I think, you are on the right track: just use them. You don't have to implement entire applications in Ruby or Python, and you don't have to solve boring puzzles or read introductory books either. Here are some ways to allow you to "ease into" Ruby and Python from within your current Java work.

You can try to incorporate Ruby and Python into your daily work, without having to fully leave your comfort zone. Use Rake or Rant instead of Ant. Use Buildr or Raven instead of Maven. Use Shoulda, Expectations, Dust, Bacon, test/spec or RSpec instead of JUnit. Use Mocha, FlexMock or SchMock instead of JMock. There are JVM implementations for most agile dynamic languages, including Ruby (JRuby) and Python (Jython), allowing you to mix Java and Ruby/Python freely, and to call Java libraries from Ruby/Python.

Just as an example: James Duncan Davidson, who is famous for being the author of Ant, now doesn't even have Ant installed anymore. He uses Rake for his Java projects.

JTestR is a pretty cool tool that includes everything you need to test Java code from Ruby in one single JAR: JRuby, RSpec, Expectations, Dust, Mocha, ActiveSupport and Ant and Maven integration.

So, anyway, that might be one way to use Ruby or Python: instead of implementing an application with them, implement everything around the application with them: tests, mocks, build scripts, release automation and so on.

The JVM implementations JRuby and Jython also give you another good opportunity: leverage Java libraries. If you have an application, where most of the work is in pre-existing libraries and all you do is glue them together, then Ruby or Python will be an excellent glue. In your example above, if you can't figure out, how to work with JAR files in Python, but know how to do it in Java, just call the Java libraries from Python. You can always replace them with Python libraries later, once you figured them out.

Jörg W Mittag
+2  A: 

You could start learning how to write for the Google App Engine, which is based on Python. That is, if having potentially millions of people using your Python application is a motivation for you. :-)

Aputsiaq
+1  A: 

I found one my self. Enso. :P http://code.google.com/p/enso/

OscarRyz
A: 

When I wanted to learn RoR I asked some of my friends if they had any side projects they were thinking about doing. I found a couple and did some prototype work for them. This has the benefit of getting to do some greenfield development, as it is easier to start that way, you get to help out a friend ( should get you a couple free lunches), and a pretty good excuse to learn a language.

have fun

Nathan Feger
A: 

I really had some good experiences with rubywarrior and cheatsheets. It is a "game" where you program an artificial intelligence to play a game, and it helped me thinking in ruby at least, but it may be too basic for you.

Another very nice little one is ruby quiz (sorry, I am not allowed to post more links since I am new, but you will find it with google) which have a list of some small ruby projects you can try, it also have a lot of examples for each of them, so that you can get help if you need it. I think it is absolutely worth a try.

torerling