Beruflich Dokumente
Kultur Dokumente
2007/07/04 (08.30-11.30)
2007/07/05 (10.00-13.00)
2007/07/11 (08.30-11.30)
2007/07/12 (10.00-13.00)
contact:
Institut für Maschinelle Sprachverarbeitung
Azenbergstr. 12
Martin Barbisch (room 3.5):
martin.barbisch@ims.uni-stuttgart.de
Ursula Vollmer (room 3.3):
ursula.vollmer@ims.uni-stuttgart.de
Style Guides
DRY Principle / Reuse
Orthogonality
Automation
Refactoring
Programming Languages
Editors
Version Control Systems
Object
Class
Inheritance
Example: Birds
Example: Birds
attributes:
feet = two
beak
plumes
methods:
walk
eat
Example: Birds
Example: Birds
subclass songbirds:
new attributes:
wings
tail
new methods:
sing
fly
subclass flightless birds:
new methods:
look in a daft manner
Example: Birds
Example: Birds
subclass tits:
new attributes:
beak = small
new methods:
clamber
subclass finches:
new attributes:
beak = big
tail = notched
Example: Birds
Example: Birds
Polymorphy
Encapsulation
Process Models
Core Processes
1 planning
2 analysis
3 design
4 programming
5 validation & verification
Planning
requirements specification
target specification
work estimation
process model
Analysis
requirements analysis
data analysis: conditioning / evaluation of collected data
process analysis / process model
system analysis: black box model (current / target state) as
data flow diagram:
processing and storage of data flow
state transition diagram:
temporal behavior
entity relationship diagram:
data linkage
Design
software architecture:
structured or hierarchical arrangement of the components
description of relations between components
structured design:
structure diagrams
interface description
invocation hierarchies of the modules
Unified Modeling Language (UML)
Support Processes
quality management:
e.g.: software ergonomy
configuration management:
version control
release management
application management (user support and further
development)
Support Processes
documentation:
software documentation tool
system documentation (further development and error
removal)
operating manual (operator / service)
user manual (user)
process documentation (description of legally relevant software
processes)
Definition
A design pattern is a solution for a problem within a specific
context.
Further Reading
Phase Models
Milestone (Definition)
Requirements have to be
describable
as stable as possible
easy integration, as
requirements are determined as completely as possible
requirements are documented
design is evolved on base of requirements
no extensive version and configuration management necessary
work estimation:
very difficult (deadline)
to omit sub-functions does not effect much
integration test difficult
Waterfall Models
Waterfall Models
Waterfall Models
Waterfall Models
Waterfall Models
Waterfall Models
controlled iterations:
anew execution of finished development activities under certain
circumstances (e.g.: removal of an error, ...)
Requirements have to be
describable
as stable as possible
easy integration, as
requirements are determined as completely as possible
requirements are documented
design is evolved on base of requirements
no extensive version and configuration management necessary
work estimation:
very difficult (deadline)
to omit sub-functions does not effect much
integration test difficult
easy integration, as
requirements are determined as completely as possible
requirements are documented
design is evolved on base of requirements
implementation of requested non-functional requirements
(design prototypes)
no extensive version and configuration management necessary
reduction of aberration risk (check of critical areas with
customer)
identification of system parts, that may be omitted in case of
time pressure (prototypes)
work estimation:
very difficult (deadline)
to omit sub-functions does not effect much
integration test difficult
risks:
determination of requirements not correct
→ slowing down of development process
documentation of requirements not neatly done
→ slowing down of development process
misjudgement of a executable prototype as final version by
customer / user
Classification
Summary - Application
advantages disadvantages
phase easy integration difficult work estimation
models easy version / config. managem. subfunctions planned
difficult integration test
waterfall easy integration difficult work estimation
models easy version / config. managem. subfunctions planned
difficult integration test
prototyp. easy integration difficult work estimation
models non-functional requirements subfunctions planned
easy version / config. managem. difficult integration test
aberration unlikely risk: determination of requirements
omittance of system parts risk: prototype as final version
it.-incr. delivery deadline kept extensive version and config. managem.
models easy integration test difficult increment integration
Conclusion
Further Reading
advantages:
short development cycles
precise prediction possibilities
simple and efficient implementations
disadvantages:
ideal team size: 12-14 persons
→ not applicable for major projects
disciplined working method necessary
Further Reading
diagram types:
use case diagram
class diagram
behavior diagram:
activity diagram
collaboration diagram
sequence diagram
state diagram
implementation diagram:
component diagram
deployment diagram
component diagram:
relationship of components
among each other
component:
software
own identity
defined interfaces
deployment diagram:
configuration of nodes (processes,
computer)
→ assignment of components and
objects to nodes
communication relations at nodes
Further Reading
Programming Style
Bad Style
Good Style
Well written programs are better than badly written ones, because:
easier to read
more intelligible
contain less errors
easier to debug
easier to modify
Requires discipline.
Compilers have no problems with badly written code, but humans
do...
Good Style
The principles of a programming style are based upon common
sense and programming experience.
Code should be clear and simple:
straightforward logic
natural expressions
conventional language usage (stick to the proven)
meaningful names
neat formatting / layout
useful comments
Consistency
Names
A name
describes a certain object (or function)
conveys information about its purpose
should be informative, short, catchy and pronounceable
the bigger the scope, the more information the name should
convey
Descriptive names for global variables, and short names for local
variables.
Names - Variables
Local variables:
should be short
i, j for loop variables
p, q for pointers (nodep)
s, t for strings
n: amount, nPoints (numberOfPoints is exaggerated)
Names - Variables
1 for ( theElementIndex = 0;
2 theElementIndex < numberOfElements ;
3 theElementIndex ++)
4 elementArray [ theElementIndex ] =
theElementIndex ;
Better:
1 for ( i = 0; i < nElems ; i ++)
2 elem [ i ] = i ;
Names - Variables
Global variables:
often begin with capital letters or ’ ’
usually have longer (self-explanatory) names
(PointsOfInterest, RemoteAccessPoints)
Constants:
often with capital letters (MAX SIZE)
Names - Functions
100 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
101 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
102 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
103 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
104 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
105 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
106 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
107 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
108 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
109 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
1 if ( month == FEB )
2 {
3 if ( year %4 == 0)
4 if ( day > 29)
5 legal = false ;
6 else
7 if ( day > 28)
8 legal = false ;
9 }
The indentations here are misleading! (else)
(Hint: Also enclose single lines with curly brackets.)
110 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
111 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Common form:
1 for ( int i = 0; i < n ; i ++)
2 array [ i ] = 1.0;
n elements visited
in ascending order
whole control of the loop is within the for-expression
++-operator is used to increment
112 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
113 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Function Macros
avoid them
#define simply is a textual substitution
changes the lexical structure of a program in the background
use inline functions in C++
A parameter, which appears more than once in the definition of the
macro will be evaluated more than once.
115 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Function Macros
116 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Magic Numbers
117 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
119 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
1 // generate histogram
2 for ( i = 0 , i <= NLET ; i ++) {
3 if ( let [ i ] == 0)
4 continue ;
5 for ( j = HEIGHT - let [ i ] / fac ; j < HEIGHT ; j ++)
6 draw ( j + 1 + LABELROW , ( i + 1) * WIDTH , ’* ’
);
7 }
8 // draw x-axis
9 draw ( MAXROW - 1 , MINCOL + 1 , ’ ’) ;
10 for ( i = ’A ’; i <= ’Z ’; i ++)
11 printf ( " % c " , i ) ;
120 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Magic Numbers
121 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Comments
122 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Comments
123 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
124 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Comments
125 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Comments
126 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Summary 1/2
Programming style
descriptive names
clearness in expressions
straightforward control flows
readability of code and comments
consistent adherence to conventions and idioms
127 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Summary 2/2
128 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Miscellaneous
129 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
Further Reading
130 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Consistency and Programming Style
Names
Object Oriented Programming
Expressions and Statements
Process Models
Function Macros
Unified Modeling Language
Magic Numbers
Consistency
Comments
Summary
131 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle / Reuse
Orthogonality
Automation
Refactoring
Style Guides
132 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle / Reuse
Orthogonality
Automation
Refactoring
Motivation
133 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle / Reuse
Orthogonality
Automation
Refactoring
Content
134 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle / Reuse
Orthogonality
Automation
Refactoring
Naming
135 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle / Reuse
Orthogonality
Automation
Refactoring
Formatting
indent
associated terms
parenthesizing for blocks
controlled data flow:
empty blocks
blocks with only one line
136 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle / Reuse
Orthogonality
Automation
Refactoring
Terms
137 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle / Reuse
Orthogonality
Automation
Refactoring
Conclusion
It is important, that
1 there is a style guide
2 the whole team keeps with the style guide
3 the style guide is comprehensible
4 the style guide covers as many aspects as possible
5 exceptions are possible, but do not become the rule
138 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle / Reuse
Orthogonality
Automation
Refactoring
Examples
139 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle / Reuse
Orthogonality
Automation
Refactoring
140 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
DRY Principle
141 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
142 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
DRY Principle
143 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
144 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
145 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
Possible solutions:
filters or source code generators, which refer to the same meta
data
generate source code files, which declare structures, for several
languages
generate class declarations from database descriptions
insert source code via the include directive
146 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
147 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
Better:
1 // check whether we have a valid country
2 if (( country == " Austria " ) ||
3 ( country == " Switzerland " ) ||
4 ( country == " France " ) )
5 {}
148 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
1 // stack . cpp
2 int IntStack :: pop ()
3 {
4 }
150 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
Unintended Repetition
Mistakes in design:
1 class Van 1 class Tour
2 { 2 {
3 string model ; 3 string from ;
4 string licencePlate ; 4 string to ;
5 string driver ; 5 string driver ;
6 }; 6 };
When the van is sent on tour, the driver appears twice.
151 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
Unintended Repetition
1 class Line {
2 public :
3 Point start ;
4 Point end ;
5 double length ;
6 };
If either ’start’ or ’end’ is modified, length has to be recalculated,
too.
(Side note: Variables should never be public. Getter and setter
methods should be used instead.)
152 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
Unintended Repetition
Calculation instead of storing:
1 class Line {
2 public :
3 Point start ;
4 Point end ;
5 double length () {
6 return start . distanceTo ( end ) ;
7 }
8 };
Access:
1 double len = line . length ; // bad
2 double len = line . length () ; // good
153 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
Unintended Repetition
If the calculation is time consuming you can cache the result.
1 class Line {
2 public :
3 Point getEnd () ;
4 void setEnd ( Point p ) {
5 end = p ;
6 upToDate = false ;
7 }
8 double length () {
9 if (! upToDate ) {
10 length = start . distanceTo ( end ) ;
11 upToDate = true ;
12 }
13 return length ;
14 }
15 };
154 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
1 const EST_String
2 fileName ( get_c_string ( car ( file ) ) ) ;
3
156 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
157 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
158 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
Backups
159 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
DRY Principle
160 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
Data Formats
162 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
Data Formats
With plain text you can achieve a self describing data stream.
163 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
Data Formats
164 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides
DRY Principle
DRY Principle / Reuse
Reasons for Repetitions
Orthogonality
Summary
Automation
Data Formats
Refactoring
Data Formats
165 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Orthogonality
166 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
What is Orthogonality?
Orthogonality is a term from geometry.
Orthogonality
168 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
What is Orthogonality?
169 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Orthogonality
170 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Orthogonality
171 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Isolated Function
172 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Increased Productivity
173 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Increased Productivity
174 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Reduced Risk
175 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Reduced Risk
176 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Project Teams
In efficient teams there are only few overlaps, since everybody has
special responsibilities.
Responsibilities require no meeting with the whole team, since not
everybody is affected.
177 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Design
Systems should be composed of a set of cooperating modules.
E.g. subdivision in tiers (every tier only accesses the tier directly
below it)
178 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Implementation
179 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Testing
180 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Summary - Orthogonality
181 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Orthogonality
DRY Principle / Reuse Increased Productivity
Orthogonality Reduced Risk
Automation Large Projects
Refactoring Summary
Further Reading
182 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Automation
Automation
184 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
build process
releasing new program versions
paperwork for source code reviews
renaming 100 files
185 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
186 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Automatic
187 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Compile projects
188 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Make
189 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Structure of Makefiles
Invocation of make:
1 make [ - f Makefile ] [ foobar ]
190 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Structure of Makefiles
1 foobar : foo . c bar . c
2 gcc foo . c bar . c -o foobar
This creates foobar completely from scratch, even if only one c-file
has been changed.
Better:
1 foobar : foo . o bar . o
2 gcc foo . o bar . o -o foobar
3
4 foo . o : foo . c
5 gcc foo . c -c
6
7 bar . o : bar . c
8 gcc bar . c -c
191 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Structure of Makefiles
Phony targets:
1 clean :
2 rm -f *. o
If there are several targets by default the first one is chosen. This
is often called ’all’, and its dependency is the main target.
1 all : foobar
192 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Structure of Makefiles
Implicit rules:
1 . cpp . o :
2 $ ( CXX ) $ ( DBG_FLAGS ) -o $@ -c $ ( CXXFLAGS ) $ <
193 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
194 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Exercise: make
A simple Makefile:
1 foobar : foo . o bar . o
2 gcc foo . o bar . o -o foobar
3
4 foo . o : foo . c
5 gcc foo . c -c
6
7 bar . o : bar . c
8 gcc bar . c -c
195 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Exercise: make
A better Makefile:
1 . PHONY : clean
2 . SUFFIXES : . cpp . o
3
4 CXX := g ++
5 DBG_FLAGS := -g
6 CXXFLAGS := $ ( DBG_FLAGS ) -I .
196 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Exercise: make
7 all : foobar
8
9 clean :
10 rm -f *. o
11
12 foobar : foo . o bar . o
13 gcc foo . o bar . o -o \ $@
14
15 . cpp . o :
16 $ ( CXX ) $ ( DBG_FLAGS ) -o $@ -c $ ( CXXFLAGS ) $ <
197 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Build Process
The build process starts with an empty directory, and builds the
project from scratch. It creates what shall be delivered at the end
(CD-ROM-Master, self extracting archive, etc.).
1 Checking the source code out from the version control system.
2 Building the project from scratch (e.g. by employing make).
Each run of the build process gets its own version number.
3 Creation of a complete version which can be distributed.
4 Executing test runs.
198 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Build Process
199 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
200 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Approval Procedures
Approval Procedures
1 // Status: needs_review
A script could search the source code hierarchy for such files and:
publish a list of these files on a web page
send an email to the responsible persons
202 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
cron
203 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
find
204 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
grep
205 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Exercise: cron
206 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Exercise: find
find in the current directory all files with the suffix cpp
find in /usr/local all files which are writeable for the user
find all directories in and below /tmp
find all empty files in and below the home directory
207 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Exercise: grep
208 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Bash
Loops:
1 for i in ‘ find . - name " *. tex " ‘; do
2 echo $i ;
3 done
209 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Bash
Renaming files:
1 for i in ‘ find . - name " *. tex " ‘; do
2 mv $i ;
3 done
Parameter expansion:
1 $ { parameter #word}
2 $ { parameter ##word}
3 $ { parameter % word }
4 $ { parameter %% word }
5 $ { parameter / pattern / string }
210 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
cms.sh
211 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
f.sh
1 #!/bin/bash
2
3 if [ $ # -eq 0 ]
4 then
5 echo " usage : $ {0} < SEARCH_PATTERN > <
FILES_TO_SEARCH > "
6 echo " e . g .: $ {0} printf \ " *. cc \ " "
7 exit 1
212 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
f.sh
8 elif [ $ # -eq 1 ]
9 then
10 SEARCH_PATTERN = $ {1}
11 FILES_TO_SEARCH = " * "
12 else
13 SEARCH_PATTERN = $ {1}
14 FILES_TO_SEARCH = $ {2}
15 fi
16
17 find . - name " $ { FILES_TO_SEARCH } " | xargs grep " $ {
SEARCH_PATTERN } "
213 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
sameRightsForGroup.sh
1 #!/bin/bash
2
3 echo " Giving the group the same rights as the owner
... "
4
5 for i in ‘ find . - perm -400 ‘; do
6 chmod g + r $i
7 done
8 for i in ‘ find . - perm -200 ‘; do
9 chmod g + w $i
10 done
11 for i in ‘ find . - perm -100 ‘; do
12 chmod g + x $i
13 done
214 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
replace.pl
1 #!/usr/bin/perl -w
2
3 if (! defined ( $ARGV [0]) && ! defined ( $ARGV [1]) && !
defined ( $ARGV [2]) )
4 {
5 print ( " usage : replace . pl < search > < replace > <
fileName >\ n \ n " ) ;
6 print ( " where < search > is the string to search
for \ n " ) ;
7 print ( " and < replace > the string to insert
instead .\ n " ) ;
8 exit (1) ;
9 }
215 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
replace.pl
216 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
replace.pl
217 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
replace.pl
34 close ( IN ) ;
35 close ( OUT ) ;
36
37 unlink ( $fileName ) ;
38 rename ( $tmpFile , $fileName ) ;
218 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
1 #!/bin/bash
2
3 for i in ‘ find . - name " *. tex " | xargs grep -l ’ \+ $
’ ‘; do
4 echo $i ;
5 replace . pl ’ +$ ’ ’’ $i ;
6 done
219 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Avoid Repetitions
If you realize that you repeat a task over and over again
(cumbersome), think about how you could automate it.
frees the programmer from routine work
220 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Automation
Style Guides
Make
DRY Principle / Reuse
Build Process
Orthogonality
Useful Programs
Automation
Scripts
Refactoring
Summary
Summary
Entropy
222 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Broken Windows
223 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Broken Windows
... and gets worse and worse. You feel more and more
uncomfortable and sometime there is no more interest in a
”renovation”.
Thus:
Do not accept broken windows.
224 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Broken Windows
225 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Broken Windows
Do not leave bad source code as it is, but fix it a soon as you
detect it.
Otherwise the following attitude could arise:
”The rest of the source code already is rubbish. I will simply
continue like this.”
In a project with cleanly written source code you will take more
care when programming. Nobody wants to be the first to do
damage.
226 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Broken Windows
227 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Summary
software decays
fix errors when you detect them
no “I will fix that later”
code which looks chaotic, often is
228 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
1 paint ( g ) ;
2 invalidate () ;
3 validate () ;
4 revalidate () ;
5 repaint () ;
6 paintImmediately ( r ) ;
Despair?
It seems to work. But why?
229 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Chance in Testing
230 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Deliberate Programming
Goal: produce source code with less effort and detect and remove
errors as soon as possible.
Always be aware of what you do.
Do not program blindfolded.
understand the program
understand technology
Follow a plan (i.e. think first).
231 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Deliberate Programming
232 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
233 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Summary
234 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Refactoring
Building a house is a common metaphor for software development:
Refactoring
236 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Refactoring - Definition
237 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
How to refactor?
238 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Simple Extension
If you want to extend a program with a new feature and this is not
easily feasible, then you should first change the code, in order to
make it easy to extend. Only then should you integrate the new
feature.
239 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Procedure
Small steps:
confidence in the code grows
less stress
240 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
When to Refactor?
241 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
”Bad Smells”
242 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Catalog
244 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
245 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
1 int getRating () {
2 return ( _ n umberOfDeliveries > 5) ? 2 : 1;
3 }
246 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
247 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
248 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
249 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
250 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
251 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
252 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
253 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
254 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Motivation:
subclasses can determine how values are calculated (by
overwriting the respective function)
”lazy initialization” (only initialize, when required)
255 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
256 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
257 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
1 double getPayAmount () {
2 if ( _isDead ) return deadAmount () ;
3 if ( _isSeparated ) return separatedAmount () ;
4 if ( _isRetired ) return retiredAmount () ;
5
6 return normalPayAmount () ;
7 }
258 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
1 get In v o i c e C r e d i t Limit ()
259 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
1 getTo ta l O ut s t an ding ()
2 setRe a d y F o r S u m m aries ()
260 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
1 raise ( percentage )
261 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
262 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
263 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
1 class Employee {
2 String name
3 };
4
5 class Salesman extends Employee { };
6
7 class Engineer extends Employee { };
264 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Summary
clean up code
revise and thereby improve the internal structure
does not change anything in the outwards visible behavior
invested time is worth it, otherwise chaos will arise
make small changes, then test
265 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
Further Reading
266 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Style Guides Broken Windows
DRY Principle / Reuse Programming with Chance
Orthogonality Refactoring
Automation Examples
Refactoring Summary
267 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Programming Languages
268 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
1 machine languages
2 assembler languages
3 higher programming languages
4 4GL languages
5 very high level languages
269 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
270 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
271 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
272 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
273 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
274 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
1 imperative / procedural
2 functional / applicative
3 logic / predicative
4 object based
5 object oriented
275 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
276 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
277 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
example: PROLOG
278 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
example: JavaScript
279 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
280 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
interpreter:
run-time analysis of source code
→ faster development cycles
→ easy testability
→ higher flexibility
compiler:
execution of a pre-analyzed file
→ higher performance rate
281 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
282 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
283 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
C++
284 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
C++
285 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Java
286 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Java
from Smalltalk:
object tree, where all objects are
hooked into and descend from one
single mother object
automatic garbage collection
virtual machine
syntax similar to C++
constructs from C++, that Java does
not have:
multiple inheritance
error-prone pointer arithmetic
overloading of operators
287 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Ada
288 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Ada
289 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
FORTRAN
John W. Backus, ... (IBM), since 1954
FORmula TRANslation
procedural, meantime also object oriented programming
language
compiler
numeric calculations
early Fortran style: goto commands
since FORTRAN 77 structured programming
since Fortran 90:
opening of the line format, originating from punchcards
optional parameters
identification of procedure parameters by name, and not only
by position in parameter list
290 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
COBOL
291 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
COBOL
292 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
BASIC
293 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
BASIC
development principles:
easy to learn for beginners
universally applicable
expandability of the language for experts
interactivity
clear error messages
short response times
hardware independence
operating system independence
platform independence not achieved
hundreds of incompatible dialects, that only have data
handling in common
294 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Perl
Larry Wall, 1987
citation from the Gospel according to Matthew
hybrid language
interpreter
tool for system and network administration
development of web applications
bioinformatics
combination of C with tools like sed, awk, grep and sort and
features of the bourne shell
fast problem solving and highest possible freedom for
programmer
strengths: dealing with texts and many free available modules
295 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
PHP
296 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Python
297 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Python
easy and clear (design goal):
mighty amount of functions in few
key words
grammatic syntax reduced and
optimized on clearness
possibility of embedding programs
written in other languages
programming for faster routines
closely to the machine
scripting language of other programs
(e.g.: OpenOffice.org, Blender,
PyMOL und Gimp)
298 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Ruby
299 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Ruby
interpreter
completely object oriented
Principle Of Least Surprise
Duck Typing: “When I see a bird that
walks like a duck and swims like a
duck and quacks like a duck, I call
that bird a duck.” (James Whitcomb
Riley)
300 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
LISP
301 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
PROLOG
302 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Smalltalk
Alan Kay, Dan Ingalls, Adele Goldberg (Xerox PARC
Forschungszentrum), 1970s
object oriented programming language
interpreter
developed for teaching
expert systems (beginning and middle of 1990s)
dynamic typing
no multiple inheritance
automatic garbage collection
influenced by Lisp and Simula
influence on development of later programming languages
(e.g.: Java, Ruby)
303 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Programming Languages Classification of Programming Languages
Editors Interpreter vs. Compiler
Version Control Systems Programming Languages
Further Reading
304 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Tools
Editor
306 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Editor
307 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Editor Functions
308 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Configurability
309 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Extensibility
Programability
311 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Productivity
Cursor movement:
Shortcuts which move the cursor in units of words, lines, block or
functions are more efficient than repeatedly pressing a key.
New file:
Editor can offer a template dependent on the file type
class and module names
author name and copyright texts
frameworks for declarations (e.g. constructor, destructor)
312 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Productivity
Automatic indentation:
After pressing Return (or even after pressing e.g. ’{’) a new line is
correctly indented.
Sorting lines:
Emacs: M-x sort-lines
313 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
314 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
jEdit
www.jedit.org (Java)
315 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Editing Modes
jEdit offers several modes for many data formats and programming
languages. A mode describes:
syntax highlighting
indentation style
soft vs. real tabs
316 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Shortcuts
Open menus:
Alt-UnderlinedLetter, then underlinedLetter
Files:
open: Ctrl-O (Select files by entering the initial letters)
save: Ctrl-S
317 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Shortcuts - Navigation
Navigation:
Goto line: Ctrl-L
Ctrl-LEFT, -RIGHT, -UP, -DOWN
go to corresponding parenthesis: Ctrl-]
select code block: Ctrl-[
previous bracket: Ctrl-E Ctrl-[
next bracket: Ctrl-E Ctrl-]
318 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Shortcuts - Editing
Editing:
undo: Ctrl-Z
copy: Ctrl-C
cut: Ctrl-X
paste: Ctrl-V
delete line: Ctrl-D
delete word behind cursor: Ctrl-DEL
delete to line end: Ctrl-Shift-DEL
delete word before cursor: Ctrl-BACKSPACE
delete to line start: Ctrl-Shift-BACKSPACE
319 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Shortcuts - Comfort
Others:
complete word: Ctrl-B
expand abbreviation: Ctrl-; (or pressing space at the end of
the abbreviation)
320 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Shortcuts - Buffers
Buffers:
previous buffer: Ctrl-PAGE UP
next buffer: Ctrl-PAGE DOWN
last buffer: Ctrl-BACK QUOTE
buffer list: Alt-BACK QUOTE
Splitting:
horizontal: Ctrl-2
vertical: Ctrl-3
Switching between text areas:
next: Alt-PAGE UP
previous: Alt-PAGE DOWN
321 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Action Bar
322 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
323 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Macros
324 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
BeanShell
325 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Temporary Storage
There is not only one storage place, but (almost) arbitrary many:
called a register
copy to register: Ctrl-R Ctrl-C key
cut from register: Ctrl-R Ctrl-X key
copy from register: Ctrl-R Ctrl-V key
register contents are stored between editing sessions
326 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Markers
327 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Folding
328 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Cool Features
329 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Plugins
330 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Plugins
331 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Eclipse
www.eclipse.org (Java)
332 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
class browser
auto-completion
compilation errors are immediately displayed
Ctrl-LMB on a function or variable name jumps to its
definition point
new variables and functions are immediately displayed in the
class browser
refactoring
mouse (tool)tips show Javadoc help or a declaration
333 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Editor
Programming Languages Editor Functions
Editors jEdit
Version Control Systems Eclipse
Summary
Summary
334 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
335 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Motivation
336 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Repository
Definition
The repository is a central place for depositing all files of a
project. It contains all information, necessary for reconstruction of
former versions of a project file.
337 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Sandbox
Definition
A sandbox serves for deposition of working copies of the file
versions from the repository on the local computer. For each
repository, there may be any number of sandboxes, e.g. for
different development levels of the same project.
338 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Actions
import of data
adding data
fetching data
committing data
editing files
removal of files
tagging files
updating of the data
339 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Import of Data
340 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Adding Data
341 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Fetching Data
342 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Committing Data
343 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Editing Files
344 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Removal of Files
345 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Tagging Files
346 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
347 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
RCS
SCCS
VSS
Rational ClearCase
CVS
SVN
348 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
RCS
349 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
SCCS
350 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
VSS
Visual SourceSafe
Microsoft
VisualBasic, C++, C
351 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Rational ClearCase
1980s
IBM
352 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
CVS
353 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Environment variables:
1 export CVS_RSH = ssh
2 export CVSROOT =: ext : user@machine :/ path / to /
cvsrepository
3 [ export CVSROOT =/ path / to / cvsrepository ]
Creating a repository:
1 mkdir ~/ cvsrepository
2 cvs -d / path / to / cvsrepository init
354 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
355 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Adding files:
1 cvs add helloUniverse . cpp
2 cvs commit helloUniverse . cpp
Commit changes:
1 cvs edit helloWorld . cpp
2 cvs commit helloWorld . cpp
Update:
1 cvs update
2 [ cvs update helloWorld . cpp ]
356 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
WinCVS
357 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Cervisia (KDE)
358 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
SVN
Subversion
development since 2000
CollabNet
replacement for CVS
conversion of a CVS repository with cvs2svn
359 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
SVN
360 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
SVN
361 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
Further Reading
362 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Technical Terms
Actions
Programming Languages
Examples
Editors
CVS
Version Control Systems
SVN
Further Reading
363 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
364 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Wizards
365 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
New Tools
366 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
367 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Special Languages
368 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Special Languages
369 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Templates
When a carpenter has to produce the same piece again and again
he creates a template.
simplifies the task
reduces the risk to make mistakes
The craftsman can concentrate on the quality.
370 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
371 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
372 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
373 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
374 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
375 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
376 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
1 { Add a product }
1 /* Add a product */
2 { to the ’on-order’ list }
2 /* to the ’on-order’ list
3 AddProductMsg = packed
*/
record
3 typedef struct {
4 id : LongInt ;
4 int id ;
5 name : array [0..29] of
5 char name [30];
char ;
6 int order_code ;
6 order_code : LongInt ;
7 } AddProductMsg ;
7 end ;
377 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
378 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Intelligent SCGs
380 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Exercise: SCGs
381 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Parsing
382 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
(f)lex
383 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Definition part
%%
Rule part
%%
User defined routines
384 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
example.lex
385 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
The input
1 abcdefghijklmnopqrstuvwxyz
386 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
bison (yacc)
387 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Definition part
%%
Rule part
%%
User defined routines
388 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Other Languages
389 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Summary
390 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Complexity
Creation / Adaption of Source Code
Special Languages
Debugging
Source Code Generators
Creation of Documentation
Parsing Files
Testing
Summary
Further Reading
391 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
The 1. Bug
392 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Debugging
“It is a painful thing to see your own problems and to realize that
only you and nobody else caused them.” (Sophokles)
393 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Psychology of Debugging
394 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
395 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Where to begin?
before you start, make sure that the source code compiles
without warnings
exact error description, gather relevant information
ask the person, who detected the mistake
artificial tests do not test the application sufficiently
check boundary cases and realistic input
make the error reproducable (with as few steps as possible)
396 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Visualize Data
397 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Tracing
398 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Rubber Ducks
Process of Elimination
usually the error lies within one’s own code and not within the
used libraries
reading the manual helps, if you think that something should
work in a specific way, but it does not
use the binary method for debugging
400 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Elements of Surprise
401 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
402 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Secured Programming
403 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Secured Programming
404 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Design by Contract
1 /**
2 * @invariant forall Node n in element() |
3 * n.prev() != null
4 * implies
5 * n.value().compareTo(n.prev().value()) > 0
6 */
7 public class dbc_list {
8 /**
9 * @pre contains(aNode) == false
10 * @post contains(aNode) == true
11 */
12 public void insertNode ( final Node aNode ) {
13 // ...
406 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
GDB
407 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
GDB
GNU debugger
console debugger for C[++] and Modula-2, Fortran, Java,
Pascal, Assembler and Ada
step (by step) through a program
displays values of variables
you can set breakpoints at arbitrary points, or when certain
conditions are met
works very well, but is rather uncomfortable
408 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
DDD
409 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
DDD
410 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Valgrind
411 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Flawfinder
412 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Strace
file accesses
network accesses
413 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
download
http://www.dwheeler.com/flawfinder/flawfinder-1.27.tar.gz
tar xvfz flawfinder-1.27.tar.gz
cd flawfinder-1.27
let flawfinder analyze the accompanying example files
414 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Summary
415 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Debugging
Creation / Adaption of Source Code Psychology of Debugging
Debugging Strategies for Debugging
Creation of Documentation Debugger
Testing Useful Programs
Summary
Further Reading
416 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
Documentation
Documentation
418 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
Documentation
419 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
Types of Documentation
420 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
421 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
422 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
423 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
Executable Documents
424 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
Technical Authors
425 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
426 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
Markup Languages
427 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
Documentation Tools
documentation within the source code (DRY)
javadoc, doxygen, DOC++
allow to browse source code (even without additional
comments)
visualization of inheritance diagrams and dependency graphs
428 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
Doxygen
429 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
Doxygen
430 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
431 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
Summary
432 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Creation / Adaption of Source Code
Documentation
Debugging
Documentation Tools
Creation of Documentation
Summary
Testing
Further Reading
433 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Testing
434 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Motivation
435 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Kinds of Tests
436 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Module Test
unit test
component test
check on correctness of software module
automated (test program)
preliminary stage to integration test
required for refactoring:
module test after each change
437 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Integration Test
438 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
System Test
439 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Acceptance Test
440 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Testable Features
functionality
installation
recommissioning
availability
441 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Functionality
specification fulfilled?
442 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Installation
installation possible?
commissioning possible?
documentation complete?
443 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Recommissioning
444 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Availability
445 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Preparation
446 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Preparation
447 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Preparation
448 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Rules
no premature stop
no special test variant of the program
no alternating between test and debugging
449 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Stop Criterions
450 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Evaluation
451 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Regression Test
change of software:
bugfix
expansion
check on spillovers by modification of already tested software
repetition of all test cases
test results identical with those of previous version (apart
from desired differences)
automated execution possible
452 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Function Test
453 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Function Coverage
454 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Input Coverage
455 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Output Coverage
456 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
457 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Example - Requirements
no description
R01 may be used for transport
R02 easy to handle
R03 has no problems with rough territory
... ...
Rnn non-polluting
458 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
461 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Exercise: Testing
462 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Exercise: Testing
463 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Structure Test
check of processes
choice of test data depending on internal structure of program
464 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Command Coverage
465 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
466 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Term Coverage
467 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Handling of Loops
avoidance of loop
one iteration
two iterations
typical number of iterations
maximum number of iterations
468 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Path Coverage
469 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
470 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Call Coverage
471 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Programmpath Coverage
472 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Summary
Testing is important!
473 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools
Motivation
Kinds of Tests
Creation / Adaption of Source Code Testable Features
Debugging Test Process
Creation of Documentation Regression Test
Testing Black Box Test
Glass Box Test
Summary
Further Reading
474 Martin Barbisch, Ursula Vollmer Efficient Programming - Methods and Tools