gerry - general programming

Upload: ger-ry

Post on 28-Feb-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Gerry - General Programming

    1/15

    General ProgramminGerry | 24-June16

  • 7/25/2019 Gerry - General Programming

    2/15

    Getting started

    Introduction Name

    Current Project and your role

    What you do outside or!

  • 7/25/2019 Gerry - General Programming

    3/15

    Agenda

    Coding style

    "ndention

    #eclaration

    Naming con$ention

    Comments

    Code %rinci%les '() *"++) etc, Programming Practices

    .ternal tools /or de$elo%ment

  • 7/25/2019 Gerry - General Programming

    4/15

    Objectives

    asy to read the code Pre$ent s%aghetti code

    Per/ormance achie$ement

    +tandardiation

  • 7/25/2019 Gerry - General Programming

    5/15

    Coding Style - Indention

    "ndention Wra%%ing lines

    When e.%ression doesnt t on a single line) 3rea! it u 5/ter comma

    5/ter an o%erator

    White s%aces

    Ne$er e$er use s%aces /or indention 7se 8a3 to increase indent le$el

    7se +hi/t-8a3 to decrease indent le$el

  • 7/25/2019 Gerry - General Programming

    6/15

    Coding Style - Indention

    +am%le : #emo

  • 7/25/2019 Gerry - General Programming

    7/15

    Coding Style - Declaration

    ;ne declaration %er line is recommended) so ecan %ut inline comment

    #o not %ut more than 1 $aria3le

    +am%le : #emo

  • 7/25/2019 Gerry - General Programming

    8/15

    Coding Style NamingConvention

    Pascal Casing8his con$ention ca%italies the rst character o/ each in Testethod,=

    Who use this > Class) ?ethods) Pro%erty) Names%ace

    Camel Casing

    8his con$ention ca%italies the rst character o/ each e.ce%t the rst one= =g= testethod= Who use this >Parameters) %ri$ate elds

    Sel!-documented$ery $aria3le name should 3e sel/-documented) sam%

  • 7/25/2019 Gerry - General Programming

    9/15

    Coding Style Comments

    .%lanation o/ s%ecic logic o/ the method No need to 3e long) as long e$ery3ody can unde

    8ime sa$ed) de$elo%ers no need to read e$ery A

  • 7/25/2019 Gerry - General Programming

    10/15

    Coding Style Code Princi"l

    *"++ &*ee% "t +hort and +im%le : *ee% "t +im%le) + *ee% the logic as sim%le as %ossi3le

    #ont o$ero it

  • 7/25/2019 Gerry - General Programming

    11/15

    Coding Style Code Princi"l

    #'( ont 'e%eat (oursel/, "/ %ossi3le) ma!e reusa3le o3ject) and minimie

    0rd%arty call

  • 7/25/2019 Gerry - General Programming

    12/15

    Programming Practices

    8ry to a$oid hard-code8ry to ma!e the code congura3le as much as %

    rror message should 3e centralied as constant%ro%erties=

    8ry to minimie #E Fuery : 0rd%arty reFuest) es%

    inside /or-loo% statement= #o as! your colleagues a3out your ritten code)

    any im%ro$ement can 3e done

  • 7/25/2019 Gerry - General Programming

    13/15

    #$ternal Tools !or Develo"m

    Note%ad |htt%s::note%ad-%lus-%lus=org: +u3lime | htt%s::=su3limete.t=com:

    H?APad | htt%::=mhel%=com:

    Glogg | htt%::glogg=3onne/on=org:

    Code Com%are | htt%s::=de$art=com:codeco htt%::%oorsFl=com:

    htt%::js3eautier=org:

    htt%::jscom%ress=com:

    https://notepad-plus-plus.org/https://www.sublimetext.com/http://www.wmhelp.com/http://glogg.bonnefon.org/https://www.devart.com/codecompare/http://poorsql.com/http://jsbeautifier.org/http://jscompress.com/http://jscompress.com/http://jsbeautifier.org/http://poorsql.com/https://www.devart.com/codecompare/http://glogg.bonnefon.org/http://www.wmhelp.com/https://www.sublimetext.com/https://notepad-plus-plus.org/
  • 7/25/2019 Gerry - General Programming

    14/15

  • 7/25/2019 Gerry - General Programming

    15/15