Identifying anti-patterns in C# code
I’ve often found myself telling new programmers that to build good software, you have to first build a lot of really bad software and learn from it.
While this statement is somewhat in jest, there is some truth to it: almost every developer can recognize code that’s written the wrong way and discover things that make it difficult to work with, and doing so helps you write better code the next time.
When your code is bad, there’s usually a part of you that knows it. You see little things that you don’t love: duplicated pieces of code, inconsistencies in naming or parameter ordering, passing too many parameters around, methods, or even classes that are just too big to manage effectively.
These symptoms are what we commonly refer to as code smells, and we’ll revisit them later in this section.
Beyond code smells are something called anti-patterns, which is code that significantly deviates from community...