Re: Is there a better way to do this?



On Mon, 30 Jul 2007 13:48:29 -0400, Oliver Wong wrote:

For some problems, OO is the best tool for the job. For this problem,
I don't think OO is the best tool for the job. The problem specification
reads like a recipe, listing each step to be performed, and the order in
which to perform those steps. It is extremely natural to translate the
problem description almost directly into a procedural (i.e. non-OO)
program.

- Oliver

So what is the point of using Java if you aren't going to employ OO
techniques? I could have written it in Cobol, or Fortran or even...
gasp... C (well maybe not in C as fast as I could in Cobol) the assignment
was in a Java class :-) And I didn't interpret the assignment as do this,
then this, then this.... all I saw was a bunch of results that the
instructor wanted out the other end. And the only pre-requisite that I
could see was that the mean had to be computed before the stdDev as it was
used. Although, it would have been just as easy to include a computation
of the mean in the section that does stdDev, or better yet, call the
setStdDev method within.. but that seemed like overkill to me. So I simply
pass the mean into the stdDev method.

Anyways, it was an interesting exercise. My first program was a piece of
crap and it had bugs in it (thanks for spotting them Patricia). I think
my new program is pretty good, although there are probably improvements to
be made. My next iteration will probably make some of them.
.