Tag Archives: coding practice

Coding Practice: LINQ Complexity

Coding Practice: Which has higher cyclomatic complexity, a one line LINQ query or 20 lines of code? Well, it depends.  Take the single line of code below as an example: This one line LINQ query has a cyclomatic complexity of … Continue reading

Posted in Software Architecture | Tagged , | Leave a comment

Coding Practice: YAGNI

Coding   Practice: What is the minimum code needed to do a task? There is this concept of calling YAGNI (You Aren’t Gonna Need It) on a chunk of code that you have written to do something above and beyond … Continue reading

Posted in Software Architecture | Tagged , | Leave a comment

Coding Practice: Dependency Injection

Coding Practice: Why is using “new” a bad thing? The usage of “new” in a class can be an indicator of tight coupling, which can lead to code that is difficult to test and easily broken by change. Consider how … Continue reading

Posted in Software Architecture | Tagged , | Leave a comment

Coding Practice: Feature Envy

Coding   Practice: What is feature envy? A method in Class A seems way   too interested in the workings and data fields of Class B. The feature envy   from Class A to Class B is an indication of … Continue reading

Posted in Software Architecture | Tagged , , | Leave a comment

Coding Practice: Commenting Out Code

Coding Practice: When should I check in commented code? Code that is commented out should not be checked into TFS. Quote: “When you see commented-out code, delete it! Don’t worry; the source code control system still remembers it. If anyone really … Continue reading

Posted in Software Architecture | Tagged , | Leave a comment

Coding Practice: Commenting Code

Coding Practice: What is the appropriate amount of comments for my code? Comments are usually an indication that the intent of your method or class is not clear.  In general you should strive for no comments. Quote: “Comments are indicative … Continue reading

Posted in Software Architecture | Tagged , | Leave a comment

Coding Practice: Cut and Paste Code

Coding Practice: When is it okay to cut and paste code? The presence of code that is cut and pasted is a good indication that functionality can be extracted to a common library, class, or method.  It is also a … Continue reading

Posted in Software Architecture | Tagged , | Leave a comment