Unformatted text preview:

CS427: Software Engineering IMidterm examComment on midterm examProject infoTopicsUse formal specifications (1)Use formal specifications (2)What you should know about formal methodsTests as specificationsAdvantages of tests as specsDisadvantages of tests as specsJUnitTesting Student and CourseNormal testMore involved exampleSlide 16DesignLife-cycleA good designKeep It Simple (S)Keep it simpleDavis Design Principles (1)Davis Design Principles (2)DavisMany things to designSlide 26What can go wrong?Too hard to add new featuresSeparate user interfaceAutomated testsSummaryProject advice repeatedNext time1CS427:Software Engineering IDarko Marinov(slides from Ralph Johnson)CS427 14-2Midterm examYou can get graded exams from TAsFeel free to ask if you think we made mistakeGrades almost normally distributedCS427 14-3Comment on midterm examCOCOMO question is picking details from the reading; is it really like that?One correct answer, using formula E ~ sizePThis is not exponential, not E ~ PsizeAnother correct answer, common senseE(200KLOC) = 2*E(100KLOC) + E(integration)Common sense can lead to incorrect answersE(200KLOC) ≤ 2*E(100KLOC)CS427 14-4Project infoGroups formed (any volunteers for 10?)Grading: You are graded on how well you follow your process (you decide XP or RUP)You must know itYou must follow itYou must prove you follow itMake a log of what you do every dayHW2 is due next Tuesday, Oct 24Use cases and UML diagrams for your projectCS427 14-5TopicsCoveredRequirementsSome specificationSome designToday: specification and designChapters 9, 10, 11 of Hamlet and MaybeeFormal specsTests as specsSpecs vs. designCS427 14-6Use formal specifications (1)To develop models of parts of systemFinite state machines, abstract data typesTo develop model of one aspect of systemData-flow diagram, security, architectureTo learn how to think about problemPre/post conditions, invariantsSet, sequence, mappings (generic ADTs)CS427 14-7Use formal specifications (2)For particular kinds of applicationsCompilersGrammarDenotational semanticsSafety criticalCS427 14-8What you should know about formal methodsChapter 10 of Hamlet and MaybeeBe familiar with the controversyDon’t need to learn PrologCS427 14-9Tests as specificationsFormal specification (entire space)Balance after you add money to an account will be the balance beforehand plus the amount of money you addedTest (one point in the space)Create account with balance of $100Add $20 to accountAccount has balance of $120CS427 14-10Advantages of tests as specsConcrete, easy to understandDon’t need new languageEasy to see if program meets the specsMaking tests forces you to talk to customer and learn the problemMaking tests forces you to think about design of system (classes, methods, etc.)CS427 14-11Disadvantages of tests as specsHard to test that something can’t happenCan’t withdraw more money than you have in the systemCan’t break into the systemCan’t cause a very long transaction that hangs the systemTends to be verboseSampling many points from the spaceCS427 14-12JUnitwww.junit.orgA test is a method whose name starts with “test” in a subclass of TestCaseVersion 4.0 also allows @Tets annotationsCalls methods (defined in TestCase) likeassertEqual(object1, object2)assertTrue(boolean)CS427 14-13Testing Student and Coursepublic void testStudentCreation() {Student s = new Student("Marvin Minsky");assertTrue(s.getName().equals("Marvin Minsky"));}orpublic void testStudentCreation() {Student s = new Student("Marvin Minsky");assertEqual(s.getName(), "Marvin Minsky");}CS427 14-14Normal testSet up “test fixture”Call method that is being testedAssert that result is correctCS427 14-15More involved examplepublic void testAddingStudent() { Course c = new Course("Tourism 101"); Student s = new Student("Donald Knuth"); c.addStudent(s); assertEquals(c.students().size(), 1); assertEquals(c.students().elementAt(0), s); }CS427 14-16Tests as specificationsTests show how to use the systemTests need to be readableNeed comments that describe their purposeKeep short, delete duplicationCS427 14-17DesignVerbTo conceive or plan out in the mindTo make a drawing, pattern, or sketch ofCS427 14-18Life-cycleRequirements captureSpecificationDesignImplementationCS427 14-19A good designSatisfies requirementsEasy to implementEasy to understandEasy to changeEasy to check for correctnessIs beautiful (welcome [back] to Software Engineering)CS427 14-20Keep It Simple (S)Einstein: “Everything should be as simple as possible, but no simpler.”Saint-Exupery: “A design is perfect not when there is nothing to add, but when there is nothing to take away.”Gates: “Measuring a program by the number of lines of code is like measuring an airplane by how much it weighs.”CS427 14-21Keep it simpleAvoid duplicationEliminate unnecessary features/codeHide informationNo surprises (follow standards)CS427 14-22Davis Design Principles (1)Don’t reinvent the wheelSearch the web. Read the book. Talk to experts. Exhibit uniformity and integrationMake parts as similar as possibleCoding standardStandard namesCS427 14-23Davis Design Principles (2)Minimize the intellectual distance between the software and the problem as it exists in the real worldUse same names as your customersUse same models as your customersStructure the design to accommodate changeCS427 14-24DavisThe design should be structured to degrade gently, even when aberrant data, events, or operating conditions are encounteredThe design should be assessed for quality as it is being created, not after the factThe design should be reviewed to minimize conceptual errorsCS427 14-25Many things to designCompanySystem that uses programInterface to programInterface of module within programProcedureDatabaseCS427 14-26DesignProcess of eliminating “misfits”Find something wrong and fix itGood design requires being able to spot something that is wrongCS427 14-27What can go wrong?Too complex - can’t understandUsers can’t understandProgrammers can’t understandToo slowWrong featuresToo hard to add new featuresNot compatibleCS427 14-28Too hard to add new


View Full Document

U of I CS 427 - Software Engineering I

Download Software Engineering I
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Software Engineering I and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Software Engineering I 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?