Commit 9911a070 authored by Gerson Sunyé's avatar Gerson Sunyé

Slides improvements

- Presentations:
  - Refactorings
  - Software Testing
parent 6903c703
......@@ -35,8 +35,8 @@ Icons made by http://www.freepik.com[Freepik] from http://www.flaticon.com[Flati
* link:build.html[Build Automation]
* link:patterns.html[Design Patterns]
* link:refactorings.html[Refactorings]
* link:test.html[Software Testing]
* link:evolution.html[Software Evolution]
* link:test.html[Test Automation]
* link:agile.html[Agile Software Development]
* link:ci.html[Continuous Integration]
......
......@@ -226,17 +226,14 @@ image::tcp-ip.png[align=center]
[source,java]
----
TCP/IP::send(s : Stream) {
if state = ‘opened’
{
(…)
if state = ‘opened’ {
// (…)
}
if state = ‘closed’
{
(…)
if state = ‘closed’ {
// (…)
}
if state = ‘idle’
{
(…)
if state = ‘idle’ {
// (…)
}
}
----
......@@ -371,23 +368,26 @@ image::pattern-state-collaboration.png[align=center]
.UML Class Diagram
image::pattern-state-collaboration-use.png[align=center]
== Forces (1/2)
== Forces
. State-specific behavior is isolated, increasing maintainability.
. Replacing a conditional by a delegation may reduce performance.
. State transition become explicit, increasing testability.
. State sub-instances may be shared by several contexts, if they do not contain properties.
* State-specific behavior is isolated, increasing *maintainability*.
* Replacing a conditional by a delegation may reduce *performance*.
* State transition become explicit, increasing *testability*.
== Forces (2/2)
== Implementation trade-offs
. Who defines the state transitions?
.Who defines the state transitions?
* *The Context*: less robust
* *The States*: the context must provide an appropriate interface and the states must know the context.
. How to create and destroy states?
.How to create and destroy states?
. When the context is created.
. Later (lazy instantiation).
. Dynamic inheritance may be used in Self
== Implementation trade-offs (Cont.)
* State sub-instances may be shared by several contexts, if they do not contain properties.
== Author and Date
......
......@@ -14,6 +14,11 @@
= Refactorings
== Preamble
.Where are we?
image::overview-refactorings.png[align=center]
== Plan
* *Introduction*
......@@ -102,11 +107,11 @@ image::evolutionary.png[align=center,width=400px]
== Software refactoring definition
____
A program transformation that preserves the visible behavior.
A program *transformation* that preserves the visible behavior.
____
____
The process of improving the design of a software source code.
The *activity* of improving the design of a software source code.
____
== Simple example
......@@ -222,6 +227,14 @@ image::complex-refactoring.png[align=center]
* Since refactoring operations are behavior-preserving, they can be composed and still preserve behavior.
* Learning refactoring operations is similar to learning simple arithmetics.
== Operation preconditions
* Each refactoring operation has a set of *preconditions*
* That is, the conditions that one should respect to perform the transformation
.For instance:
* The precondition to the operation *remove attribute* is that the attribute is not used.
== Basic operations
* Add entity
......@@ -349,7 +362,7 @@ image::move-property.png[align=center,width=500px]
== When to Refactor
.Strategies during construction:
.Strategies during software evolution:
. Extend and then refactor
. Refactor to extend
. Debug and then refactor
......@@ -454,7 +467,7 @@ public class Client {
[.block]
Suppose that we want to print in HTML, XML, Framemaker, etc.
Suppose that we want to print in HTML, XML, JSON, etc.
== Steps
......@@ -554,6 +567,9 @@ Bloaters are code, methods and classes that have increased to such gargantuan pr
* The method is the smallest unit of overriding
* No metric will always be correct
* Statements within a method should be at the same level of abstraction
* Example: method https://github.com/eclipse/emf/blob/master/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/util/URI.java#L408[`parseIntoURI(String uri)`]: about 300 lines.
== Long method: Fix
......@@ -570,7 +586,7 @@ Bloaters are code, methods and classes that have increased to such gargantuan pr
* Look for disparate sets of methods and instance variables
.Example:
* class `org.eclipse.emf.common.util.URI`
* class https://github.com/eclipse/emf/blob/master/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/util/URI.java[`org.eclipse.emf.common.util.URI`]
* Non-Commenting Source Statements: 2,034
* Methods: 115
* Inner classes: 5
......@@ -688,6 +704,7 @@ A dispensable is something pointless and unneeded whose absence would make the c
* Aka, Data Transfer Objects (DTO)
* Related refactoring operation: Move Method
== Data class (example)
[source,java]
----
package fr.unantes.test.badcode;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment