Mapa mental
TDD
Contenido del mapa
TDD
Definition: TDD is a software development where test is written before the class to be tested is written.
Why do TDD? TDD imposes discipline is a developer, provides incremental specifications, helps avoid regression and allows for change with confidence.
TDD Cycle at the Unit Testing level: Step 1: Write test code. 2: Run test code to make it fail. 3. Write Class code. 4. Run tests. 5. Tests now pass. 6. Refactor to make it better. 7. Run tests
- step 6. Refactoring:
- Definition: Small independent techniques to apply transformations to a program with the goal of improving design without changing functionality
- Why refactor? To improve design, handle requirements change or to handle sloppiness by developers such copy and pasting of new methods.
- Code Smells: A surface indication that usually corresponds to a deeper problem in system. Code smells are identified during refactoring. Code Smells also help us find problems which leads to more refactoring.
- Where do they come from? From a rused design and disregard for technical debt - the amount of work you create when you try to save time.
- Groups of Code smells
- Change Preventers: smells that hinder changing or further developing the software. Solutions include extracting class/methods or moving them.
- Dispensables: represent something unnecessary that should be removed. Problems include: a lazy class, a data class or duplicated code. Solutions include: inline class, moving/extracting methods.
- Couplers: represent something unnecessary that should be removed. Smells include feature envy, inappropriate intimacy, middle man. Treatments to such smells include: move method/field, bidirectional to unidirectional association, inline Class
- Bloaters: Something has grown large it cannot be effectively handled. Examples are Long method, large class, long parameter list or data clumbs. Treatment: Extract method or class, replace parameter with method call or object or preserve whole object.
- Object- Orientation Abusers: Cases where solution does not fully exploit the possibilities of object oriented design: Smells are switch statements and refused bequest. Solutions include: Use of polymorphism, push down method and eliminating inheritance.
- Code Smells: A surface indication that usually corresponds to a deeper problem in system. Code smells are identified during refactoring. Code Smells also help us find problems which leads to more refactoring.
- Types of refactoring: Collapsing hierarchy, consolidate conditional, decompose conditional, extract a class or a method etc
- To refactor or Not: Refactor when you have to add a feature, during code review or when fixing a bug. Do not refactor when code is broken, a deadline is close or when there is no need to refactor.
- Tools: ReSharper, Jetbrains Rider, IntelliJ IDEA, Stepsize
- step 6. Refactoring:
Stages. TDD can be applied at different stages. Developer and Alpha which are within the organization. Beta and Product release stages of testing which are outside the organization.
Testing techniques: Opaque box testing technique where the tester does not have internal knowledge product while clear box testing technique the tester is aware of the internal structure and working of the product
Información
- Descripción
- Mapa Mental sobre TDD, creado por fardowsa farah el 02/08/2024.
- Creado por
- fardowsa farah
- Visitas
- 2
- Valoración