Object-oriented solution to Tower of Hanoi



Hi all. First off, be gentle. I imagine what I'm about to present is
pretty amateur, but I've been a programmer for about 6 years and up
until now have gotten away with knowing little about math (real math --
the kind with few numbers and lots of letters and symbols).

But as my interest grows beyond the world of web-based applications, I
find my lack of math is hurting me -- I know a given problem can be
solved with math, but I can't do it with math because I don't know it.
So what I DO do is tell it like a story with objects (which I will
present below). In fact, most of my non-trivial algos read like stories.
They're longer than an equivalent solution in math would be, but I
understand it.

I've observed that most "real" algorithms are heavy with the stuff, and
my eyes glaze over when I see something as simple as solutions to the
Tower of Hanoi.

However, I do think I'm a pretty good at developing object-oriented
programs. I've read the literature from David West and done some
research on Alan Kay. It's becoming easier for me to see systems as
tiny, interrelated objects with few responsibilities, manipulated by a
director.

Anyway, here's my (long) object-oriented version of the ToH. Tell me
what you think. Oh, and if you have suggestions on where someone NOT
interested in going to college can do to learn the math necessary to
start programming "for real," please share! Thanks!

Here's the pastie: http://pastie.caboo.se/60604

--
Posted via http://www.ruby-forum.com/.

.



Relevant Pages

  • Re: Program Computes incorrectly under VPC.
    ... > can make about a computer and software is that it does math correctly. ... the Application Programmer, not the Operating System Programmer, to be aware ... of the possibility of overflow, and handle it if it occurs. ... you will find that Microsoft said what they are required to say. ...
    (microsoft.public.mac.virtualpc)
  • Re: Good math skills a requirement?
    ... discrete math. ... When I was in high school, ... was spent on geometry, trig, and calculus, to the point where we ... >> I don't see how a programmer would need anything beyond simple arithmetic ...
    (comp.programming)
  • Re: Will pay $$$ for an algorithm to lower a moving average of a series of numbers. Please help.
    ... My site works best on IE since I am not a web programmer and I use ... formula/algorithm that will help predict which subsequent prices are ... I stated it as a math problem to remove the noise ...
    (sci.stat.math)
  • Re: Fermats Last Theorem
    ... First of all read my statement of research see what I have said (on my new math). ... I need programmer not really for my lecture notes, since I know enough Maple to express myself. ... I need it, because there are many classes of polynomials and Riccati, including integrals, needed to be piled up in software for a computer reference. ... I have already described on my lecture notes recently, that Galois theory is incapable of solving higher degree polynomials, because of complexity of its inner structure. ...
    (sci.math)
  • Re: programming concepts > specific languages
    ... > I proper question is: how to be a better programmer. ... If it was that, i would suggest: MATH ... statistics and probability could be a very gifted programmer. ... compilers and peer to peer Internet applications just to list a few ...
    (comp.programming)