Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Topics/03. Refactoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
## When and How to Refactor? Refactoring Patterns
<!-- <img class="slide-image" showInPresentation="true" src="imgs\pic00.png" style="top:53.48%; left:67.37%; width:35.59%; z-index:-1" /> -->
<!-- <img class="slide-image" showInPresentation="true" src="imgs\pic01.png" style="top:51.23%; left:55.43%; width:16.08%; z-index:-1" /> -->
<article class="signature">
<p class="signature-course">High-Quality Code</p>
<p class="signature-initiative">Telerik Software Academy</p>
<a href="http://academy.telerik.com " class="signature-link">http://academy.telerik.com </a>
<article class="signature">
<p class="signature-course">High-Quality Code</p>
<p class="signature-initiative">Telerik Software Academy</p>
<a href="http://academy.telerik.com " class="signature-link">http://academy.telerik.com </a>
</article>


Expand Down Expand Up @@ -243,7 +243,7 @@
# Code Smells: Change Preventers
- Conditional complexity
- Cyclomatic complexity
- number of unique pathsthat the code can be evaluated
- number of unique paths that the code can be evaluated
- Symptoms: deep nesting (arrow code) & bug ifs
- Solutions: extract method, strategy pattern, state pattern, decorator
- Poorly written tests
Expand Down Expand Up @@ -303,7 +303,7 @@
<!-- # Code Smells: The Couplers -->
- Message chains
- Somemthing.another.someother.other.another
- Tight coupling between client andthe structure of the navigation
- Tight coupling between client and the structure of the navigation
- Middle man
- Sometimes delegation goes too far
- Sometimes we can remove it or inline it
Expand Down Expand Up @@ -367,7 +367,7 @@
- Move a complex boolean expression into a well-named boolean function
- Consolidate duplicated code in conditionals
- Return as soon as you know the answer instead of assigning a return value
- Use break or return instead ofa loop control variable
- Use break or return instead of a loop control variable
- Replace conditionals with polymorphism
- Use null objects instead of testing for nulls
<!-- <img class="slide-image" showInPresentation="true" src="imgs\pic18.png" style="top:40.65%; left:82.78%; width:21.63%; z-index:-1" /> -->
Expand All @@ -379,7 +379,7 @@
- Rename method
- Convert a long routine to a class
- Add / remove parameter
- Combine similar methods byparameterizing them
- Combine similar methods by parameterizing them
- Substitute a complex algorithm with simpler
- Separate methods whose behavior depends on parameters passed in (create new ones)
- Pass a whole object rather than specific fields
Expand All @@ -389,7 +389,7 @@

<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
# Class Level Refactorings
- Change structure toclass and vice versa
- Change structure to class and vice versa
- Pull members up / pushmembers down the hierarchy
- Extract specialized code into a subclass
- Combine similar code into a superclass
Expand Down Expand Up @@ -469,7 +469,7 @@


<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
<!-- # Rafactoring Patterns -->
<!-- # Refactoring Patterns -->
- Refactoring patterns
- Two classes are tightly coupled &rarr; merge them or redesign them to separate their responsibilities
- Public non-constant fields &rarr; make them private and define accessing properties
Expand Down