A good de v l r k now s t at
               e ope         h
 t e re is m ore t de v l
  h               o    e opm e nt                                  J A NAM ING
                                                                    AV
       t an program m ing.
        h                                                          CO NVENTIO NS
 A gre at de v l r k now s t at
               e ope         h
                                                       Al ays us e (a f w e xce pt
                                                          w              e         ions dis cus s e d
 t e re is m ore t de v l
  h               o    e opm e nt                      be l ) f l
                                                           ow ulEngl h de s cript . Us e l e r
                                                                        is          ors       ow
        t an de v l
         h       e opm e nt.                           cas e lt e rs in ge ne ralbut capit ize t e
                                                              e t               ,         al h
                                                       f t lt e r of cl s /int rf
                                                        irs e t         as       e ace nam e s and
   W h e n you go agains t a s t andard,                  t e f t lt e r of any non-init w ord
                                                           h   irs e t                  ial
docum e nt it Als t
               . l andards , e xce pt f  or
  t is one , can be brok e n. Y m us t
   h                             ou
     docum e nt w h y you brok e t eh                                Ge ne ralConce pts
 standard, t e pot nt im pl ions
               h       e ial      icat                Us e t rm inol appl
                                                             e         ogy       icabl t t e dom ain
                                                                                      e o h
  of bre ak ing t e s t
                   h     andard, and any                       Us e m ixe d cas e f re adabily
                                                                                   or        it
   condit   ions t at m ay/ us t occur
                   h        m                         Us e s h ort f orm s s paringl and int l nt y
                                                                                    y       e lige l
be fore t e s t
          h      andard can be appl d t
                                      ie  o               Av oid l  ong nam e s (< 15 ch aract rs )
                                                                                               e
               t is s it ion.
                 h      uat                                 Av  oid nam e s t at are s im il or
                                                                               h           ar
                                                                      dif e r onl in cas e
                                                                         f       y

      I m
      te                     Exam pl
                                   e                              Nam ing conv ntion
                                                                              e
   Argum e nt /
              s        cus t e r , account , - or
                            om                            F l
                                                            ulEngl h de s cript of val / e ct be ing
                                                                     is            ion      ue obj
   param e t rs
            e          - aCus t e r , anAccount
                               om                     pas s e d, pos s ibl pre f
                                                                         y      ixing t e nam e w it ‘a’ or ‘an.’
                                                                                       h            h
F l /prope rt s
 ie ds       ie         f t
                         irs Nam e , l t
                                     as Nam e ,       F l
                                                       ulEngl h de s cript
                                                                 is         ion, 1s t lt e r l e rcas e ,
                                                                                      e t ow
                              w arpSpe e d            1s t lt e r of any non-init w ord in uppe rcas e
                                                           e t                   ial
  Boolan ge t e r
       e       t     is P rs is t nt , is St
                         e       e ()       ring()                        P f d w it ‘is ’
                                                                           e ixe    h
m e m be r functions       , is Ch aract r()
                                        e
      Cl s e s
       as                     Cus t e r ,
                                   om                  F l
                                                        ulEngl h de s cript
                                                             is            ion, w it t e f t lt e rs
                                                                                    h h   irs e t
                            Savings Account                     of alw ords capit ize d
                                                                     l               al
 Com pil ion unit
       at               Savings Account av ,
                                       .j a           Nam e of cl s / e rf ;if > 1 cl s in f e , pre f d
                                                                 as int ace          as     il        ixe
       fes
       il                  Singlte on.j a
                                      av                 w it ‘.j
                                                             h ava’ t indicat it a s ource code f e .
                                                                     o       e 's                  il
  Com pone nt /
              s        ok But on , cus t e rL t ,
                             t          om   is       F l
                                                       ulEngl h de s cript
                                                               is         ion de s cribing us age ;type
    w idge ts                  f e M e nu
                                il                    of t e com pone nt concat nat d ont t e e nd.
                                                          h                    e      e     o h
   Contructors              Cus t e r() ,
                                 om                                Us e t e nam e of t e cl s
                                                                         h            h   as
                          Savings Account ()
   De structors                 final ()
                                    ize               W ilinv e f
                                                         l ok    inal () m e m be r f
                                                                     ize             unction be fore
                                                             an obj ct is garbage col ct d
                                                                   e                  l e
                                                                                      e
    Exce ptions                      e                 It is ge ne ral acce pt d t us e t e lt e r ‘e ’
                                                                      ly          e    o      h  e t
                                                                    t re pre s e nt e xce pt
                                                                     o                      ions
Final at f l
     St ic ie ds            M IN_BALANCE ,               Uppe rcas e lt e rs , w ords s e parat d by unde r-
                                                                          e t                     e
   /cons t s
          ant               D EFAUL ATE
                                   T_D                s core s . Be t e r: f
                                                                     t      inal t ic ge t e r m e m be r f
                                                                                s at      t                unctions
 Ge t e r m e m be r
     t                     ge t irs t
                               F Nam e () ,            P f t e nam e of t e f l be ing acce s s e d
                                                        re ix h          h   ie d
    funct  ions            ge t arpSpe e d()
                               W                                     w it ‘ge t
                                                                         h      ’
    Int rf s
       e ace            Runnabl , P
                               e    rom pt r ,
                                          e           F l
                                                       ulEngl h de s cr. conce pt of int rf , 1s t lt e rs
                                                               is                       e ace          e t
                             Singlt
                                  e on                 of w ords cap'd. P tf nam e w ith ‘abl,’ ‘ibl,’ or ‘e r’
                                                                         os ix              e      e
 Local ariabls
      v     e           grandT al cus t e r ,
                              ot ,      om              F l
                                                         ulEngl h de s cript
                                                                is           ion, 1s t lt e r in l e r
                                                                                        e t       ow
                             ne w Account               cas e but do not h ide e xis ting f l / ie l
                                                                                           ie ds f ds
  Loop count rs
            e               i , j, k , count r
                                            e         It is ge ne ral acce pt d t us e t e lt e rs i , j
                                                                     l
                                                                     y         e  o      h   e t
                                                               , or k , or t e nam e ‘count r .’
                                                                            h              e
     P age
      ack                ca.uv   ic.ne ptune .pe r-    Se e Cl s e s - Gl
                                                              as         obal pack age s : re v rs e nam e
                                                                                               e
                          s is t nce .m apping
                                e                     of Int rne t dom ain & pos t ix t e pack age nam e .
                                                            e                     f h
M e m be r Functions ope nF e () , addAccount
                           il                ()         F l
                                                         ulEngl h de s cript of w h at it doe s s t ing
                                                                is          ion                       art
                                                      w it act e v rb if pos s ibl, 1s t lt e r in l e r cas e
                                                          h   iv e               e       e t       ow
 Se t e r m e m be r
     t                     s e t as t
                                L Nam e () ,           P f t e nam e of t e f l be ing acce s s e d
                                                        re ix h          h    ie d
    funct  ions            s e t arpSpe e d()
                                W                                     w it ‘s e t
                                                                          h      ’
J A D O CUM ENT
      AV             ATIO N                                                                                                                 J A CO D ING
                                                                                                                                            AV
                                                                               Ge ne ralConce pts
         CO NV ENTIO NS                                                                                                                    CO NVENTIO NS
                                                                        Com m e nt s h oul add t cl y
                                                                                   s       d       o arit
                                                                      If it is n’ w ort docum e nt
                                                                                 t      h               ing,
  Rul of t um b : if you’ e ne v r s e e n t e
     e     h               v     e          h                               it is n’ w ort running
                                                                                    t      h                                         9 9 .9 % of t e t e it is m ore im port
                                                                                                                                                  h   im                    ant
  code be f , w h at docum e nt ion w oul
           ore                  at            d                    No de corat   ion /banne r-l e com m e nt
                                                                                                ik             s                            t program f your f l
                                                                                                                                             o             or       e low                        Your code m us t b e
     you ne e d t q uick l unde rs t
                 o       y          and it                                  Ke e p com m e nt s im pl
                                                                                             s        e                                 de v l rs t an f t e m ach ine
                                                                                                                                             e ope       h    or h                            unde rs tandab l t ot e rs
                                                                                                                                                                                                             e o h
                                                                 W rit docum e nt ion b e f
                                                                      e              at        ore w rit ing code
                                                                                W h y ~ not W h at
Jav com m e nt type s
   a
D ocum e nt ion Im m e diat l be f
           at               e y      ore de cl ions
                                              arat                  /**                                                              Acce s s or m e m b e r functions   Cons ide r us ing l init izat
                                                                                                                                                                                             azy    ial ion f f l in t e dat
                                                                                                                                                                                                                 or ie ds      h      abas e
                of int rf s , cl s e s , m e m be r
                      e ace         as                              Customer – A customer is any                                                                         Us e acce s s ors f obt
                                                                                                                                                                                            or    aining and m odif   ying alf l
                                                                                                                                                                                                                              lie ds
                funct ions and f l t docum e nt
                                   ie ds o                          person or organization that we
                t e m . Th e s e are proce s s e d by
                 h                                                  sell services and products to.                                                                       Us e acce s s ors f ‘cons t s ”
                                                                                                                                                                                            or       ant
                j adoc t cre at e xt rnal
                 av        o         e    e                         @author S.W. Ambler                                                                                  F col ct
                                                                                                                                                                          or     l ions , add m e m be r f
                                                                                                                                                                                  e                        unct   ions t ins e rt and
                                                                                                                                                                                                                        o
                docum e nt ion f a cl s .
                             at      or     as                      */                                                                                                   re m ov it m s
                                                                                                                                                                                 e e
        C St e C-s t e com m e nt t dis abl
            yl       yl              s o        e                   /*                                                                                                   W h e ne v r pos s ibl, m ak e acce s s ors prot ct d, not publ
                                                                                                                                                                                    e          e                         e e              ic
               l s of code t at are no l
                ine             h            onge r                 Commented out by J.T. Kirk on 1/1/03
               appl   icabl, but t at you w ant t
                           e       h              o                 replaced by preceding code. Delete                                                         Fie l F l s h oul al ays be de cl d priv e
                                                                                                                                                                   ds ie ds         d w                 are     at
               k e e p j t in cas e ~ or w h il
                        us                    e                     after 2 years if still not applicable
               de bugging.                                          . . . (the source code )                                                                          D o not dire ct y acce s s f l , ins t ad us e acce s s or
                                                                                                                                                                                      l           ie ds     e
                                                                    */                                                                                                m e m be r funct  ions
    Singl l
        e ine Us e s ingl l com m e nt
                          e ine          s                          //   Apply a 5% discount to all                                                                   D o not us e f inal t ic f l (cons t s ), ins t ad us e
                                                                                                                                                                                          s at ie ds          ant       e
              int rnal w it in m e m be r
                 e       l
                         y    h                                     //   invoices over $1000 as defined by                                                            acce s s or m e m be r functions
              funct ions t docum e nt bus ine s s
                            o                                       //   the Sarek generosity campaign                                                                D o not h ide nam e s
              logic, code s e ctions and                            //   started in Feb 1995                                                                          Al ays init ize s t ic f l
                                                                                                                                                                        w          ial       at ie ds
              de cl ions of t m porary
                   arat          e
              v ariabls .
                       e
                                                                                                                                                             Cl s e s
                                                                                                                                                              as         M inim ize t e publ and prot ct d int rf s
                                                                                                                                                                                      h        ic          e e      e ace
      Argum e nt /param e t rs Th e t
                  s              e             ype of t e param e t r
                                                         h                   e                                                                                           De f ine t e publ int rf
                                                                                                                                                                                    h       ic    e ace f a cl s be f
                                                                                                                                                                                                          or    as      ore you be gin
                                       W h at it s h oul be us e d f
                                                          d                  or                                                                                          coding it
                                       Any re s t ions or pre condit
                                                    rict                           ions                                                                                  D e cl t e f l and m e m be r f
                                                                                                                                                                               are h     ie ds                 unctions of a cl s in t e
                                                                                                                                                                                                                              as      h
               Fie l /
                                       Exam pls
                    ds prope rt s It de s cript
                                 ie      s
                                                  e
                                                       ion
                                                                                                        W H AT t        o                                                f l ing orde r:
                                                                                                                                                                          ol ow
                                       D ocum e nt alappll          icabl inv
                                                                          e       ariant   s         docum e nt                                                          · cons t ruct ors
                                       Exam pls   e                                                                                                                      ·f inal ()
                                                                                                                                                                                ize
                                       Concurre ncy is s ue s
                                       V ibily de cis ions
                                         is     it                                                                                                                       · publ m e m be r f
                                                                                                                                                                                ic             unct ions
                            Cl s e s Th e purpos e of t e cl s
                              as                                h       as                                                                                               · prot ct d m e m be r f
                                                                                                                                                                                e e                unct ions
                                       Know n bugs                                                                                                                       · priv e m e m be r f
                                                                                                                                                                                at              unct ions
                                       Th e de v l e opm e nt m aint nance h is t
                                                                   /        e                  ory of t e cl s
                                                                                                        h     as
                                       D ocum e nt appl      icabl inve       ariant  s                                                                                  · priv e f l
                                                                                                                                                                                at ie d
                                       Th e concurre ncy s t e gy    rat
              Com pil ion unit Each cl s / e rf
                       at            s            as int ace de f d in t e cl s , incla brie f de s cript
                                                                            ine         h        as       .                 ion                     Local ariab ls
                                                                                                                                                         v      e        D o not h ide nam e s
                                       Th e f e nam e and/ ide nt ying inf
                                               il                    or         if             orm at ion
                                       Copyrigh t inf    orm at      ion                                                                                                 D e cl one l
                                                                                                                                                                              are       ocal ariabl pe r l of code
                                                                                                                                                                                             v     e     ine
      Ge t e r m e m b e r f
          t                 unct ion D ocum e nt w h y l init izat
                                                               azy         ial ion w as us e d, if appl          icabl e                                                 D ocum e nt local ariabls w it an e ndl com m e nt
                                                                                                                                                                                           v     e     h         ine
                        Int rf
                            e ace s Th e purpos e
                                       H ow it s h oul and s h oul t be us e d
                                                         d                  dn’                                                                                          D e cl l
                                                                                                                                                                              are ocal ariabls im m e diat l be f
                                                                                                                                                                                        v      e           e y     ore t e ir us e
                                                                                                                                                                                                                        h
                  Local ariab ls It us e /
                          v        e     s        purpos e                                                                                                               Us e local ariabls f one t ing onl
                                                                                                                                                                                    v      e or      h         y
             M e m b e r Funct ions W h at and w h y t e m e m be r f
                                                              h                     unct  ion doe s w h at it doe s
               (D ocum e nt ion) W h at a m e m be r f
                             at                                    unct  ion m us t be pas s e d as param e t rs     e
                                       W h at a m e m be r f       unct  ion re t  urns                                                        Me m be r functions D ocum e nt your code
                                       Know n bugs                                                                                                                 P aragraph your code
                                       Any e xce pt    ions t at a m e m be r f
                                                                h                       unct    ion t row s
                                                                                                      h                                                            Us e w h it s pace , one l be f
                                                                                                                                                                              e                ine     ore cont s t
                                                                                                                                                                                                               rol ruct s and t o
                                                                                                                                                                                                                        ure       w
                                       V ibily de cis ions
                                         is     it                                                                                Th is t xt is a s um m ary of be f m e m be r f
                                                                                                                                         e
                                       H ow a m e m be r f      unct    ion ch ange s t e obj ct
                                                                                             h       e                                                                 ore              unct  ion
                                       Incl  ude a h is t  ory of any code ch ange s                                              Scot Am b lr's 'W rit
                                                                                                                                        t      e           ing     de cl ions
                                                                                                                                                                        arat
                                       Exam pls of h ow t inv e t e m e m be r f
                                                  e                 o      ok     h                   unct  ion if appropriate    Rob us t J a Code '
                                                                                                                                            av                     A m e m be r f  unction s h oul be unde rs t
                                                                                                                                                                                                   d            andabl in ls s t an
                                                                                                                                                                                                                      e     e   h
                                       Appl   icabl pre condit
                                                     e                 ions and pos t      condit   ions
                                       D ocum e nt alconcurre ncy
                                                         l                                                                                                         t irt s e conds
                                                                                                                                                                    h y
             M e m b e r Funct ions Cont s t  rol ruct s   ure
                                                                                                                                  Th e Am b ySof Inc.
                                                                                                                                                 t
                                                                                                                                                                   W rit s h ort s ingl com m and l s
                                                                                                                                                                        e        ,      e               ine
          (Int rnal
               e       com m e nt ) W h y, as w e las w h at t e code doe s
                                   s                    l               , h                                                       Coding St  andards f    or
                                                                                                                                                                   Re s trict t e v ibily of a m e m be r f
                                                                                                                                                                               h    is    it                 unction as m uch as
                                       L ocal ariabls
                                                v        e                                                                        J a-v
                                                                                                                                   av      17.01d
                                       D if iculor com plx code
                                            f t                   e                                                                                                pos s ible
                                       Th e proce s s ing orde r
                           Pack age Th e rat      ional f t e pack age
                                                        e or h                                                                    Th is layout b y M aik e D ul Spe cif t e orde r of ope rat
                                                                                                                                                                k          y h                       ions
                                       Th e cl s e s in t e pack age
                                                as           h

Javacodingstandardssummary

  • 1.
    A good dev l r k now s t at e ope h t e re is m ore t de v l h o e opm e nt J A NAM ING AV t an program m ing. h CO NVENTIO NS A gre at de v l r k now s t at e ope h Al ays us e (a f w e xce pt w e ions dis cus s e d t e re is m ore t de v l h o e opm e nt be l ) f l ow ulEngl h de s cript . Us e l e r is ors ow t an de v l h e opm e nt. cas e lt e rs in ge ne ralbut capit ize t e e t , al h f t lt e r of cl s /int rf irs e t as e ace nam e s and W h e n you go agains t a s t andard, t e f t lt e r of any non-init w ord h irs e t ial docum e nt it Als t . l andards , e xce pt f or t is one , can be brok e n. Y m us t h ou docum e nt w h y you brok e t eh Ge ne ralConce pts standard, t e pot nt im pl ions h e ial icat Us e t rm inol appl e ogy icabl t t e dom ain e o h of bre ak ing t e s t h andard, and any Us e m ixe d cas e f re adabily or it condit ions t at m ay/ us t occur h m Us e s h ort f orm s s paringl and int l nt y y e lige l be fore t e s t h andard can be appl d t ie o Av oid l ong nam e s (< 15 ch aract rs ) e t is s it ion. h uat Av oid nam e s t at are s im il or h ar dif e r onl in cas e f y I m te Exam pl e Nam ing conv ntion e Argum e nt / s cus t e r , account , - or om F l ulEngl h de s cript of val / e ct be ing is ion ue obj param e t rs e - aCus t e r , anAccount om pas s e d, pos s ibl pre f y ixing t e nam e w it ‘a’ or ‘an.’ h h F l /prope rt s ie ds ie f t irs Nam e , l t as Nam e , F l ulEngl h de s cript is ion, 1s t lt e r l e rcas e , e t ow w arpSpe e d 1s t lt e r of any non-init w ord in uppe rcas e e t ial Boolan ge t e r e t is P rs is t nt , is St e e () ring() P f d w it ‘is ’ e ixe h m e m be r functions , is Ch aract r() e Cl s e s as Cus t e r , om F l ulEngl h de s cript is ion, w it t e f t lt e rs h h irs e t Savings Account of alw ords capit ize d l al Com pil ion unit at Savings Account av , .j a Nam e of cl s / e rf ;if > 1 cl s in f e , pre f d as int ace as il ixe fes il Singlte on.j a av w it ‘.j h ava’ t indicat it a s ource code f e . o e 's il Com pone nt / s ok But on , cus t e rL t , t om is F l ulEngl h de s cript is ion de s cribing us age ;type w idge ts f e M e nu il of t e com pone nt concat nat d ont t e e nd. h e e o h Contructors Cus t e r() , om Us e t e nam e of t e cl s h h as Savings Account () De structors final () ize W ilinv e f l ok inal () m e m be r f ize unction be fore an obj ct is garbage col ct d e l e e Exce ptions e It is ge ne ral acce pt d t us e t e lt e r ‘e ’ ly e o h e t t re pre s e nt e xce pt o ions Final at f l St ic ie ds M IN_BALANCE , Uppe rcas e lt e rs , w ords s e parat d by unde r- e t e /cons t s ant D EFAUL ATE T_D s core s . Be t e r: f t inal t ic ge t e r m e m be r f s at t unctions Ge t e r m e m be r t ge t irs t F Nam e () , P f t e nam e of t e f l be ing acce s s e d re ix h h ie d funct ions ge t arpSpe e d() W w it ‘ge t h ’ Int rf s e ace Runnabl , P e rom pt r , e F l ulEngl h de s cr. conce pt of int rf , 1s t lt e rs is e ace e t Singlt e on of w ords cap'd. P tf nam e w ith ‘abl,’ ‘ibl,’ or ‘e r’ os ix e e Local ariabls v e grandT al cus t e r , ot , om F l ulEngl h de s cript is ion, 1s t lt e r in l e r e t ow ne w Account cas e but do not h ide e xis ting f l / ie l ie ds f ds Loop count rs e i , j, k , count r e It is ge ne ral acce pt d t us e t e lt e rs i , j l y e o h e t , or k , or t e nam e ‘count r .’ h e P age ack ca.uv ic.ne ptune .pe r- Se e Cl s e s - Gl as obal pack age s : re v rs e nam e e s is t nce .m apping e of Int rne t dom ain & pos t ix t e pack age nam e . e f h M e m be r Functions ope nF e () , addAccount il () F l ulEngl h de s cript of w h at it doe s s t ing is ion art w it act e v rb if pos s ibl, 1s t lt e r in l e r cas e h iv e e e t ow Se t e r m e m be r t s e t as t L Nam e () , P f t e nam e of t e f l be ing acce s s e d re ix h h ie d funct ions s e t arpSpe e d() W w it ‘s e t h ’
  • 2.
    J A DO CUM ENT AV ATIO N J A CO D ING AV Ge ne ralConce pts CO NV ENTIO NS CO NVENTIO NS Com m e nt s h oul add t cl y s d o arit If it is n’ w ort docum e nt t h ing, Rul of t um b : if you’ e ne v r s e e n t e e h v e h it is n’ w ort running t h 9 9 .9 % of t e t e it is m ore im port h im ant code be f , w h at docum e nt ion w oul ore at d No de corat ion /banne r-l e com m e nt ik s t program f your f l o or e low Your code m us t b e you ne e d t q uick l unde rs t o y and it Ke e p com m e nt s im pl s e de v l rs t an f t e m ach ine e ope h or h unde rs tandab l t ot e rs e o h W rit docum e nt ion b e f e at ore w rit ing code W h y ~ not W h at Jav com m e nt type s a D ocum e nt ion Im m e diat l be f at e y ore de cl ions arat /** Acce s s or m e m b e r functions Cons ide r us ing l init izat azy ial ion f f l in t e dat or ie ds h abas e of int rf s , cl s e s , m e m be r e ace as Customer – A customer is any Us e acce s s ors f obt or aining and m odif ying alf l lie ds funct ions and f l t docum e nt ie ds o person or organization that we t e m . Th e s e are proce s s e d by h sell services and products to. Us e acce s s ors f ‘cons t s ” or ant j adoc t cre at e xt rnal av o e e @author S.W. Ambler F col ct or l ions , add m e m be r f e unct ions t ins e rt and o docum e nt ion f a cl s . at or as */ re m ov it m s e e C St e C-s t e com m e nt t dis abl yl yl s o e /* W h e ne v r pos s ibl, m ak e acce s s ors prot ct d, not publ e e e e ic l s of code t at are no l ine h onge r Commented out by J.T. Kirk on 1/1/03 appl icabl, but t at you w ant t e h o replaced by preceding code. Delete Fie l F l s h oul al ays be de cl d priv e ds ie ds d w are at k e e p j t in cas e ~ or w h il us e after 2 years if still not applicable de bugging. . . . (the source code ) D o not dire ct y acce s s f l , ins t ad us e acce s s or l ie ds e */ m e m be r funct ions Singl l e ine Us e s ingl l com m e nt e ine s // Apply a 5% discount to all D o not us e f inal t ic f l (cons t s ), ins t ad us e s at ie ds ant e int rnal w it in m e m be r e l y h // invoices over $1000 as defined by acce s s or m e m be r functions funct ions t docum e nt bus ine s s o // the Sarek generosity campaign D o not h ide nam e s logic, code s e ctions and // started in Feb 1995 Al ays init ize s t ic f l w ial at ie ds de cl ions of t m porary arat e v ariabls . e Cl s e s as M inim ize t e publ and prot ct d int rf s h ic e e e ace Argum e nt /param e t rs Th e t s e ype of t e param e t r h e De f ine t e publ int rf h ic e ace f a cl s be f or as ore you be gin W h at it s h oul be us e d f d or coding it Any re s t ions or pre condit rict ions D e cl t e f l and m e m be r f are h ie ds unctions of a cl s in t e as h Fie l / Exam pls ds prope rt s It de s cript ie s e ion W H AT t o f l ing orde r: ol ow D ocum e nt alappll icabl inv e ariant s docum e nt · cons t ruct ors Exam pls e ·f inal () ize Concurre ncy is s ue s V ibily de cis ions is it · publ m e m be r f ic unct ions Cl s e s Th e purpos e of t e cl s as h as · prot ct d m e m be r f e e unct ions Know n bugs · priv e m e m be r f at unct ions Th e de v l e opm e nt m aint nance h is t / e ory of t e cl s h as D ocum e nt appl icabl inve ariant s · priv e f l at ie d Th e concurre ncy s t e gy rat Com pil ion unit Each cl s / e rf at s as int ace de f d in t e cl s , incla brie f de s cript ine h as . ion Local ariab ls v e D o not h ide nam e s Th e f e nam e and/ ide nt ying inf il or if orm at ion Copyrigh t inf orm at ion D e cl one l are ocal ariabl pe r l of code v e ine Ge t e r m e m b e r f t unct ion D ocum e nt w h y l init izat azy ial ion w as us e d, if appl icabl e D ocum e nt local ariabls w it an e ndl com m e nt v e h ine Int rf e ace s Th e purpos e H ow it s h oul and s h oul t be us e d d dn’ D e cl l are ocal ariabls im m e diat l be f v e e y ore t e ir us e h Local ariab ls It us e / v e s purpos e Us e local ariabls f one t ing onl v e or h y M e m b e r Funct ions W h at and w h y t e m e m be r f h unct ion doe s w h at it doe s (D ocum e nt ion) W h at a m e m be r f at unct ion m us t be pas s e d as param e t rs e W h at a m e m be r f unct ion re t urns Me m be r functions D ocum e nt your code Know n bugs P aragraph your code Any e xce pt ions t at a m e m be r f h unct ion t row s h Us e w h it s pace , one l be f e ine ore cont s t rol ruct s and t o ure w V ibily de cis ions is it Th is t xt is a s um m ary of be f m e m be r f e H ow a m e m be r f unct ion ch ange s t e obj ct h e ore unct ion Incl ude a h is t ory of any code ch ange s Scot Am b lr's 'W rit t e ing de cl ions arat Exam pls of h ow t inv e t e m e m be r f e o ok h unct ion if appropriate Rob us t J a Code ' av A m e m be r f unction s h oul be unde rs t d andabl in ls s t an e e h Appl icabl pre condit e ions and pos t condit ions D ocum e nt alconcurre ncy l t irt s e conds h y M e m b e r Funct ions Cont s t rol ruct s ure Th e Am b ySof Inc. t W rit s h ort s ingl com m and l s e , e ine (Int rnal e com m e nt ) W h y, as w e las w h at t e code doe s s l , h Coding St andards f or Re s trict t e v ibily of a m e m be r f h is it unction as m uch as L ocal ariabls v e J a-v av 17.01d D if iculor com plx code f t e pos s ible Th e proce s s ing orde r Pack age Th e rat ional f t e pack age e or h Th is layout b y M aik e D ul Spe cif t e orde r of ope rat k y h ions Th e cl s e s in t e pack age as h