Re: style guide on method ordering

Discussion in 'Java' started by Stefan Ram, May 16, 2008.

  1. Stefan Ram

    Stefan Ram Guest

    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.«

    http://java.sun.com/docs/codeconv/html/CodeConventions.doc2.html
    Stefan Ram, May 16, 2008
    #1
    1. Advertising

  2. Stefan Ram

    Stefan Ram Guest

    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
    >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.
    Stefan Ram, May 16, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bert Cuzeau

    VHDL Coding Style Guide

    Bert Cuzeau, Mar 24, 2005, in forum: VHDL
    Replies:
    30
    Views:
    14,573
    lokesh_boddu
    Nov 24, 2006
  2. Christian Seberino
    Replies:
    21
    Views:
    1,605
    Stephen Horne
    Oct 27, 2003
  3. David Segall

    Convention for ordering a style sheet

    David Segall, Sep 23, 2009, in forum: HTML
    Replies:
    3
    Views:
    413
    Roy A.
    Sep 24, 2009
  4. nbigaouette

    Z-Ordering (Morton ordering) question

    nbigaouette, Nov 5, 2009, in forum: C Programming
    Replies:
    2
    Views:
    2,075
  5. Ken Varn
    Replies:
    0
    Views:
    414
    Ken Varn
    Apr 26, 2004
Loading...

Share This Page