comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: Ada Queue
Date: 2000/04/06
Date: 2000-04-06T00:00:00+00:00	[thread overview]
Message-ID: <8cisft$jtg$1@nnrp1.deja.com> (raw)
In-Reply-To: 38ecc752@news.hamilton.edu

In article <38ecc752@news.hamilton.edu>,
  "Joseph T" <thisthat7@hotmail.com> wrote:
>
> I need to explain why I chose to iterate through using the variable
> that was passed instead of the temporary variable.  The only thing I
> can think of is that I tried it and it worked.  Trial and error.
> Perhaps it's not as efficient, or logical, or conventional..but it
> really doesn't make a difference as long as the proper variable of the
> queue is returned.
>
> I was wondering if any one could shed some light as to another reason
> this solution works well, or why someone might choose it.

Ahh. So, to extrapolate, you are probably a student having a
disagreement with an instructior or T.A. about the desirability of
writing your queue the way you did. So you want a technical discussion
of the merits of your code which will (you hope) be in your favor.

I guess you wouldn't have asked the question the way you did if you
could see any real benifits to the aproach you took over the other. In
this case I agree with you, I can't see any benifits to it either. I do
see two drawbacks to doing it the way you did it:

1. Its a bit more awkward, which makes it tougher to understand. In the
"make it run once" situation of a class assignment that may not seem
like much to you. But if you ever want to make a carrer of this (and
that is what your instructiors are tasked with training you for),
confusion often translates into bugs. Bugs translate into lost time and
effort. For a professional that is a *big* deal.

2. Your method requires an extra assignment to put the original value
back into the parameter. If you had used New_Queue for the iteration,
you wouldn't need that assignment. Admittedly one assignment doesn't
amount to much in a O(n) algorithm. But why waste CPU when there's no
compelling reason to do so?

Your instructor (or whoever) is quite right to challenge you on your
implementation of the algorithm, whichever way you implemented it. You
should be prepared to answer such challenges on any part of your code.
If your only answer is "that's the best way I could see to make it
work", that's fine. But in that situation, be open to better approaches.
No one wants to work with code that was developed by someone with a
"whatever works is good enough" attitude.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




  reply	other threads:[~2000-04-06  0:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-06  0:00 Ada Queue Joseph T.
2000-04-06  0:00 ` Ted Dennison
2000-04-06  0:00   ` Joseph T
2000-04-06  0:00     ` Ted Dennison [this message]
2000-04-06  0:00       ` Joseph T.
2000-04-07  0:00         ` Ted Dennison
2000-04-07  0:00           ` Hyman Rosen
2000-04-07  0:00         ` Ole-Hjalmar Kristensen
2000-04-07  0:00           ` Joseph T
2000-04-07  0:00             ` Ted Dennison
2000-04-06  0:00     ` Robert Dewar
2000-04-06  0:00       ` Joseph T
2000-04-07  0:00         ` Ole-Hjalmar Kristensen
2000-04-06  0:00       ` Ted Dennison
2000-04-06  0:00     ` tmoran
2000-04-08  0:00       ` tmoran
2000-04-07  0:00 ` Simon Wright
2000-04-09  0:00   ` Robert Dewar
2000-04-07  0:00 ` MaggieJohn
2000-04-07  0:00   ` Ted Dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox