200607 McConnell

download 200607 McConnell

of 54

Transcript of 200607 McConnell

  • 8/13/2019 200607 McConnell

    1/54

    Code Complete 2:Code Complete 2:Realities of ModernRealities of Modern

    Software ConstructionSoftware Construction

    www.construx.comwww.construx.com

    20042004 --20052005 Construx Software Builders, Inc.Construx Software Builders, Inc. All Rights Reserved. All Rights Reserved.

    ConstruxConstruxDelivering Software Project SuccessDelivering Software Project Success

  • 8/13/2019 200607 McConnell

    2/54

  • 8/13/2019 200607 McConnell

    3/54

    R

  • 8/13/2019 200607 McConnell

    4/54

    Really,Really

  • 8/13/2019 200607 McConnell

    5/54

    DA VINCICODECOMPLETESteve McConnell

  • 8/13/2019 200607 McConnell

    6/54

    T h i s T i m e

    t s P e r s o n a l

    T h i s T i m e

    t s P e r s o n a l

    T h i s T i m e

    I t s P e r s o n a l

  • 8/13/2019 200607 McConnell

    7/54

  • 8/13/2019 200607 McConnell

    8/54

    consulting training software projects construx.com8

    Code Complete MissionCode Complete Mission

    Attempt in 1993 was to capture lasting Attempt in 1993 was to capture lastingknowledge of software constructionknowledge of software constructionIIve asserted for many years that 95% ofve asserted for many years that 95% of

    the content of CC1 is still relevantthe content of CC1 is still relevantWas this true?Was this true?

  • 8/13/2019 200607 McConnell

    9/54

  • 8/13/2019 200607 McConnell

    10/54

    consulting training software projects construx.com10

    Overview of TalkOverview of Talk

    The Worst Construction Ideas of the 1990sThe Worst Construction Ideas of the 1990sand 2000sand 2000s

    A Decade of Advances in Software A Decade of Advances in Software

    ConstructionConstructionTen Realities of Modern SoftwareTen Realities of Modern SoftwareConstructionConstruction

  • 8/13/2019 200607 McConnell

    11/54

    The WorstThe WorstConstruction Ideas ofConstruction Ideas of

    the 1990s and 2000sthe 1990s and 2000s

  • 8/13/2019 200607 McConnell

    12/54

    consulting training software projects construx.com12

    Some of the WorstSome of the WorstConstruction Ideas of 1990sConstruction Ideas of 1990s

    Code & fixCode & fix All design up front All design up front programmingprogrammingDesign for speculative requirementsDesign for speculative requirementsComponents will solve all ourComponents will solve all ourconstruction problemsconstruction problems

    Automatic programming Automatic programmingUninformed use of the waterfall modelUninformed use of the waterfall modelCalling everythingCalling everything object orientedobject oriented

  • 8/13/2019 200607 McConnell

    13/54

    consulting training software projects construx.com13

    Some of the WorstSome of the WorstConstruction Ideas of 2000sConstruction Ideas of 2000s

    Code & fixCode & fix No design up frontNo design up front programmingprogrammingPlanning to refactor later Planning to refactor later Offshore outsourcing will solve all ourOffshore outsourcing will solve all ourconstruction problemsconstruction problems

    Automatic programming Automatic programmingUninformed use of Extreme ProgrammingUninformed use of Extreme ProgrammingCalling everythingCalling everything agileagile

  • 8/13/2019 200607 McConnell

    14/54

    consulting training software projects construx.com14

    Worst Ideas, 1990s vs. 2000sWorst Ideas, 1990s vs. 2000s1990s1990s

    Code & fixCode & fix All design up front All design up front programmingprogrammingDesign for speculativeDesign for speculative

    requirementsrequirementsComponents will solve allComponents will solve allour construction problemsour construction problems

    Automatic programming Automatic programmingUninformed use of theUninformed use of thewaterfall modelwaterfall modelCalling everythingCalling everything objectobject

    orientedoriented

    2000s2000s

    Code & fixCode & fix No design up frontNo design up front programmingprogrammingPlanning to refactor later Planning to refactor later

    Offshore outsourcing willOffshore outsourcing willsolve all our problemssolve all our problems

    Automatic programming Automatic programmingUninformed use ofUninformed use ofExtreme ProgrammingExtreme ProgrammingCalling everythingCalling everything agileagile

  • 8/13/2019 200607 McConnell

    15/54

    A Decade of AdvancesA Decade of Advancesin Softwarein Software

    ConstructionConstruction

  • 8/13/2019 200607 McConnell

    16/54

    consulting training software projects construx.com16

    0. With the Theatrical Release0. With the Theatrical Releaseof Lord of the Ringsof Lord of the Rings

    ALL companies can have servers named ALL companies can have servers namedGandalf and FrodoGandalf and Frodo

  • 8/13/2019 200607 McConnell

    17/54

  • 8/13/2019 200607 McConnell

    18/54

    consulting training software projects construx.com18

    2. Daily Build and Smoke Test2. Daily Build and Smoke Test

    Institutionalizes incremental integrationInstitutionalizes incremental integrationMinimizes serious integration problemsMinimizes serious integration problemsthat used to be commonthat used to be common

    Lots of other benefits, tooLots of other benefits, too

  • 8/13/2019 200607 McConnell

    19/54

    consulting training software projects construx.com19

    3. Standard Libraries3. Standard Libraries

    Good programmers have always usedGood programmers have always usedlibrarieslibrariesNow provided with languages (Java, C++,Now provided with languages (Java, C++,

    .NET).NET)

  • 8/13/2019 200607 McConnell

    20/54

    consulting training software projects construx.com20

    4. Visual Basic4. Visual Basic

    Visual programming innovationVisual programming innovationThe first development environment toThe first development environment tomake widespread use of COTSmake widespread use of COTS

    componentscomponentsOnly language to learnOnly language to learn Ada Ada ss syntaxsyntaxlessons (case statements, controllessons (case statements, control

    statements, etc.)statements, etc.)Highly integrated environmentHighly integrated environment

  • 8/13/2019 200607 McConnell

    21/54

    consulting training software projects construx.com21

    5. Open Source Software5. Open Source Software

    Great aid to programmers duringGreat aid to programmers duringdevelopmentdevelopmentReduced barriers to making code availableReduced barriers to making code available

    Opportunity to learn from available codeOpportunity to learn from available codeImproved ability toImproved ability to readread codecodeNiceNice communitycommunity of programmersof programmers

  • 8/13/2019 200607 McConnell

    22/54

    consulting training software projects construx.com22

    6. The Web for Research6. The Web for Research

    FAQsFAQsDiscussion groupsDiscussion groupsSearchabilitySearchability in generalin general

  • 8/13/2019 200607 McConnell

    23/54

    consulting training software projects construx.com23

    7. Widespread Use of7. Widespread Use ofIncremental DevelopmentIncremental Development

    Concepts were well known in 1990sConcepts were well known in 1990sPractice is well established in 2000sPractice is well established in 2000s

    From CC1:From CC1:The wordThe word incrementalincremental has never achieved thehas never achieved thedesigner status ofdesigner status of structuredstructured oror objectobject --oriented,oriented, soso

    no one has ever written a book onno one has ever written a book on incrementalincrementalsoftware engineering.software engineering. ThatThat s too bad because thes too bad because thecollection of techniques in such a book would becollection of techniques in such a book would beexceptionally potent.exceptionally potent.

  • 8/13/2019 200607 McConnell

    24/54

    consulting training software projects construx.com24

    8. Test8. Test --First DevelopmentFirst Development

    Shortens time to defect detectionShortens time to defect detectionIncreases personal disciplineIncreases personal disciplineComplements daily build & smoke testComplements daily build & smoke test

  • 8/13/2019 200607 McConnell

    25/54

    consulting training software projects construx.com25

    9. Refactoring as a Discipline9. Refactoring as a Discipline

    Provides a discipline for making changesProvides a discipline for making changesNot so good as a total design strategyNot so good as a total design strategy

    Good example of incrementalismGood example of incrementalism

  • 8/13/2019 200607 McConnell

    26/54

    consulting training software projects construx.com26

    10. Faster Computers10. Faster Computers

    Compare CC1 performance benchmarks toCompare CC1 performance benchmarks toCC2 benchmarksCC2 benchmarksImplications for optimizationImplications for optimization

    Implications for programming languagesImplications for programming languagesImplications for developmentImplications for development

  • 8/13/2019 200607 McConnell

    27/54

    Ten Realities ofTen Realities ofModern SoftwareModern Software

    ConstructionConstruction

  • 8/13/2019 200607 McConnell

    28/54

    --11 -- ConstructionConstruction is ais a

    Legitimate TopicLegitimate Topic

  • 8/13/2019 200607 McConnell

    29/54

    consulting training software projects construx.com29

    SoftwareSoftware ConstructionConstruction Used to Look Like ThisUsed to Look Like This

    SoftwareConcept

    SystemTesting

    Arch it ecturalDesign

    Requirements Analys is

    DetailedDesign

    Coding andDebugging

  • 8/13/2019 200607 McConnell

    30/54

    consulting training software projects construx.com30

    SoftwareSoftware ConstructionConstruction Now Looks Like ThisNow Looks Like This

    DetailedDesign

    Integration

    UnitTesting

    IntegrationTesting

    RequirementsDevelopment

    ProblemDefinition

    Software Archi tecture

    SystemTesting

    CorrectiveMaintenance

    ConstructionPlanning

    Coding andDebugging

  • 8/13/2019 200607 McConnell

    31/54

    consulting training software projects construx.com31

    Distinction Between ActivitiesDistinction Between Activitiesand Phasesand Phases

    Activity != Phase Activity != PhaseTalking aboutTalking about ConstructionConstruction as anas anactivity does not imply a distinct phaseactivity does not imply a distinct phase

    Differentiating between kinds of activitiesDifferentiating between kinds of activitiesis extremely helpfulis extremely helpful

  • 8/13/2019 200607 McConnell

    32/54

    --22 --Individual Variation IsIndividual Variation Is

    SignificantSignificant

  • 8/13/2019 200607 McConnell

    33/54

    consulting training software projects construx.com33

    Where do Variations Exist?Where do Variations Exist?

    Researchers have found variations ranging fromResearchers have found variations ranging from10x to 28x in:10x to 28x in:Coding speedCoding speedDebugging speedDebugging speed

    DefectDefect --finding speedfinding speedPercentage of defects foundPercentage of defects foundBadBad --fix injection ratefix injection rate

    Design qualityDesign quality Amount of code generated from a design Amount of code generated from a designEtc.Etc.

  • 8/13/2019 200607 McConnell

    34/54

    consulting training software projects construx.com34

    Key Skills of an ExpertKey Skills of an ExpertProgrammer Programmer

    DesigningDesigningFlushing out errors and ambiguities inFlushing out errors and ambiguities inrequirementsrequirementsCoding (naming, formatting, commenting)Coding (naming, formatting, commenting)

    Reading & reviewing codeReading & reviewing codeIntegrationIntegrationDebuggingDebugging

    Unit testingUnit testingTeamworkTeamworkUsing tools for all of the aboveUsing tools for all of the above

  • 8/13/2019 200607 McConnell

    35/54

  • 8/13/2019 200607 McConnell

    36/54

    consulting training software projects construx.com36

    Why Personal DisciplineWhy Personal DisciplineMattersMatters

    Being realistic about predicting the futureBeing realist ic about predicting the future Areas where discipline matters Areas where discipline matters

    RefactoringRefactoringPrototypingPrototypingOptimizationOptimizationMinimalMinimal --complexity designs specificallycomplexity designs specificallyManaging complexity generallyManaging complexity generally

    EndpointsEndpoints Discipline and CourageDiscipline and CourageHumphrey on PSPHumphrey on PSPBeck on Extreme ProgrammingBeck on Extreme Programming

  • 8/13/2019 200607 McConnell

    37/54

    --44 --A Focus on SimplicityA Focus on SimplicityWorks Better than aWorks Better than a

    Focus on ComplexityFocus on Complexity

  • 8/13/2019 200607 McConnell

    38/54

    consulting training software projects construx.com38

    Simplicity vs. ComplexitySimplicity vs. Complexity

    Why do projects fail?Why do projects fail?Focus on readFocus on read --time convenience, nottime convenience, notwritewrite --time conveniencetime convenience

    YAGNI and design for speculativeYAGNI and design for speculativerequirementsrequirements

  • 8/13/2019 200607 McConnell

    39/54

    --55 --DefectDefect --Cost IncreaseCost Increase

    is Alive and Wellis Alive and Well

  • 8/13/2019 200607 McConnell

    40/54

    consulting training software projects construx.com40

    Defect Cost IncreaseDefect Cost Increase

    Requirements

    Architecture

    Construction

    System testRequirements Architecture Construction Post-Release

    AverageCost to

    Correct

    Activity in which aDefect IsIntroduced

    Activity in Which a Defect Is Detected

    Fix Here Dont Waitto Fix Here

  • 8/13/2019 200607 McConnell

    41/54

    consulting training software projects construx.com41

    Decades of Research SupportDecades of Research SupportDefectDefect --Cost IncreaseCost Increase

    Fagan, Michael E. 1976.Fagan, Michael E. 1976. Design and Code Inspections to Reduce Errors in ProgramDesign and Code Inspections to Reduce Errors in ProgramDevelopment.Development. IBM Systems JournalIBM Systems Journal 15, no. 3: 18215, no. 3: 182 211.211.Humphrey, Watts S., Terry R. Snyder, and Ronald R. Willis. 1991.Humphrey, Watts S., Terry R. Snyder, and Ronald R. Willis. 1991. Software ProcessSoftware ProcessImprovement at Hughes Aircraft.Improvement at Hughes Aircraft. IEEE SoftwareIEEE Software 8, no. 4 (July): 118, no. 4 (July): 11 23.23.Leffingwell, Dean, 1997.Leffingwell, Dean, 1997. Calculating the Return on Investment from More EffectiveCalculating the Return on Investment from More EffectiveRequirements Management,Requirements Management, American Programmer American Programmer , 10(4):13, 10(4):13 --16.16.

    Willis, Ron R., et al, 1998.Willis, Ron R., et al, 1998. Hughes AircraftHughes Aircraft s Widespread Deployment of a Continuouslys Widespread Deployment of a ContinuouslyImproving Software Process,Improving Software Process, Software Engineering Institute/Carnegie Mellon University,Software Engineering Institute/Carnegie Mellon University,CMU/SEICMU/SEI --9898 --TRTR --006, May 1998.006, May 1998.Grady, Robert B. 1999.Grady, Robert B. 1999. An Economic Release Decision Model: Insights into Software An Economic Release Decision Model: Insights into SoftwareProject Management.Project Management. InIn Proceedings of the Applications of Software MeasurementProceedings of the Applications of Software MeasurementConferenceConference , 227, 227 --239. Orange Park, FL: Software Quality Engineering.239. Orange Park, FL: Software Quality Engineering.

    Shull, et al, 2002.Shull, et al, 2002. What We Have Learned About Fighting Defects,What We Have Learned About Fighting Defects, Proceedings, MetricsProceedings, Metrics20022002 . IEEE; pp. 249. IEEE; pp. 249 --258.258.Boehm, Barry and Richard Turner, 2004.Boehm, Barry and Richard Turner, 2004. Balancing Agility and Discipline: A Guide for theBalancing Agility and Discipline: A Guide for thePerplexedPerplexed , Boston, Mass.: Addison Wesley, 2004., Boston, Mass.: Addison Wesley, 2004.

  • 8/13/2019 200607 McConnell

    42/54

    --66 --Design Is ImportantDesign Is Important

  • 8/13/2019 200607 McConnell

    43/54

    consulting training software projects construx.com43

    Design AdviceDesign Advice What hasWhat hasChanged in 10 Years?Changed in 10 Years?

    In 1990s, design pundits wanted to dotIn 1990s, design pundits wanted to doteveryevery ii and cross everyand cross every tt before writingbefore writingany codeany codeIn 2000s, design pundits say BDUF?In 2000s, design pundits say BDUF?YAGNI!YAGNI!There are lots of valid points on theThere are lots of valid points on the nonodesigndesign all designall design continuumcontinuumThe only 2 points guaranteed to be wrongThe only 2 points guaranteed to be wrongare the two that have been advocated!are the two that have been advocated!

  • 8/13/2019 200607 McConnell

    44/54

    consulting training software projects construx.com44

    General Point: Extremes areGeneral Point: Extremes areUsually Not ProductiveUsually Not Productive

    All design up front vs. no design up front All design up front vs. no design up frontEntirely planned vs. entirely improvisedEntirely planned vs. entirely improvisedPure iterative vs. straight sequentialPure iterative vs. straight sequential

    All structure vs. all creative All structure vs. all creativeDocument everything vs. documentDocument everything vs. documentnothingnothing

  • 8/13/2019 200607 McConnell

    45/54

    --77 --Technology WavesTechnology Waves

    Affect ConstructionAffect ConstructionPracticesPractices

  • 8/13/2019 200607 McConnell

    46/54

  • 8/13/2019 200607 McConnell

    47/54

    --88 --IncrementalIncremental

    Approaches Work BestApproaches Work Best

  • 8/13/2019 200607 McConnell

    48/54

    consulting training software projects construx.com48

    Perspective on IncrementalismPerspective on Incrementalism

    The pure waterfall model is not at all incrementalThe pure waterfall model is not at all incrementalor iterativeor iterative which is why it hasnwhich is why it hasn t worked veryt worked verywellwellSpiral development is highly incremental andSpiral development is highly incremental and

    iterative, which is part of why it does work welliterative, which is part of why it does work well All projects will experience iteration at some All projects will experience iteration at somepointpoint

    Think aboutThink about wherewhere andand whenwhen in your project youin your project youwill get your incrementalismwill get your incrementalism cheaply, orcheaply, orexpensively?expensively?

  • 8/13/2019 200607 McConnell

    49/54

    --99 --The Toolbox MetaphorThe Toolbox Metaphor

    Continues to beContinues to beIlluminatingIlluminating

  • 8/13/2019 200607 McConnell

    50/54

    consulting training software projects construx.com50

    Toolbox Metaphor Toolbox Metaphor

    WhatWhat s best? Agile? XP? Scrum? DSDM? CMM?s best? Agile? XP? Scrum? DSDM? CMM?Toolbox explains thereToolbox explains there s no one right tool fors no one right tool forevery jobevery jobDifferent industry segments will have differentDifferent industry segments will have differenttools and even different toolboxestools and even different toolboxesWhatWhat s in the Software Engineering Toolbox?s in the Software Engineering Toolbox?

    Best practicesBest practices

    Lifecycle modelsLifecycle modelsTemplates, checklists , patterns, examplesTemplates, checklists, patterns, examplesSoftware toolsSoftware tools

  • 8/13/2019 200607 McConnell

    51/54

    --1010 --SoftwareSoftware s Essentials Essential

    Tensions RemainTensions Remain

  • 8/13/2019 200607 McConnell

    52/54

    consulting training software projects construx.com52

    SoftwareSoftware s Essential Tensionss Essential Tensions

    SoftwareSoftware s essential tensions have remaineds essential tensions have remainedunchanged for years:unchanged for years:Rigid plans vs. ImprovisationRigid plans vs. ImprovisationPlanning vs. Fortune TellingPlanning vs. Fortune Telling

    Creativi ty vs. StructureCreativi ty vs. StructureDiscipline vs. Flexibili tyDiscipline vs. Flexibili tyQuantitative vs. QualitativeQuantitative vs. QualitativeProcess vs. ProductProcess vs. Product

    Optimizing vs.Optimizing vs. SatisficingSatisficing

    Balance wavers, but basic tensions are constantsBalance wavers, but basic tensions are constants

  • 8/13/2019 200607 McConnell

    53/54

    TALKCOMPLETE

    Steve McConnell

  • 8/13/2019 200607 McConnell

    54/54

    consulting training software projects construx.com54

    TrainingSoftware ProjectsCoaching & Consulting

    [email protected]

    www.construx.com

    ConstruxConstruxDelivering Software Project SuccessDelivering Software Project Success