Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #3392

Re: Programming question determining two circle's relation

Date 2011-04-30 17:03 -0700
From Patricia Shanahan <pats@acm.org>
Newsgroups comp.lang.java.programmer
Subject Re: Programming question determining two circle's relation
References <892252a0-e31d-426b-8f47-d37c0b2ec364@17g2000prr.googlegroups.com> <ZbSdnTVJKocTTCbQnZ2dnUVZ_hCdnZ2d@earthlink.com> <511ca68f-7866-4658-9b2b-b1c0c013a030@a21g2000prj.googlegroups.com> <nospam-36D66E.17252830042011@news.aioe.org>
Message-ID <qIidnUiax7X4PiHQnZ2dnUVZ_sWdnZ2d@earthlink.com> (permalink)

Show all headers | View raw


On 4/30/2011 2:25 PM, John B. Matthews wrote:
> In article
> <511ca68f-7866-4658-9b2b-b1c0c013a030@a21g2000prj.googlegroups.com>,
>   byhesed<byhesed@gmail.com>  wrote:
>
>> On 4ø˜30¿¦, ø¿»Ÿ6‡ˆ08†­, Patricia Shanahan<p...@acm.org>  wrote:
>>> [...]
>>>
>>> If you have a calculation you need to do a lot, why not write and
>>> test a separate method to do it, rather than writing the
>>> calculation in-line repeatedly?
>>>
>>> [...]
>>
>> I know the source code I had posted is silly.
>> I do not perform any optimization because it is just an example.
>
> I would argue that the re-factoring suggested by Patricia is an
> opportunity to reduce error, both now and in future development or
> maintenance. I know it's tempting to dismiss the work as temporary, but
> we've all seen a prototype sneak into production.
>

I certainly proposed it as a means to the achieving correct code.

Not taking the square root, and doing some comparisons between squares
of distances, is a performance optimization that may or may not be
useful, depending on how often the code is run. It is premature
optimization, and a very bad idea, until the code is running correctly.

Patricia

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Programming question determining two circle's relation byhesed <byhesed@gmail.com> - 2011-04-30 01:33 -0700
  Re: Programming question determining two circle's relation byhesed <byhesed@gmail.com> - 2011-04-30 01:59 -0700
    Re: Programming question determining two circle's relation "Gavino" <invalid@invalid.invalid> - 2011-04-30 17:51 +0200
      Re: Programming question determining two circle's relation byhesed <byhesed@gmail.com> - 2011-04-30 09:01 -0700
        Re: Programming question determining two circle's relation "Gavino" <invalid@invalid.invalid> - 2011-04-30 18:33 +0200
    Re: Programming question determining two circle's relation byhesed <byhesed@gmail.com> - 2011-04-30 02:03 -0700
  Re: Programming question determining two circle's relation byhesed <byhesed@gmail.com> - 2011-04-30 02:50 -0700
    Re: Programming question determining two circle's relation byhesed <byhesed@gmail.com> - 2011-04-30 08:42 -0700
      Re: Programming question determining two circle's relation "Gavino" <invalid@invalid.invalid> - 2011-04-30 17:59 +0200
    Re: Programming question determining two circle's relation "John B. Matthews" <nospam@nospam.invalid> - 2011-04-30 17:25 -0400
      Re: Programming question determining two circle's relation Patricia Shanahan <pats@acm.org> - 2011-04-30 17:03 -0700
        Re: Programming question determining two circle's relation "John B. Matthews" <nospam@nospam.invalid> - 2011-05-01 03:10 -0400
  Re: Programming question determining two circle's relation Patricia Shanahan <pats@acm.org> - 2011-04-30 02:08 -0700
  Re: Programming question determining two circle's relation Roedy Green <see_website@mindprod.com.invalid> - 2011-04-30 11:49 -0700

csiph-web