Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > method calls faster than a loop?

Thread Tools

method calls faster than a loop?

Roedy Green
Posts: n/a
On Sat, 18 Mar 2006 10:12:57 -0000, "Chris Uppal"
<(E-Mail Removed)> wrote, quoted or indirectly
quoted someone who said :

>> But I wonder whether anyone has ever seen a situation where a
>> serious bug or problem was caused by a forgotten »private«
>> keyword?

>I doubt it if happens often

It happens more this way. You work on the core class and modify it,
not thinking about the clients using it. You change the semantics of
some the method and adjust the callers accordingly. You don't charge
the method signature though. Everything compiles fine, it is just
that clients of the method OUTSIDE the class suddenly stop working.

IF the method you change is private there is no danger. If it is
public. you have to be careful to find all the clients. IntelliJ
won't find them all, just the ones in the current project. This is
where Eclipse shines.
Canadian Mind Products, Roedy Green. Java custom programming, consulting and coaching.
Reply With Quote
Chris Uppal
Posts: n/a
Stefan Ram wrote:

> (It would be more clean to
> write a custom Doclet being aware of
> »@de.dclj.ram.meta.accessibility.Private«.)

The JavaDoc faq has some talk of an @exclude tag being considered.

-- chris

Reply With Quote
Scott Ellsworth
Posts: n/a
In article <(E-Mail Removed)>,
Roedy Green <(E-Mail Removed) > wrote:

> On Fri, 17 Mar 2006 19:28:10 -0000, "Daniel Dyer"
> <(E-Mail Removed)> wrote, quoted or indirectly
> quoted someone who said :
> >I would guess that the intention behind that inspection is more to do with
> >encapsulation than performance.

> It is a happy case where both goals are equally served.
> I am moving more toward making things private UNTIL I need the broader
> scope. It makes debugging and maintaining easier knowing there are no
> outsiders to consider.

I am as well - I find that all too often, code designed to be extended
ends up being poorly designed for the extension it eventually gets.
Code that starts out designed for a task which is then generalized has
the advantage of doing at least one thing well, and having a second
potential use case in mind when it is opened up.

Put another way, it is a lot easier to generalize software when you see
it working in the wild than it is to come up with the use cases you will
end up needing de nihilo.

> I used to make thing package and protected thinking about what you
> might want to use in some potential extension.

Yep. I did that as well, and got bitten one too many times.
Eventually, I realized that subclassing requires very careful thought
about just what the IS-A meant, in the context of an object.
Essentially, to make a good subclassable object, I had to have a very
clear division between implementation details and actual API, which
meant exposing a minimal API.

I did find that this got easier once I had IDEAs delegation features.


Scott Ellsworth Removed)
Java and database consulting for the life sciences
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Are system calls sometimes costlier than library calls? Richard Tobin C Programming 24 11-11-2007 08:52 AM
ods calls business object then method calls ta with output params andy6 ASP .Net 2 06-09-2006 01:54 AM
MoVoIP - FREE MOBILE Inetrnet Phone Calls - FREE Internet Phone Calls ubifone VOIP 0 07-29-2005 04:31 PM
Kataba Functions 1.0 - 100x faster reflective calls for Java Chris Thiessen Java 0 05-05-2004 05:06 PM
Sequence of constructor calls and destructor calls. Honne Gowda A C++ 2 10-31-2003 09:31 AM