Calidad de Software: Programación Modular y Anti-Patrones de Proyecto
-
Day 1
: Introduction
-
Factors of software quality
-
Characteristics of OO programming
-
Introduction to the Java language
-
Day 2
: Principles
-
Notation: a bit of UML
-
Principles of class design
-
Principles of package design
-
Day 3
: Patterns
-
Design patterns
-
Parametric polymorphism
-
A tiny bit about data structures
-
Day 4
: Testing
-
Error handling
-
Agile development
-
Testing driven development
-
Day 5
: Conclusion
-
Active objects
-
Inversion of control
-
Anti-patterns
Introduction
Software Quality
-
Software quality is subjective
-
Internal factors concern the developer:
- Documentation
- Standartization
- Conciseness
- Readability
-
External factors concern the end-user:
- Correctness
- Robustness
- Extensibility
- Reusability
- Compatibility
- Efficiency
- Portability
- Easy of use
- Functionality
- Timeliness
- Safety
-
There is the ISO 9126 international standard of software quality.
Let's discuss
-
How to measure the quality of a program?
-
If necessary to prioritize the quality factors, what are going to be your
priorities?
Supplementary material
References
Characteristics of OO programming
-
Many languages are called objected oriented: Java, C++, C#, Scala, Eiffel, Ruby,
Smalltalk, Python, PHP 5.0, JavaScript, Perl, etc, etc, etc
-
Some features are common across most of these languages:
-
Objects and Classes.
-
Computation as message passing
-
Information hiding
-
Exception handling
-
Inheritance
-
Subtyping
-
Overloading
-
Dynamic Binding
-
Run-time type interrogation
-
Heavy heap usage
Let's discuss
-
Why is OO programming so popular?
Supplementary material
References
Introduction to the Java Language
-
Java is an imperative language: references, commands, iterations and side-effects
-
Virtual Machines
-
Interfaces, classes and packages
-
Fields and methods: instance and class members.
-
Variations: abstract, anonymous and nested classes.
Let's discuss
Supplementary material
References
Principles
Notation: a bit of UML
-
(Static) Use case diagrams give a high level view of the software. They are
meant to be understood by the end user.
-
(Static) Class diagrams are used to describe the static view of a computation
system.
-
(Dynamic) Collaboration diagrams describe the exchange of messages among
objects. They put emphasis on the relations between the objects.
-
(Dynamic) Sequence diagrams encode the same information as collaboration
diagrams, but they put emphasis on the order in which messages are sent.
Let's discuss
-
Are there other UML diagrams that are important?
-
When to use collaboration and sequence diagrams?
Supplementary material
References
Principles of Class Design
-
The open closed principle (OCP): A module should be open for extension
but closed for modification
-
The Liskov Substitution Principle (LSP): Subclasses should be
substitutable for their base classes
-
The Dependency Inversion Principle (DIP): Depend upon abstractions.
Do not depend upon concretions
-
The Interface Segregation Principle (ISP): Many client specific interfaces
are better than one general purpose interface
Let's discuss
-
How to set up a job interview to find out if a candidate is a good programmer?
Supplementary material
References
Principles of Package Design
-
The Release Reuse Equivalency Principle (REP): The granule of reuse
is the granule of release
-
The Common Closure Principle (CCP): Classes that change together belong
together
-
The Common Reuse Principle (CRP): Classes that aren't reused together
should not be grouped together
-
The Acyclic Dependencies Principle (ADP): The dependencies between
packages must not form cycles
-
The Stable Dependencies Principle (SDP): Depend in the direction of
stability
-
The Stable Abstractions Principle (SAP): Stable packages should be
abstract packages
Let's discuss
-
Do we start a project by designing packages, or classes?
-
Instability, according to our definition, is not bad. When should we have
instability?
Supplementary material
References
Patterns
Design Patterns
-
Design patterns are common solutions to recurring problems in software
design
-
Creational patterns: abstract factory, builder, factory method, etc.
-
Structural patterns: adapter, bridge, composite, decorator, etc.
-
Behavioral patterns: observer, mediator, chain of responsability,
template, etc.
Let's discuss
-
Are there disadvantages in the use of design patterns?
-
What is the use of visitors in the implementation of compilers?
Supplementary material
References
Parametric Polymorphism
-
A value or operation is polymorphic if it has at least two different types.
-
Polymorphism ad-hoc presents a finite number of iterations: overloading and
coercion.
-
Universal polymorphism presents an infinite number of variations: parametric
and subtyping.
-
Polymorphism parametric, in Java, is known as generics.
Not the same as C++'s templates, but similar.
Let's discuss
-
How is parametric polymorphism in other languages?
Supplementary material
References
Data Structures
-
A data-structure is a way to organize data. Examples: lists, hash tables,
trees, stacks, etc.
-
Java provide a library called Java Collections.
Let's discuss
-
Given that so many data-structures are ready for use in a language such as
Java, should their implementation be taught in the CS syllabus?
Supplementary material
References
Testing
Error Handling
-
Exceptions are abnormal situations that may happen in the program
-
Exception handling mechanisms are similar across many languages
-
In Java, exceptions can be checked or unchecked
-
Java provides a lot of syntax for exception handling:
try, catch, throws, throw,
etc
Let's discuss
-
What are the advantages and disadvantages of checked and unchecked
exceptions?
Supplementary material
References
Agile Development
-
Requirements change all the time, so it is hard to develop software
with static specification methods.
-
Agile development is marked by the constant release of software
-
Extreme programming has two canonical characteristics: pair programming and
test oriented development.
Let's discuss
-
What are the trade-offs that we face in pair programming? Is is not
contra-productive to put two programmers working on the same machine?
Supplementary material
References
Testing Driven Development
-
There are three basic ways to find bugs: formal verification, translation
validation and testing.
-
Test Driven Development is a methodology characterized by first writing
tests, and then writing the program to pass these tests.
-
For each major part in the software development cycle we have a major testing
phase.
Let's discuss
-
When to stop testing software?
Supplementary material
References
Final remarks
Active objects
-
Process is a program that has its own memory and resources
-
Threads are many instances of the same program sharing the same code
-
An active object is an object that executes in its own thread.
-
There are many concurrent hazards: deadlock, livelock, starvation, race
condition.
Let's discuss
-
What is a good notation to describe active objects?
Supplementary material
References
Inversion of Control
-
A library is a set of modules that provide functions to be called by a client.
Example: Java collections.
-
A framework is a set of modules that call methods provided by clients.
Example: Java swing.
-
Principle of Single Responsability (SRP): there should never be more than
one reason for a class to change
Let's discuss
-
Which famous frameworks and libraries do we know?
Supplementary material
References
Anti-patterns
-
An anti-pattern is a design pattern that, although may seem good at first,
compromises the quality of the software.
-
Some common characteristics: repetitive, easily documented, it can be removed
by means of well known solutions.
-
There are many types of anti-patterns: organizational, management,
analysis, project, programming, methodology, etc
Let's discuss
-
Are there any examples from real life that we could share?
Supplementary material
-
In the last class we will not have exercises. Instead, we will organize a
debate about anti-patterns. Choose your topic.
References