Professional Documents
Culture Documents
Module Overview
Debugging and Refactoring Code Unit Testing Code
What is Refactoring?
Extract Method Refactoring Demonstration: Extract Method Refactoring
Overview of Debugging
Debugging is the process of observing the run-time behavior of
Break, or suspend, the execution of your application, and subsequently examine the code Evaluate and edit variables in your application
View registers
See the instructions created from your source code View the memory space used by your application
Breakpoint enhancements
What is Refactoring?
Refactoring is the process of changing code to improve its
Encapsulate Field
Extract Interface Remove Parameters Reorder Parameters
member
Benefits
Encourages best coding practices by emphasizing discrete, reusable methods. Encourages self-documenting code through good organization.
When descriptive names are used, high-level methods can read more like a series of comments.
Encourages the creation of finer-grained methods to simplify overriding. Reduces code duplication.
that field and can modify it, undetected by the object that owns that field.
original class
Using the Extract Interface dialog box, you can specify the
members to extract into the new interface, the name of the new interface, and the name of the generated file
Add validation
Modify property
Create unit test Run test
file
[Visual C#] protected void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs }
[Visual Basic] Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Fires when an error occurs End Sub
traditional development
reduce the time taken to retest the existing functionality for each new build of the system. you must perform to resolve the problem. You also have a clear measure of success when the test no longer fails. This increases your confidence that the system actually meets the customer requirements.
When a test fails, you have a clear idea of the tasks that
Exercise 3: Logging
Exercise 4: Creating Unit Tests Exercise 5: Implementing the Test-First/Test-Driven
Development Methodology
Logon information
Lab Scenario
Lab Review
Why was the generic error handler implemented in the
Global.asax file?
Where is a custom error page configured? What are the advantages and disadvantages of using the