332 Final Review Fall 2018 Professor Ammann Final

  • Slides: 16
Download presentation
332 Final Review Fall 2018 Professor Ammann

332 Final Review Fall 2018 Professor Ammann

Final; Monday Dec 17 @7: 30 AM n Length: 2 hours n n n

Final; Monday Dec 17 @7: 30 AM n Length: 2 hours n n n You may bring one (1) 8. 5”x 11” paper n n Your handwriting – no printing/photocopying Double-sided is fine Goal: Effective study aid Prepare with quizzes, in-class exercises n n Closed Book/Notes/Slides/Phone/Web/etc. Bring something to write with Quiz or in-class likely to be on final Tip: Identify principle; work problem n Beware the eraser! 2

Wrap Up n n Quiz/HW grading issues must be brought to my attention by

Wrap Up n n Quiz/HW grading issues must be brought to my attention by the final exam Retake/Make-up quizzes n n Thursday 12/6 2 -4 PM: (SWE 437 GTA Office Hours) Monday 12/10 1 -2 PM: (My Office Hours) Monday 12/10 6: 30 -7: 00 PM: (My Office) Remaining slides are technical topics for your review; in-class we’ll focus on identifying higher level principles. 3

Exceptions n n How to program Java exceptions Rationale for exceptions n n Providing

Exceptions n n How to program Java exceptions Rationale for exceptions n n Providing defined behavior Be familiar with Bloch Chapter 9 4

JUnit and Java. Doc n n n JUnit tests for a given Java. Doc

JUnit and Java. Doc n n n JUnit tests for a given Java. Doc description Java. Doc and JUnit for exceptions Contract model and Junit n JUnit theories n n n (typed) parameters in test methods Data sources (JUnit) preconditions: assume. True(…) postconditions: assert. True(…) Can you count? 5

Contracts n Fundamental Topic n n n Expect Significant Exam Coverage Understanding, not Formality,

Contracts n Fundamental Topic n n n Expect Significant Exam Coverage Understanding, not Formality, is the Focus Method contracts n n n Preconditions, Postconditions, Invariants Relation to Java. Doc Relation to JUnit 6

Data Abstraction n Abstraction Functions n n n Representation Invariants n n n What

Data Abstraction n Abstraction Functions n n n Representation Invariants n n n What they are How to implement (to. String()) What they are How to check Fair exam questions n n n Identify abstract states wrt implementation states Identify states that satisfy/violate rep invariants Identify rep invariants that disallow certain states 7

Method Verification n Verification of methods in isolation n n Two part verification n

Method Verification n Verification of methods in isolation n n Two part verification n Maintain representation invariant Show implementation satisfies contract Role of the abstraction function n n Representation invariant captures method interactions Relating implementation state to abstract state Fair exam question n Given contract/code pair n Will verification succeed? If not, why not? 8

Substitution Principle n Core principle for inheritance n n Nuances of “IS-A” relationship Reasoning

Substitution Principle n Core principle for inheritance n n Nuances of “IS-A” relationship Reasoning About Subtypes n Signature Rule n n Methods Rule n n Rules for Exceptions Preconditions/Postconditions More Rules for Exceptions Relation to Method Verification Properties Rule 9

Substitution Principle and Methods Common to All Objects n Understand the problem n equals()

Substitution Principle and Methods Common to All Objects n Understand the problem n equals() n n hash. Code() n n Transitivity, Symmetry, Substitution for subtypes Consistency with equals() Understand the solution n n Composition (Bloch Item 16) Understand Bloch’s Instrumented. Set example 10

Iteration Abstraction n What’s the state of a given iterator? n n How do

Iteration Abstraction n What’s the state of a given iterator? n n How do preconditions figure into Java iterators? n n With next(), has. Next()? With remove()? With previous(), has. Previous()? Can they be transformed into exceptions? Good exam question: n How does the state evolve as the iterator is used? 11

Polymorphic Abstraction n Element Subtype vs. Related Subtype n n Comparable vs. Comparator Good

Polymorphic Abstraction n Element Subtype vs. Related Subtype n n Comparable vs. Comparator Good exam question: n Analyze/Repair a defective Comparator implementation n n What, exactly, does “defective” mean? Note that we covered lambda expressions this semester 12

Mutability n Key topic n n Should be comfortable converting between mutable and immutable

Mutability n Key topic n n Should be comfortable converting between mutable and immutable types Achieving mutability, using guidance from both Liskov and Bloch n n n Transforming mutators to producers Limiting subtyping Limiting changes to instance variables 13

Generics n Programming with Java generics n n n Understand that they are really

Generics n Programming with Java generics n n n Understand that they are really “ungenerics” Type safety aspects Java Generics (Bloch Chapter 5) n n n Arrays vs. Lists Converting to generics What do bounded wildcards do? n n ? extends E ? super E 14

Enums and Annotations n n n Problems with C-Style Enums Simple Annotations n @Test,

Enums and Annotations n n n Problems with C-Style Enums Simple Annotations n @Test, @Suppress. Warnings, @Override… 15

Odds and Ends n Object Creation n n Constructors, Factories Basic Usable Security n

Odds and Ends n Object Creation n n Constructors, Factories Basic Usable Security n Just having been in class should be enough here 16