Code Simplicity Open Source Design

Embed Size (px)

Citation preview

  • 8/12/2019 Code Simplicity Open Source Design

    1/27

    Code Simplicity:Software Design In Open Source

    Projects

    Max Kanat-lexandermax!codesimplicity"com

  • 8/12/2019 Code Simplicity Open Source Design

    2/27

    #efore $%e S%ow

    I tal& 'uic&ly

    Stop me if you don(t understand

    lso stop me if you need examples

    )uestions or disagreements at end

    Points will *e fast+ *ut still important

    More detail on e,eryt%ing at my *log:

    %ttp:www"codesimplicity"com Some of t%ese t%ings you may already &now+w%at matters is pointing t%em out as important"

    http://www.codesimplicity.com/http://www.codesimplicity.com/
  • 8/12/2019 Code Simplicity Open Source Design

    3/27

    .%o am I/

    ssistant Project 0ead for #ug1illa

    .riter of Code Simplicity 0ong-time programmer and system administrator

    Data comes from:

    2xperience programming and designing #ug1illa 3experiment4

    Inter,iewing many programmers

    5eading extensi,ely wit% analysis

    Data collection is difficult *ecause of t%e timeframe ofsoftware projects"

    I spea& ,ery definitely+ *ut please ma&e up your

    own mind a*out t%e t%ings I am saying"

  • 8/12/2019 Code Simplicity Open Source Design

    4/27

    .%at Is Software Design/

    dministrati,e Decisions

    .%at programmer to put w%ere

    De,elopment timeframes

    etc"

    Coding

    Technical Decisions

    .%at language to use

    .%at tec%nologies to c%oose

    etc"

  • 8/12/2019 Code Simplicity Open Source Design

    5/27

    $%ere Is 6o Science of SoftwareDesign

    Science re'uires:

    0aws

    Proof

    5esults

    Many met%odologies+ no science:

    3.aterfall4

    3gile4

    etc"

  • 8/12/2019 Code Simplicity Open Source Design

    6/27

    6ot going to pro,e anyt%ing today+ just s%ow

    Can pro,e+ t%oug%+ in ,arious ways $%ere are similar ideas out t%ere+ *ut t%ey are

    not t%e same as w%at I am going to tal& a*out

    0argely t%ey are not low-le,el enoug% Se,en Principles:

    %ttp:c7"comcgiwi&i/Se,enPrinciplesOfSoftwareDe,elopment

    $%ey tell you whatto do+ I only %elp you ma&edecisions for yourself and try to tell you why"

    I did not deri,e from any of t%ese met%odologies+*ut t%e *its of t%em t%at wor& could *e deri,ed fromw%at I am going to tell you"

    http://c2.com/cgi/wiki?SevenPrinciplesOfSoftwareDevelopmenthttp://c2.com/cgi/wiki?SevenPrinciplesOfSoftwareDevelopment
  • 8/12/2019 Code Simplicity Open Source Design

    7/27

    .%y 8a,e a Science of SoftwareDesign/

    8elp Ma&e $ec%nical Decisions

    Whydo some t%ings 3wor&4 and ot%ers don(t/

  • 8/12/2019 Code Simplicity Open Source Design

    8/27

    5esults

    #ug1illa

    Impro,ed My Own Programming

    5esol,ed e,ery 'uestion

    #roug%t no,ices to understand why

    2xplained difficulties and 3war stories4 ofexperienced programmers

  • 8/12/2019 Code Simplicity Open Source Design

    9/27

    6ot #rainwas%ing or Mar&eting

    6ot going to tell you w%at decisions to ma&e+just going to gi,e you information t%at will %elpyou ma&e t%em

    $%is differs from met%odologies #u11word-free

  • 8/12/2019 Code Simplicity Open Source Design

    10/27

    9OSS ,s" Proprietary

    $%e *asics are t%e same+ *ut application can *edifferent"

  • 8/12/2019 Code Simplicity Open Source Design

    11/27

    Purpose Of Software

    To help people 6e,er 3to %elp t%e computer4

    Specific software is 3$o %elp people *la%;4

    Stated purpose s%ould *e:

    S%ort

    Simple

    Specific

    6eeded

    9ollowed 2xactly

  • 8/12/2019 Code Simplicity Open Source Design

    12/27

  • 8/12/2019 Code Simplicity Open Source Design

    13/27

    Primary 0aw: 9uture

    $%ere is more future t%an present

    9uture is composed of infinite series of presents

    $%e future is more important t%an t%e present

    2ffort spent on design s%ould *e proportional to%ow muc% future time t%ere is in w%ic% youexpect t%e software to exist

    Planning to re-write is unnecessary

  • 8/12/2019 Code Simplicity Open Source Design

    14/27

    9uture: Known ,s" =n&nown

    Known =n&nown

    6ear9uture

    9ar 9uture

    9uture5e'uirements

    Conse'uences

    Software %as long time lines

  • 8/12/2019 Code Simplicity Open Source Design

    15/27

    0aw Of C%ange

    $%e longer your software exists+ t%e morepro*a*le it is t%at any piece of it will %a,e toc%ange

    Means t%at as time goes on+ everypiece is li&ely toc%ange

  • 8/12/2019 Code Simplicity Open Source Design

    16/27

    0aw of Defect Pro*a*ility

    $%e c%ance of introducing a defect into yourprogram is directly proportional to t%e si1e oft%e c%anges you ma&e

    Perfection is impossi*le .rite as little code as possi*le

    Don(t fix w%at isn(t *ro&en

    2xplains re-use

  • 8/12/2019 Code Simplicity Open Source Design

    17/27

    0aw Of Simplicity

    $%e ease of maintenance of any piece ofsoftware is directly proportional to t%e simplicityof t%e indi,idual pieces

    6ot of t%e w%ole system+ just t%e indi,idual pieces Stated differently+ is in,erse to t%e complexity"

    Simplicity is relati,e+ largely to ,iewpoint

    8ow simple do you %a,e to *e/ Perspecti,e of anot%er programmer w%o(s ne,er

    seen your code

    #e consistent

  • 8/12/2019 Code Simplicity Open Source Design

    18/27

    .%at Is a #ug/

    Programmer(s Intentions

    =ncertainties can *e resol,ed *y:

    Comments

    Spec 35easona*le programmer4

    ssume %es%e meant to do w%at is *est for t%e user

    =ser 2xpectations

    Specs t%at ,iolate user expectations are spec *ugs

    If t%ere(s a conflict+ it(s 3majority rules4

    >ou can also add a preference+ *ut t%at adds complexity

  • 8/12/2019 Code Simplicity Open Source Design

    19/27

    .%ere Do #ugs Come 9rom/

    Complexity

    $%e *ox wit% a million unla*eled *uttons

    Misunderstandings

    Particularly of language words+ sym*ols+ functions+etc"

  • 8/12/2019 Code Simplicity Open Source Design

    20/27

    30aw4 of $esting

    >ou don(t &now it wor&s unless you(,e tried it"

  • 8/12/2019 Code Simplicity Open Source Design

    21/27

    pplication in 9OSS

    Must be more hardcore0argely pro*lems wit% geograp%ic distri*ution

    8ere(s w%ere I tell you some t%ings to do+ *ut yous%ould still ma&e up your own mind"

  • 8/12/2019 Code Simplicity Open Source Design

    22/27

    Difficulties of Design in 9OSS

    Speed of c%ange can *e limited

    5e,iews

    C%ec&in Procedures

    0ac& of Some*ody to $al& $o I5C %elps;

    $ime a,aila*le can *e limited

    Designer(s $ime

    8a,e to communicate designs 'uic&ly Implementer(s $ime

    8a,e to *e a*le to read design 'uic&ly

  • 8/12/2019 Code Simplicity Open Source Design

    23/27

    Communication *andwidt% is limited

    8a,e to type to communicate design

    6o w%ite*oard+ etc"

  • 8/12/2019 Code Simplicity Open Source Design

    24/27

    De,elopers pic& w%at to wor& on

    May not want to conform to design

    May not want to wor& on refactoring

  • 8/12/2019 Code Simplicity Open Source Design

    25/27

    Solutions

    2xtreme consistency

    If you can(t communicate a design+ it %elps if t%eexisting code already wor&s t%e rig%t way

    #rief communications Code re,iews

    2xtensi,e de,eloper documentation

    0ots of attention to new*ies #e nice

  • 8/12/2019 Code Simplicity Open Source Design

    26/27

    5ead support mail

    5ead *logs a*out your product

    #ut don(t e,er let your detractors write yourre'uirements"

    Sur,ey your users

    8a,e some*ody w%o lo,es refactoring

  • 8/12/2019 Code Simplicity Open Source Design

    27/27

    $%e 2nd: ) @

    %ttp:www"codesimplicity"com

    max!codesimplicity"com

    http://www.codesimplicity.com/http://www.codesimplicity.com/