1 17-214
PrinciplesofSoftwareConstruction: Objects,Design,andConcurrencyPart1:IntroductionCourseoverviewandintroductiontosoftwaredesignJoshBloch CharlieGarrod
2 17-214
Softwareiseverywhere
3 17-214
Growthofcodeandcomplexityovertime
4 17-214
Blackout of 2003 Normal night-time image
5 17-214
6 17-214 6
7 17-214
PrinciplesofSoftwareConstruction: Objects,Design,andConcurrencyPart1:IntroductionCourseoverviewandintroductiontosoftwaredesignJoshBloch CharlieGarrod
8 17-214
binary tree
graph search
sorting
primes
GCD
9 17-214
Our goal: understanding both the building blocks and the design principles for construction of software systems
Fromprogramstosystems
Writingalgorithms,datastructuresfromscratch
Functionswithinputs
andoutputsSequentialandlocal
computation
Fullfunctionalspecifications
Reuseoflibraries,frameworks
Asynchronousandreactivedesigns
Parallelanddistributed
computationPartial,composable,
targetedmodels
10 17-214
PrinciplesofSoftwareConstruction: Objects,Design,andConcurrencyPart1:IntroductionCourseoverviewandintroductiontosoftwaredesignJoshBloch CharlieGarrod
11 17-214
Objectsintherealworld
12 17-214
Object-orientedprogramming
• Programmingbasedonstructuresthatcontainbothdataandmethods
publicclassBicycle{privatefinalWheelfrontWheel,rearWheel;privatefinalSeatseat;privateintspeed;…publicBicycle(…){…}publicvoidaccelerate(){speed++;}publicintspeed(){returnspeed;}}
13 17-214
PrinciplesofSoftwareConstruction: Objects,Design,andConcurrencyPart1:IntroductionCourseoverviewandintroductiontosoftwaredesignJoshBloch CharlieGarrod
14 17-214
Semesteroverview
• IntroductiontoJavaandO-O• Introductiontodesign
– Designgoals,principles,patterns• Designingclasses
– Designforchange– Designforreuse
• Designing(sub)systems– Designforrobustness– Designforchange(cont.)
• Designcasestudies• Designforlarge-scalereuse• Explicitconcurrency
• Crosscuttingtopics:– Moderndevelopmenttools:
IDEs,versioncontrol,buildautomation,continuousintegration,staticanalysis
– Modelingandspecification,formalandinformal
– Functionalcorrectness:Testing,staticanalysis,verification
15 17-214
Sorting with a configurable order, version A
staticvoidsort(int[]list,booleanascending){…booleanmustSwap;if(ascending){mustSwap=list[i]>list[j];}else{mustSwap=list[i]<list[j];}…}
16 17-214
Sorting with a configurable order, version B interfaceOrder{booleanlessThan(inti,intj);}classAscendingOrderimplementsOrder{publicbooleanlessThan(inti,intj){returni<j;}}classDescendingOrderimplementsOrder{publicbooleanlessThan(inti,intj){returni>j;}}staticvoidsort(int[]list,Orderorder){…booleanmustSwap=order.lessThan(list[j],list[i]);…}
17 17-214
Sorting with a configurable order, version B'
interfaceOrder{booleanlessThan(inti,intj);}finalOrderASCENDING=(i,j)->i<j;finalOrderDESCENDING=(i,j)->i>j;staticvoidsort(int[]list,Orderorder){…booleanmustSwap=order.lessThan(list[j],list[i]);…}
18 17-214
Which version is better?
staticvoidsort(int[]list,booleanascending){…booleanmustSwap;if(ascending){mustSwap=list[i]>list[j];}else{mustSwap=list[i]<list[j];}…}
interfaceOrder{booleanlessThan(inti,intj);}finalOrderASCENDING=(i,j)->i<j;finalOrderDESCENDING=(i,j)->i>j;staticvoidsort(int[]list,Orderorder){…booleanmustSwap=order.lessThan(list[j],list[i]);…}
Version A:
Version B':
19 17-214
It depends?
20 17-214
Software engineering is the branch of computer science that creates practical, cost-effective solutions to computing and information processing problems, preferably by applying scientific knowledge, developing software systems in the service of mankind.
Software Engineering for the 21st Century: A basis for rethinking the curriculum Manifesto, CMU-ISRI-05-108
21 17-214
Software engineering is the branch of computer science that creates practical, cost-effective solutions to computing and information processing problems, preferably by applying scientific knowledge, developing software systems in the service of mankind. Software engineering entails making decisions under constraints of limited time, knowledge, and resources…
Engineering quality resides in engineering judgment… Quality of the software product depends on the engineer’s faithfulness to the engineered artifact… Engineering requires reconciling conflicting constraints… Engineering skills improve as a result of careful systematic reflection on experience… Costs and time constraints matter, not just capability…
Software Engineering for the 21st Century: A basis for rethinking the curriculum
Manifesto, CMU-ISRI-05-108
22 17-214
Goalofsoftwaredesign
• Foreachdesiredprogrambehaviorthereareinfinitelymanyprograms– Whatarethedifferencesbetweenthevariants?– Whichvariantshouldwechoose?– Howcanwecreateavariantwithdesiredproperties?
23 17-214
Metricsofsoftwarequality,i.e.,designgoals
Functionalcorrectness Adherenceofimplementationtothespecifications
Robustness Abilitytohandleanomalousevents
Flexibility Abilitytoaccommodatechangesinspecifications
Reusability Abilitytobereusedinanotherapplication
Efficiency Satisfactionofspeedandstoragerequirements
Scalability Abilitytoserveasthebasisofalargerversionoftheapplication
Security Levelofconsiderationofapplicationsecurity
Source: Braude, Bernstein, Software Engineering. Wiley 2011
24 17-214
AtypicalIntroCSdesignprocess
1. Discusssoftwarethatneedstobewritten2. Writesomecode3. Testthecodetoidentifythedefects4. Debugtofindcausesofdefects5. Fixthedefects6. Ifnotdone,returntostep1
25 17-214
Bettersoftwaredesign
• Thinkbeforecoding:broadlyconsiderqualityattributes– Maintainability,extensibility,performance,…
• Propose,considerdesignalternatives– Makeexplicitdesigndecisions
26 17-214
Usingadesignprocess
• Adesignprocessorganizesyourwork• Adesignprocessstructuresyourunderstanding• Adesignprocessfacilitatescommunication
27 17-214
Preview:Designgoals,principles,andpatterns
• Designgoalsenableevaluationofdesigns– e.g.maintainability,reusability,scalability
• Designprinciplesareheuristicsthatdescribebestpractices– e.g.highcorrespondencetoreal-worldconcepts
• Designpatternscodifyrepeatedexperiences,commonsolutions– e.g.templatemethodpattern
28 17-214
PrinciplesofSoftwareConstruction: Objects,Design,andConcurrencyPart1:IntroductionCourseoverviewandintroductiontosoftwaredesignJoshBloch CharlieGarrod
29 17-214
Concurrency
• Roughly:doingmorethanonethingatatime
30 17-214
Summary:Coursethemes
• Object-orientedprogramming• Code-leveldesign• Analysisandmodeling• Concurrency
31 17-214
SoftwareEngineering(SE)atCMU
• 17-214:Code-leveldesign– Extensibility,reuse,concurrency,functionalcorrectness
• 17-313:Humanaspectsofsoftwaredevelopment– Requirements,teamwork,scalability,security,scheduling,costs,risks,
businessmodels
• 17-413Practicum,17-415Seminar,Internship• Variouscoursesonrequirements,architecture,software
analysis,SEforstartups,SEforML,APIdesign,etc.• SEminorandSEconcentration:
– https://isri.cmu.edu/education/undergrad
32 17-214
COURSEORGANIZATION
33 17-214
Thesearenotnormaltimes…
• Hybridvs.in-personvs.remote• Overallstudentexperience• Waitlistissues• Pre-semestersurvey:https://forms.gle/6okA6utwCsenxXcL8
34 17-214
Preconditions
• 15-122orequivalent– Twosemestersofprogramming– KnowledgeofC-likelanguages
• 21-127or15-151orequivalent– Familiaritywithbasicdiscretemathconcepts
• Specifically:– Basicprogrammingskills– Basic(formal)reasoningaboutprograms
• Pre/postconditions,invariants,formalverification– Basicalgorithmsanddatastructures
• Lists,graphs,sorting,binarysearch,etc.
35 17-214
Learninggoals
• Abilitytodesignandimplementmedium-scaleprograms• UnderstandingOOprogrammingconcepts&designdecisions• Proficiencywithbasicqualityassurancetechniquesfor
functionalcorrectness• Fundamentalsofconcurrency• Practicalskills
36 17-214
Coursestaff
• [email protected]://bit.ly/32J52av
• CharlieGarrod
[email protected]://bit.ly/3lviI1z
• Teachingassistants:Alice,Ashley,Daniel,Jiasheng,Michelle,Nathaniel,
Olivia,Valentine,andSean
37 17-214
Coursestaff
• [email protected]://bit.ly/32J52av
• CharlieGarrod
[email protected]://bit.ly/3lviI1z
• Teachingassistants:Alice,Ashley,Daniel,Jiasheng,Michelle,Nathaniel,
Olivia,Valentine,andSean
38 17-214
Coursemeetings
• Lectures:TuesdayandThursday,4:00–5:20pm• Recitations:Wednesdays10:30am-…-8:30pm
– Supplementarymaterial,hands-onpractice,feedback– Bepreparedtoworkonpaperandwithalaptop
• OfficehoursandZoomlinks:seecoursewebpage– https://www.cs.cmu.edu/~charlie/courses/17-214/
Synchronous attendance is required unless you have permission for asynchronous attendance
39 17-214
Infrastructure
• Coursewebsite:http://www.cs.cmu.edu/~charlie/courses/17-214– Schedule,officehourscalendar,lectureslides,policydocuments
• Tools– Git,Github:Assignmentdistribution,hand-in,andgrades– Piazza:Discussionboard– IntelliJorEclipse:Recommendedforcodedevelopment(otherIDEsarefine)– Gradle,Travis-CI,Checkstyle,SpotBugs:Practicaldevelopmenttools
• Firstrecitationistomorrow– IntroductiontoJavaandthetoolsinthecourse– InstallGit,Java,someIDE,Gradlebeforehand
• Assignments– Homework1availabletomorrow
40 17-214
Textbooks
• Requiredcoursetextbooks(electronicallyavailablethroughCMUlibrary):– JoshuaBloch.EffectiveJava,ThirdEdition.
Addison-Wesley,ISBN978-0-13-468599-1.– CraigLarman.ApplyingUMLandPatterns.3rd
Edition.PrenticeHall,ISBN978-0321356680.
• Additionalreadingsondesign,Java,andconcurrencyonthecoursewebpage
41 17-214
Approximategradingpolicy
• 50%assignments• 20%midtermexams(2x10%each)• 20%finalexam• 10%quizzesandparticipation
Thiscoursedoesnothaveafixedlettergradepolicy;i.e.,thefinallettergradeswillnotbeA=90-100%,B=80-90%,etc.
42 17-214
Collaborationpolicy(alsoseethecoursesyllabus)
• Weexpectyourworktobeyourown– Youmustclearlyciteexternalresourcessothatwecanevaluateyourown
personalcontributions.
• Donotreleaseyoursolutions(notevenafterendofsemester)• Askifyouhaveanyquestions• Ifyouarefeelingdesperate,pleasemail/call/talktous
– Alwaysturninanyworkyou'vecompletedbeforethedeadline
• Weusecheatingdetectiontools• Youmustsignandreturnacopyofthecollaborationpolicy
beforewewillgradeyourwork:https://goo.gl/CBXKQK– UploadsignedcollaborationpolicytoGradescope
43 17-214
Latedaypolicy
• Youmayturnineach*homeworkupto2dayslate• Youhavefivefreelatedayspersemester
– 10%penaltyperdayafterfreelatedaysareused• Wedon'tacceptwork3dayslate• Seethesyllabusforadditionaldetails• Gotextremecircumstances?Talktous
44 17-214
10%quizzesandparticipation
• Recitationparticipationcountstowardyourparticipationgrade• Lecturehasin-classquizzes
– Ifyouparticipateasynchronously,youmustcomplete"in-class"activitieswithin48hoursofclass
The key to your success in this course is your regular, synchronous engagement with course
activities, staff, and other students
45 17-214
Summary
• Softwareengineeringrequiresdecisions,judgment• Gooddesignfollowsaprocess• Youwillgetlotsofpracticein17-214!
Top Related