28 Comments
- sdbarker, on 10/12/2007, -1/+13Other useful exercises are to port existing applications that you've written to the new language (if feasible). You shouldn't be trying to port an AI game you wrote in LISP six years ago for some college course to Ruby on Rails. That just doesn't make sense.
- sdwebguy, on 10/12/2007, -0/+4Good article, but a bit of blog spam. Here is the original post by the original author:
http://smartprogrammer.blogspot.com/2006/04/15-exercises-for-learning-new.html - tknd, on 10/12/2007, -1/+5I'm not sure why this is so great. The basic message is in order to learn a programming language well, you must USE it and not just read about it.
Given that you are going to spend some time using the language to do something or another, why waste your time reimplementing the same programs (some of which are sort of useless) just to learn the language when you can implement a concept that you think you will have a good shot at using often? In otherwords, why write a simple program just as an excercise when you could instead write a library of utility functions and programs that will actually help you later on? Would not not only serve as an excercise but also a potentially useful tool in the future?
A trivial example is Java "println" method in the System object. Other languages like C and Perl have no such method, but instead a generic print or printf method. Wouldn't it be worth your while to reimplement "println" in C or Perl (correctly in the .h file in C or module formats in Perl) so that at a later point you could reuse the function you wrote regardless of how bad it was written? And maybe a few months later you'll look at what you wrote in the past and say you can write that function in even less or more elegant code. "Hah" you say, I can just add n to the end of the string and there's my println. Ok, implement "println" into javascript without document.write. Need a hint? Write your output to a pre-defined DIV element. Be sure your javascript "println" doesn't overwrite the previous contents of the DIV, but appends to it. Go that far? Make it so your println can automatically append a DIV element to the document if the predefined DIV doesn't exist.
A more useful example for applications of today is reimplementing the SQL command line shell into a server-side script or webpage thingy. All it needs to do is accept a SQL command from a webpage text box execute the command on a pre-defined database instance, and return the results of the command as an html table. If you're smart, you'll use the GET method for the form that way you can bookmark your result. Voila, your own view of a database table without anyone else's tools. Need to learn the database or language better? Modify your script so that it only outputs at most 100 records. (Be careful to control access via your webserver or another method so nobody has access to the script but you and prevent any commits or autocommits and special create/alter statements.)
Maybe I've been through this whole learning new programming language routine too much that I don't care about it anymore. When I start learning a new language, I immediately compare it to all previous languages I've learned at the conceptual level (how the language manages true and false values in it's branch operations, how the language does error handling, what OO concepts the langauge supports if any, unique features of the language like perl's regular expressions, Javascript anonymous functions, etc) and not the syntax level. Syntax is easy. Debugging is easy so long as you have some sort of method of printing output somewhere (not necessarily the screen!).
Sure, you won't be writing elegant code right away, and you almost never will right at the start. But if you're going to use time to train yourself, you might as well attempt to make the results of your training useful in the future. - jesusphreak, on 10/12/2007, -0/+4Honestly the best way to learn a language is to make somethign you are interested in. This means you'll keep developing on it and continue to learn new things as you run into new ideas for the program itself. And heck, it is just productive.
- nepawoods, on 10/12/2007, -0/+3"I'm not sure why this is so great."
I'm puzzled too. There is nothing about the choice of exercises that gives the impression they were carefully selected to help one learn a new language. It seems like a random collection of assignments from a first semester programming course. - shawnlane, on 10/12/2007, -2/+4I do something similar to this and it does help learn a new programming language quickly.
- pumacub, on 10/12/2007, -1/+3I find doing exercises like these _right before_ going to bed solidifies them in your memory.
- verifex, on 10/12/2007, -1/+3If you like the language, and you have ideas for building something with that language, then all it takes to learn it is a curious mind and a persistent body.
- cazabam, on 10/12/2007, -5/+6Memory management is menial. Choosing the right algorithm is menial. Knowing how to do things effectively and efficiently in your chosen technology is menial. Like anything else, good programmers practice. Do you think that opera singers don't still practice their basic scales? Of course they don't do it as often, but they still need to be able to do it. So it is here - I don't do these kind of exercises regularly, but they are useful practise 'just because'.
The beauty of 'just because' code is that it takes you beyond what you are already doing. It lets you branch out into something new. Suppose I want to write a new basic GUI for something, and it turns out that Python is ideal due to its libraries, simplicity and compatibility. If I'd never written a line of python in my life, would I start the project hoping to find enough scraps of code to copy/paste my way to a working application? Hell no. I'd learn the basics of the language. Manipulation of types, arithmetic, logical flow, that sort of thing. Until I can do those things proficiently, how can I ever trust that my copy/paste code is good enough? - hackwrench, on 10/12/2007, -0/+1Why build a rocket that will not leave the atmosphere when we've already got planes that do that. Why not build rockets with the sole intention of leaving the atmosphere.
The point is that in order to do the hard stuff in the new language, it's much easer if you understand what things you are familiar with are supposed to look like in the new language. - willhaney, on 10/12/2007, -0/+1The Devil is in the details.
- asdf25, on 10/12/2007, -0/+1Huh. Well that was a rather useless arbitrary selection of 15 simple programming tasks. Author could have saved a lot of time by just saying "write a bunch of small programs that do common simple tasks".
- elnerdo, on 10/12/2007, -1/+2Every time I learn a new language, I make a brickout game in it. This helps me get accustomed to the syntax and to some of the quirks of the language (Multidimensional array of bricks, in OOP languages, objects for the different objects in the game, etc).
- genetic, on 10/12/2007, -3/+4these exercises are obviously to get you familiar with the syntax, mr. menial. gotta start somewhere
- katjoek, on 10/12/2007, -0/+0As I'm learning Ruby I thought I'd give it a go. Man, I still haven't got past exercise 1!! I didn't expect to need multi-threading or platform-dependent tricks to have non-buffered input or have trouble doing non-blocking input. And I thought this first exercise was going to be an easy one... I tell ya, creating a webmail application using rails is easier!
- imightbewrong, on 10/12/2007, -1/+1very nice, i like
- rubycon, on 10/12/2007, -0/+0Just in case anyone is still reading this:
I have implemented the exercises in Ruby (well, I could not solve the non-buffered keyboard input either :-)
http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/ - BrokenBeta, on 10/12/2007, -0/+0I agree with Tyr7BE, actually, to a point. I don't think doing all of this is necessary to get a grip on it. Chances are what you'll be asked to do will be specialised in a different direction anyway. It's more important to have good research skills to be able to find the information when you need it.
Although going through this list certainly won't do harm! - yano, on 10/12/2007, -0/+0I'll have to give this a go. I'm currently in the process of learning C++ and Python.
- linkinpark342, on 10/12/2007, -1/+1me too, though I always start out with the good old fashioned "Hello World!" =)
[edit: *reads site*]
I recant my statement! - yogastore, on 06/30/2008, -1/+0http://astore.amazon.com/calphalon.commercial-20
http://astore.amazon.com/calphalon.contemporary-20
http://astore.amazon.com/black.and.decker.lawn.hog ...
http://astore.amazon.com/black.and.decker.oven-20
http://astore.amazon.com/cast.iron.skillet-20
http://astore.amazon.com/12.electric.skillet-20
http://astore.amazon.com/6.quart.pressure.cooker-2 ...
http://astore.amazon.com/electric.pressure.cooker- ...
http://astore.amazon.com/8.inch.chefs.knife-20
http://astore.amazon.com/chefs.choice.knife-20 - inactive, on 10/12/2007, -8/+1perfect, I remember when I learn 2.nd programming language by myself I figured this out like everyone so maybe that who doesn't know how to learn a new language don't have logic aka better if don't want to write any program
- inactive, on 10/12/2007, -11/+2Program an A.I.
- Tyr7BE, on 10/12/2007, -15/+6Seems kind of menial. I'd consider a day spent swapping fibonnaci numbers and counting up and down in an infinite loop to be wasted time. I just look for existing code that does something sort of similar to what I need, and shape it into something I can use. The more you work with the code, the more familiar you get, the faster you get things done. Consider it re-directing your ramp-up time to useful ends.
What is Digg?
The Digg Toolbar for Firefox lets you Digg, submit content, and keep track of Digg even when you're not on the Digg site. Download the official