Course - Refactoring in .NET applications
Description of Refactoring in .NET applications
Learning material is divided into logical parts that help students quickly and effectively learn new techniques and methods. Every lesson includes examples, realized in the C# language with full usage of its opportunities and advantages. This approach helps to see real-life examples of refactoring usage and helps in deep understanding of its main principles.
Separate attention is paid to interaction of different refactoring methods in the context of most typical problems arising on different stages of application systems development and their support.
At the end of the course you will get complex understating about refactoring and will be able to use it successfully for improving the existing code, and for development new safe systems. It will be not difficult for you to develop easily supported and extensible applications with clear logic and flexible structure.
• Ability to use the main libraries of .NET Framework.
• C# experience is desirable.
• Visual Studio 2010 experience
Who should attend
Introduction to Refactoring.
Students will learn about the idea of refactoring and the list of the most common problems that developers face. Cohesion and coupling are also considered.
The lesson deals with the issues that are common for methods design. Students will learn how to create flexible and reusable methods.
• Extract Method
• Inline Method
• Inline Temp
• Replace Temp with Query
• Introduce Explaining Variable
• Split Temporary Variable
• Remove Assignments to Parameters
• Replace Method with Method Object
• Substitute Algorithm
Moving Features between Objects.
The main attention is devoted to how define which class is the best container for a particular feature.
• Move Method
• Move Field
• Extract Class
• Inline Class
• Hide Delegate
• Remove Middle Man
• Introduce Foreign Method
• Introduce Local Extension
Refactoring tools that deal with encapsulation, data duplication, unidirectional and bidirectional associations are considered.
• Self encapsulate Field
• Replace Data Value with Object
• Change Value to Reference
• Change Reference to Value
• Replace Array with Object
• Duplicate Observed Data
• Change Unidirectional Association to Bidirectional
• Change Bidirectional Association to Unidirectional
• Replace Magic Number with Symbolic Constant
• Encapsulate Field
• Encapsulate Collection
• Replace Record with Data Class
• Replace Type Code with Class
• Replace Type Code with Subclasses
• Replace Type Code with State/Strategy
• Replace Subclass with Fields
Simplifying Conditional Expressions.
The conditional expressions within the project tend to get more and more complex as the size of the project increases. That’s why we consider how to separate conditionals from direct execution.
• Decompose Conditional
• Consolidate Conditional Expression
• Consolidate Duplicate Conditional Fragments
• Remove Control Flag
• Replace Nested Conditional with Guard Clauses
• Replace Conditional with Polymorphism
• Introduce Null Object
• Introduce Assertion
Making Method Calls Simpler.
The lesson is about designing clear and easy to use interfaces.
• Rename Method
• Add Parameter
• Remove Parameter
• Separate Query from Modifier
• Parameterize Method
• Replace Parameter with Explicit Methods
• Preserve Whole Object
• Replace Parameter with Method
• Introduce Parameter Object
• Remove Setting Method
• Hide Method
• Replace Constructor with Factory Method
• Encapsulate Downcast
• Replace Error Code with Exception
• Replace Exception with Test
Dealing with Generalization.
The separate refactoring tools that deal with inheritance are considered.
• Pull Up Field
• Pull Up Method
• Pull Up Constructor Body
• Push Down Method
• Push Down Field
• Extract Subclass
• Extract Superclass
• Extract Interface
• Collapse Hierarchy
• Form Template Method
• Replace Inheritance with Delegation
• Replace Delegation with Inheritance
The general conclusion of the course that shows, how to use all the refactoring tools within a huge project.
• Tease Apart Inheritance
• Convert Procedural Design to Objects
• Separate Domain from Presentation
• Extract Hierarchy
Completing this course, you will be able to:
• Create object-oriented and easily extensible applications using refactoring;
• Use different approaches to improve structural integrity and productive capacity of existing programs;
• Improve project step by step and also prevent “breakup” of poorly designed program;
• Quickly analyze code to improve it;
• Immediately find problems in code and effectively correct them;
• Modify code step by step implementing slight changes;
• Use gained knowledge in real projects.