Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Re: style guide on method ordering (http://www.velocityreviews.com/forums/t615181-re-style-guide-on-method-ordering.html)

Stefan Ram 05-16-2008 03:12 PM

Re: style guide on method ordering
 
Rex Mottram <rexm@not.here> 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.«

http://java.sun.com/docs/codeconv/ht...ions.doc2.html


Stefan Ram 05-16-2008 06:57 PM

Re: style guide on method ordering
 
Rex Mottram <rexm@not.here> 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
>declaration.


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.