Violating Single Resposibility Principle using VisualStudio Region
Single Responsibility Principle (SRP)says that "THERE SHOULD NEVER BE MORE THAN ONE REASON FOR A CLASS TO CHANGE.". Although this article mentions only about class, I think the SRP also applies to methods within the class: there should never be more than one reason for a method to change. Visual Studio provides a good way to mark off section of file in the form of "region"so they can be collapsible and the code can be organized. Many people use region in a big method to organize the code. For example: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 public void CreeateOrder( /*some parameters*/ ) { #region Validate the parameters //code goes here #endregion #region create the order //insert the order data in the database #endregion #region create the order item...