Software Development Processes: Assignment

farzadbigz
Module9.pptx

Chapter 9: Implementation

1

Implementation Topics

Describe:

Characteristics of good implementations

Best practices to achieve them

Understand role of comments.

Learn debugging techniques.

Analyze refactoring.

2

Introduction

Implementation: transforming detailed design into valid program.

Detailed design may be done as part of implementation.

Faster

Less cohesive and less organized

Writing code, unit testing, debugging, configuration management.

3

Good Implementations

Readability

Maintainability

Performance

Traceability

Correctness

Completeness

Other issues:

Relative importance?

Tradeoffs?

4

Coding Guidelines

Organization specific.

Important for consistency.

Programmers can get used to them easily.

Usually mandate:

Indenting, formatting

Naming conventions (for files, variables, etc.)

Language features to use or avoid

5

Style Issues − I

Be consistent and highlight meaning.

Naming:

Convey meaning.

Be consistent.

Warning: If you can’t think of a good name chances are you don’t understand or the design can be improved.

Multicultural issues.

6

Style Issues − II

Separating words, capitalization

c_uses_this_style

JavaUsesThisOne

Indentation and spacing

Function/method size

When is it too big? When to break?

File naming

Error-prone constructs

7

Comments

Types:

Repeat of the code

Explanation of the code

Marker in the code

Summary of the code

Description of the code intent

External references

Keep up to date!

8

Debugging

Locating and fixing errors in code

Errors noticed by testing, inspection, use

Four phases

Stabilization (reproduction)

Localization

Correction

Verification

9

Debugging II

Heuristics:

Some routines will have many errors.

Routines with an error tend to have more.

New code tends to have more error.

Particular ones: languages, parts, coders.

Tools

Code comparators

Extended checkers (lint)

Interactive debuggers

Special libraries

Others: profilers, pre/post conditions, test coverage

10

Assertions

Pre-condition: condition your module requires in order to work

Post-condition: condition that should be true if your module worked

Assertion: executable statement that checks a condition and produces an error if it is not met

Assertions supported by many languages

11

Performance Optimization

Performance tradeoffs:

Readability?

Maintainability?

Correctness is usually more important.

Profiler: runs a program and calculates how much time it spends on each part.

Cost-benefit analysis.

Measure before “optimizing.”

12

Refactoring

Improving your code style without affecting its behavior

Bad Smells

Duplicated code

Long method

Large class

Switch statement

Feature envy

Intimacy

Refactorings

Extract method

Substitute algorithm

Move method

Extract class

13