Easy Code Refactoring Opportunities

Bert Wagner shows a few easy things you can do to clean up C# code:

1. Clean up formatting

The overall format of your code is what makes it possible to quickly navigate to areas of interest. Consistent indentation, line breaks, and patterns help programmers skim large chunks of code. Take the following sloppily formatted code for example:

Read on for the rest.  This has analogues in every language:  the goal is to create simple, concise, easily scannable, and human-readable code which also correctly solves the relevant business problem.

Related Posts

The Decorator Pattern

Nancy Jain explains the Decorator pattern: Decorator design pattern is a structural design pattern. Structural design patterns focus on Class and Object composition and decorator design pattern is about adding responsibilities to objects dynamically. Decorator design pattern gives some additional responsibility to our base class. This pattern is about creating a decorator class that can […]

Read More

Why .NET And Java Have StringBuilders

Randolph West walks us through a performance troubleshooting issue with a twist: So we branch the the code in source control, and start writing a helper class to manage the data for us closer to the application. We throw in a SqlDataAdapter, use the Fill() method to bring back all the rows from the query in one go, and then […]

Read More

Categories

March 2017
MTWTFSS
« Feb Apr »
 12345
6789101112
13141516171819
20212223242526
2728293031