for all things technical

Archive for September, 2009

Ruby vs. Java in Solving The Perfect Shuffle Problem, Part 3 of 3

Prev: The Perfect Shuffle Problem
The Code
Both Java and Ruby based solutions to the Perfect Shuffle Problem are available for download below. In addition to comparing styles, they are informative for anyone learning Ruby with a Java background, or vice versa.
The Java based solution is 82 lines of code, while the Ruby version is 76 lines. [...]


Ruby vs. Java in Solving The Perfect Shuffle Problem, Part 2 of 3

Prev: Introduction
The Perfect Shuffle Problem
The Perfect Shuffle Problem involves determining how many shuffles are required to return a deck of cards to its original order . The following is a formal definition from halfbaked.net.
Given a deck of nCards unique cards, cut the deck iCut cards from top and perform a perfect shuffle. A perfect shuffle [...]


Ruby vs. Java in Solving the Perfect Shuffle Problem, Part 1 of 3

Introduction
I once read a comparison of Java and Ruby that said, “Ruby is terse, Java is not.” And that was it.
OK thanks. I’ve read equally uninformative statements about English and Japanese. Such generalizations do not answer my main concern as a developer, which is why and when to use either language.
A more educational [...]