Docsity

Object Oriented Code Inspection - Java and the Web - Lecture Slides, Slides of Java Programming

Partial preview of the text

Download Object Oriented Code Inspection - Java and the Web - Lecture Slides and more Slides Java Programming in PDF only on Docsity!

Object Oriented Code Inspection

Code inspections

• Code inspections were a common way of

finding defects in procedural programming.

Inspections are difficult in object-oriented

programming because issues like inheritance,

dynamic binding, non-local effects and

polymorphism make the structure of object

oriented code non-linear and difficult to

inspect.

Value of Inspections

  • In my personal experience in Bell Labs, manual inspections

had two major benefits:

  • They were excellent tools to improve quality by finding

defects.

  • They were also excellent for training programmers.
  • It is for the second reason that I will use them in classroom

sections of this course.

Distance Learning Students

• Since inspections require co-location, I cannot

require them for DL students. But I do require

you to prepare documents for them the same

as classroom students, and I encourage you to

get together with each other to do inspections

and learn from them.

Planning documents

  • Any of the following planning documents are acceptable for this

course:

– A fully dressed use case

– An interaction diagram

– A JUnit test suite (test-first programming)

– Story cards and Class Responsibility Collaboration

(CRC) cards (XP)

– Operation contracts (usually for methods)

  • Choose the planning documents most appropriate for your code.

Fully

Dressed

Use

Case

Sequence Diagram

Communication Diagram

Story and CRC Cards

  • Story cards and CRC cards are informal tools, usually

handwritten, often used in eXtreme Programming. XP depends

on having a SME (subject matter expert) available to provide

additional details to the developers as they code.

  • Story cards, like use cases, describe a particular scenario for the

application.

  • CRC cards, one per class, describe the class, its responsibilities,

and tells what other classes it collaborates with.

Story Card

Each payroll period, a check and check stub has to be created for each employee. Timesheets Supply hours worked and overtime for hourly workers plus sick time and holidays for all workers. Taxes are calculated from tax details, and deductions are computed for Medical Plan, Dental Plan, Retirement Plan, and 401K Plan. A permanent Record of the Paycheck is maintained in the Pay Ledger.

Operation Contract

Abstract Specifications

  • Write an abstract specification for each class and method to be

inspected, as well as any classes and methods called from within

the class.

  • The abstract specification should be brief and contain

– A statement of the purpose of the class or method

– A list of all state changes and outputs in terms of

inputs and prior state.

Roles in Code Inspections

  • Moderator – controls the process and timing. Does not ask

questions or identify defects.

  • Reader – the author of the code, who reads and explains each

line, and responds to questions.

  • Inspector – (can be several) asks questions and identifies

defects.

  • Recorder – (may be moderator) documents findings. Does not

ask questions or identify defects.

Sample Inspection Report

Date: November 17, 2005 Begin 2:30 pm End 4:00 pm Participants: Moderator G.Blank Reader T. Smith Inspectors P.Shah, A.Patel Recorder (moderator) Material Reviewed Size: 6 classes Author: T.Smith Name and Description: Multi Plotter, Homework # 7.3 for CIS 602

Inspection Outcome: No ReWork ReWork XX ReWork & Reinspection Defects Detected 12 Type 3 Algorithm errors 1 Wrong Message

…