1.4-Phases_of_Software_Life_Cycle_Implementation_and_Testing

1.4-Phases_of_Software_Life_Cycle_Implementation_and_Testing...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPT 225 Unit 1 Software Life Cycle and Principles of Software Development Step 3 - Implementation and Step 4 - Testing
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CMPT 225 Step 3 – Implementation • Using the information included in the class diagram we created during Step 2 – Design, we can now 1. Create a public interface for each of our classes • Describes the operations of our classes • Why do we need this “public interface”? – Unit 2 2. Start our Step 3 – Implementation 2
Background image of page 2
CMPT 225 3 1. Create a Public Interface • While creating our design, we decomposed using encapsulation – Our classes are abstract data type (ADT’s) • Hide their implementation details (HOW operations work) inside • Only show the WHAT (WHAT does this class do, i.e., the operations of the class) public operations of each class can be found in our UML class diagram
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CMPT 225 4 In Java: protected (or private) int accountID; protected (or private) Customer customer; protected (or private) double balance; public double deposit( double anAmount ) public void withdraw( double anAmount ) 2. Start our Step 3 – Implementation - Example of Account Class
Background image of page 4
CMPT 225 5 Step 3 – Implementation Aside from OO programming language statements, our code must contain the following documentation: – Header block Filename Author Student number Date of creation – Class description – Class invariants – Comments describing purpose of attributes – Meaningful class, attributes, and operation names – For each operation Description Preconditions and postconditions (if any) List the exception(s) that is(are) thrown by the operation and describe the situation when this would happen
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CMPT 225 6 Header Comment Block • Block of comments located at the top of a file • In Cmpt 225, we shall include the following in our header comment block: – The name of the file – The author of the file – The student number of the author – The date of creation of the file
Background image of page 6
CMPT 225 7 Class Invariant Condition(s) that must be true for all objects instantiated from this class, from the moment these objects are instantiated to the moment they are destroyed Example: // Class Invariants: // - Account balance is always >= 0 // - Account ID numbers are unique and // cannot be modified. All constructors and operations of the class should satisfy the class invariants, i.e., always make sure that the class invariants remain true
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Condition(s) that must be true prior to the invocation of an operation It is part of the "contract" – If the preconditions are not true when the operation is called, the operation cannot guarantee the advertised results (i.e., results described in the postconditions of the operation) • e.g. for binary search, there is a precondition stating that the array being searched has been sorted beforehand – If not, there is not guarantee that the binary search will perform correctly – Note that preconditions must be “testables”. Why? Precondition
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/29/2012 for the course CMPT 225 taught by Professor Annelavergne during the Summer '07 term at Simon Fraser.

Page1 / 25

1.4-Phases_of_Software_Life_Cycle_Implementation_and_Testing...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online