Velocity Reviews

Velocity Reviews (
-   Java (
-   -   Re: style guide on method ordering (

Stefan Ram 05-16-2008 03:12 PM

Re: style guide on method ordering
Rex Mottram <> writes:
>seem like a big deal but I often waste time looking for, say, the
>compareTo method of a subsidiary class while debugging an ordering

If I have a class in an editor window, I might type something like

[Esc]:1;/nt comp/

(in vim) to jump to a declaration of a method named »compareTo«.

I usually do not scroll up and down desperately looking for
the declaration.

>problem, and in general I'd like all my classes to conform to a
>reasonable standard.

There is no general means to subdivided methods of classes
into categories, because the is no general internal structure
of classes.

>Does anyone have bones to pick with the above, or value to add? Or can
>point to widely-accepted style guidance?

»methods should be grouped by functionality rather than by
scope or accessibility. For example, a private class
method can be in between two public instance methods.
The goal is to make reading and understanding the code easier.«

Stefan Ram 05-16-2008 06:57 PM

Re: style guide on method ordering
Rex Mottram <> writes:
>For instance, in C code it's a common pattern to place static
>functions above their callers so they don't need a separate

In C, static functions are not treated differently from
non-static functions in this regard. But a »static function«
in C is something different than a »static method« in Java.
In C, »static« means that the function has internal linkage.

All times are GMT. The time now is 07:49 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.