My first non-frivolous program in Ruby !!!

It has been done. (on Suse Linux 9.1 so Win Users have to deal with the newline diff)

The problem was taken from Starter Problems
To find a way thru a maze from point s to e. I tweaked the problem to read the maze from a text file (say "Maze.txt". The PathFinder creates a Maze object from the file, finds a way thru it and outputs the maze with the solution to a new text file (e.g. named 'Solution to Maze.txt" as per the input filename). The PathFinder is able to deal with mazes of any height or width as long as it is rectangular.

To do a sample run,
p = PathFinder.new
p.findPath( "TestMaze.txt" )
This would create another text file named "Solution to TestMaze.txt" with the solution .

Under Influence of XP

Was simultaneously reading Ron Jeffries' book (see previous post) :). I did this the XP way, by which I mean I had a test store that I kept stashing test cases into as I went along.
TestPathFinder.rb - run this via
ruby -w TestPathFinder.rb
for a test run. I could not find a NUnit like testRunner, for the red, green, refactor steps. So I made something really basic myself.. which I feel is pretty neat and helped me a lot.
The entire process took about 3 hrs including the tests, which is not bad by my standards.
The code has minimal comments at the same time, I feel it is quite readable. The only places I used comments are
  • to blow my own trumpet in the file header
  • I could not find a way to represent characters other than by using ASCII codes (71 instead of 'G'). Found another solution where he overcame this by using "G"[0].. (eww..)
Now how do I put a zip online so that it is free for everyone to access. Any ideas anyone ? Till I find something, drop me a mail if you are interested at
gishu underscore pillai at yahoo dot com

Extreme Programming Adventures in C#

Ron Jeffries
ISBN 81-7853-088-0. 500 pgs / Indian edition available

I completed my run thru a couple of days back. Since I purchased this book, I feel I am entitled to a a review (which I am always). So here goes..
Ron's style of writing is nice... technique sprinkled with good humor. In this book, Ron is new to C# and needs an XML editor for his web site (Xprogramming.com - which is also good). The book is the result of these circumstances. So Ron places you on his ear and lets you peek while he goes about writing an XML editor, tailored to his needs while simultaneously practicing XP (okay so he cheats once in a while but who doesn't. As I found out, it's pretty tempting when you don't have a pair and you suffer from 'Let me see if this hack would work!'.
The sublime moral that Ron drops on you every now and then is that it is okay to not have a detailed design upfront, rather get a rough working model and keep chipping till you are done. (And you are done when all your tests run! XP Explained - 'XP Yoda' Kent Beck). This approach along with periodic reflection and refactoring gives much better results.
I tried this with a problem in Ruby (this should be my next post) and I am happy with my work.
As a chronic whiner, I felt that the "Undo" chapters don't seem right where Ron is faced with a design-breaking XP story. I'll have to re-read those once again.

All in all **** stars, pick this up - should have a lasting effect on the way you code.

Me  Posted by Picasa

Smotchkkiss blinded by Ruby Sparkle

I tired of making WinForms in .NET (how ironic that they named it .NET, is it bcoz u just need to type in . for intellisense and choose whatever appeals to you at that moment. Your only choice in life is the next method (I choose Door No. 3 - oh crap! My Forms don't paint anymore or I need to read 20pgs to find out all the intricacies of dispose/finalize. Help ! Help ! Aaaarghhhhh.... ) Ok maybe I'm exaggerating but Fact of the matter is I'm bored !!

So I started looking around and I even got a book on Perl. But then there I see it ... Ruby - a Japanese language by Yukihiro "Matz" Matsumoto. Look up the Wiki for more on this.

I started with THE (free) book from the PPs, but found my self side tracked after 4-5 chapters. I solemnly promise to get back :)

Meanwhile I hit a good link, which so far is making me smile amid all the mess that I am in... Take a look at http://poignantguide.net/ruby/chapter-1.html

Another link is on how to get started on new languages.. i.e. finding something to do that helps learn(R). The next baby-step (R) (Kent Beck - XP Explained) after Hello World, which is a one liner in Ruby.
http://blogs.pragprog.com/cgi-bin/pragdave.cgi/Practices/Kata by Dave Thomas

What the .... I just inquired about the "pickaxe book", the 2nd edition of the book. It costs about 1.7K INR. (I might end up buying this anyway.) But am I the only one in this country who is still reading from books, instead of pdfs, htmls and other electronic blobs ???

My Links List

A list of links that I liked for some reason

Newer links at the top...

http://blog.james-carr.org/2006/11/03/tdd-anti-patterns/ [Dec 2, 2008] James Carr lists down the usual suspects in TDD land... things you shouldn't do and should spot as soon as possible

http://martinfowler.com/articles/injection.html [Aug 26, 2008] Martin Fowler lays down the law w.r.t. Inversion of Control/Dependency Injection

http://www.martinfowler.com/articles/mocksArentStubs.html#TheDifferenceBetweenMocksAndStubs[Feb 22, 2008] Martin Fowler defines mocks, stubs, etc - When is it a mock and not a stub ?

http://video.google.com/videoplay?docid=-5105910452864283694 [Jan 25, 2008]
Mary Poppendieck speaks at Google Tech Talks on Lean Software development. Nice summary of the underlying principles.

http://blog.wolfman.com/articles/2006/05/26/howto-format-ruby-code-for-blogs [Jul 25, 2007]
This one helps you to format ruby code for blog posts so that it looks pretty! And it's written in ruby. Awesome.

http://www.yoda.arachsys.com/csharp/threads/ [Nov 22, 2005]
This is where i learnt about threading in .NET. Just came back looking for this. So jotting it down.

http://www.ccs.neu.edu/research/demeter/related-work/extreme-programming/MockObjectsFinal.PDF [July 16, 2005]

A very nice paper on how using Mock Objects simplifies testing, improves design and induces the law of Demeter.

http://gigabyte-usa.com/Motherboard/Products/Products_7VM400M-RZ.htm [Sep 8 2005]Had a real hard time looking for their homepage.

http://www.theserverside.net/blogs/showblog.tss?id=TheArchitect [Aug 4, 2005]
This is a nice satire of the neverending incoherent tirade of the Architect in the Matrix; except that the piece is written such that the Architect is Bill Gates and the Matrix is Longhorn.. Vista!

http://www.25hoursaday.com/CsharpVsJava.html [July 20, 2005 12:28PM]

Interesting lil project. This one compares C# and Java w.r.t. what is different. I found that explicit interface implementation is not supported in Java. Notch 1 more to C# then...

http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/cvs/

This link is a tutorial to using CVS - a source control package.


GNU/Linux on a CD

I got a book called the Linux bible - what prompted me to get the book was the CD+DVD included inside, with a lot of distros.

I heard some good things about Knoppix - a distro on the DVD.
So I popped the DVD into a laptop, boot from the CD and voila !!
I have Knoppix - GNU/Linux running without touching my HDD ! No partitioning, no taking backups, nothing doing :) You can't get better than this.
What was even more surprising was that it detected almost everything without pestering me. I listened to an mp3 file on Linux for the first time ever and it sounded cool. Played a bit.. everything seemed ok.
I then reboot the machine. The OS politely ejects the CD and asks me to remove the disk and press Enter. I remove the disk and we have XP again.

I guess I'm gonna run it this way till I speak Penguin. The next distro in my scope is Debian "Sarge".. but that's later
That's my new thing for the week.. Ciao

The Imperial March

Over the past few weeks, I found that most of my posts on my other blog
www.-gishu-.blogspot.com were getting techier by the minute..
So I moved all those posts here. I now declare that this blog shall contain coderspeak
and nothing else.
Btw just got back from Star Wars III ! Bow down to Lucas n Gang. What have I done ...
I now re- declare that this blog shall contain coderspeak from now on...