Course Review Slides

advertisement
332 Final Review
Fall 2015
Professor Ammann
Agenda

Review Technical Topics Covered


Identify Areas for Study on Final


Final May Test Several Concepts at Once
Thursday, December 17 @ 10:30



Key Facets of Object Orientation
Final is NOT at noon!!!
Length: 2 hours and 30 minutes (max)
Goal: Strong Showing on Final
2
Exceptions


How to program Java exceptions
Rationale for exceptions


Providing defined behavior
Bloch Items 57-65






Exceptions for exceptional conditions
Checked vs. unchecked exceptions
Standard exceptions
Matching exceptions to the abstraction
Failure Atomicity
Ignoring Exceptions
3
JUnit and JavaDoc



JUnit tests for a given JavaDoc description
JavaDoc and JUnit for exceptions
Contract model and Junit

JUnit theories





(typed) parameters in test methods
Data sources (JUnit)
preconditions: assumeTrue(…)
postconditions: assertTrue(…)
Can you count?
4
Contracts

Fundamental Topic



Expect Significant Exam Coverage
Understanding, not Formality, is the Focus
Method contracts



Preconditions, Postconditions, Invariants
Relation to JavaDoc
Relation to JUnit
5
Data Abstraction

Abstraction Functions



Representation Invariants



What they are
How to implement (toString())
What they are
How to check
Fair exam questions



Identify abstract states wrt implementation states
Identify states that satisfy/violate rep invariants
Identify rep invariants that disallow certain states
6
Method Verification

Verification of methods in isolation


Two part verification



Maintain representation invariant
Show implementation satisfies contract
Role of the abstraction function


Representation invariant captures method
interactions
Relating implementation state to abstract state
Fair exam question

Given contract/code pair

Will verification succeed? If not, why not?
7
Object Creation/Destruction

Rules for Object creation

Bloch Chapter 2


Constructor chaining and it’s analogues


Static factories, constructors with many parameters
Similar rules apply for cloning, serialization
Access to uninitialized state

See Bloch Item 17
8
Substitution Principle

Core principle for inheritance


Nuances of “IS-A” relationship
Reasoning About Subtypes

Signature Rule


Methods Rule




Rules for Exceptions
Preconditions/Postconditions
More Rules for Exceptions
Relation to Method Verification
Properties Rule
9
Substitution Principle and
Methods Common to All Objects

Understand the problem

equals()


hashCode()


Transitivity, Symmetry, Substitution for subtypes
Consistency with equals()
Understand the solution


Composition (Bloch Item 16)
Understand Bloch’s InstrumentedSet example
10
Iteration Abstraction

What’s the state of a given iterator?




How do preconditions figure into Java
iterators?


With next(), hasNext()?
With remove()?
With previous(), hasPrevious()?
Can they be transformed into exceptions?
Good exam question:

How does the state evolve as the iterator is
used?
11
Polymorphic Abstraction

Element Subtype vs. Related Subtype



Comparable vs. Comparator
Addable vs Adder
Good exam question:

Analyze/Repair a defective Comparator
implementation

What, exactly, does “defective” mean?
12
Mutability

Key topic


Should be comfortable converting between
mutable and immutable types
Achieving mutability, using guidance from
both Liskov and Bloch



Transforming mutators to producers
Limiting subtyping
Limiting changes to instance variables
13
Generics

Programming with Java generics



Understand that they are really “ungenerics”
Type safety aspects
Java Generics (Bloch Chapter 5)



Arrays vs. Lists
Converting to generics
What do bounded wildcards do?


? extends E
? super E
14
Enums and Annotations



Problems with C-Style Enums
Enums, EnumSet, EnumMap
Simple Annotations

@Test, @SuppressWarnings, @Override…
15
Odds and Ends



Basic Agile
Basic Usable Security
Just having been in class should be
enough here
16
Wrap Up

Closed Book/Notes/Slides/Phone/Web/etc.


You may bring one (1) 8.5”x11” paper




Bring something to write with
Your handwriting – no printing/photocopying
Double-sided is fine
Goal: Effective study aid
Prepare with quizzes, in-class exercises

At least one quiz or in-class will be on final
17
More Wrap Up


Grading issues (Blackboard) must be
brought to my attention by the final exam
Questions?
18
Download