<p>When applying the Single Responsibility Principle and looking at a class's reason to change, how do you determine whether that reason too change is too granular, or not granular enough?</p>

[{'answer_id': 27016, 'author': 'Frank Krueger', 'author_id': 338, 'author_profile': 'https://Stackoverflow.com/users/338', 'pm_score': 2, 'selected': False, 'text': "<p>Rewrite your code in a passing style!</p>\n\n<p>Seriously, an old code base will have hundreds of errors - but that's why we have novice/intern programmers. Correcting FxCop violations is a great way to get an overview of the code base and also learn how to write conforming .NET code.</p>\n\n<p>So just bite the bullet, drink lots of caffeine, and just get through it in a couple days!</p>\n"}, {'answer_id': 29545, 'author': 'Haacked', 'author_id': 598, 'author_profile': 'https://Stackoverflow.com/users/598', 'pm_score': 5, 'selected': True, 'text': "<p>Make liberal use of [SuppressMessage] attribute to begin with. At least at the beginning. Once you get the count to 0 via the attribute, you then put in a rule that new checkins may not introduce FxCop violations. </p>\n\n<p>Visual Studio 2008 has a nice code analysis feature that allows you to ensure that code analysis runs on every build and you can treat warnings as errors. That might slow things down a bit so I recommend setting up a continuous integration server (like CruiseControl.NET) and having it run code analysis on every checkin.</p>\n\n<p>Once you get it under control and aren't introducing new violations with every checkin, start to tackle whole classes of FxCop violations at a time with the goal of removing the SuppressMessageAttributes that you used.</p>\n\n<p>The way to keep track of which ones you really want to keep is to always add a Justification value to the ones you really want to suppress.</p>\n"}, {'answer_id': 199888, 'author': 'Ben R', 'author_id': 27705, 'author_profile': 'https://Stackoverflow.com/users/27705', 'pm_score': 0, 'selected': False, 'text': '<p>NDepend <a href="http://codebetter.com/blogs/patricksmacchia/archive/2008/09/23/getting-rid-of-spaghetti-code-in-the-real-world.aspx" rel="nofollow noreferrer">looks like</a> it could do what you\'re after, but I\'m not sure if it can be integrated into a CruiseControl.Net automated build, and fail the build if the code doesn\'t meet the requirements (which is what I\'d like to happen).</p>\n\n<p>Any other ideas?</p>\n'}, {'answer_id': 378439, 'author': 'Patrick from NDepend team', 'author_id': 27194, 'author_profile': 'https://Stackoverflow.com/users/27194', 'pm_score': -1, 'selected': False, 'text': '<p>An alternative to FxCop would be to use the tool <a href="http://www.ndepend.com/" rel="nofollow noreferrer">NDepend</a>. This tool lets write <strong>Code Rules over C# LINQ Queries</strong> (what we call <a href="http://www.ndepend.com/Features.aspx#CQL" rel="nofollow noreferrer">CQLinq</a>). <em>Disclaimer: I am one of the developers of the tool</em></p>\n\n<p>More than <a href="http://www.ndepend.com/DefaultRules/webframe.html" rel="nofollow noreferrer">200 code rules</a> are proposed by default. Customizing existing rules or creating your own rules is straightforward thanks to the <em>well-known</em> C# LINQ syntax.</p>\n\n<p>To keep the number of false-positives low, CQLinq offers the unique capabilities to define what is the set <strong>JustMyCode</strong> through special code queries prefixed with <strong>notmycode</strong>. More explanations about this feature can be found <a href="http://www.ndepend.com/Doc_CQLinq_Syntax.aspx#NotMyCode" rel="nofollow noreferrer">here</a>. Here are for example two <em>notmycode</em> default queries:</p>\n\n<ul>\n<li><a href="http://www.ndepend.com/DefaultRules/webframe.html?Q_Discard_generated_and_designer_Methods_from_JustMyCode.html" rel="nofollow noreferrer">Discard generated and designer Methods from JustMyCode</a></li>\n<li><a href="http://www.ndepend.com/DefaultRules/webframe.html?Q_Discard_generated_Types_from_JustMyCode.html" rel="nofollow noreferrer">Discard generated Types from JustMyCode</a></li>\n</ul>\n\n<p>To keep the number of false-positives low, with CQLinq you can also focus rules result only on code added or code refactored, since a <a href="http://www.ndepend.com/Doc_CI_Diff.aspx" rel="nofollow noreferrer">defined baseline in the past</a>. See the following rule, that detect methods too complex added or refactored since the baseline:</p>\n\n<pre><code>warnif count &gt; 0 \nfrom m in Methods\nwhere m.CyclomaticComplexity &gt; 20 &amp;&amp;\n      m.WasAdded() || m.CodeWasChanged()\nselect new { m, m.CyclomaticComplexity }\n</code></pre>\n\n<p>Finally, notice that with NDepend code rules can be verified <a href="http://www.ndepend.com/Doc_VS_CQL.aspx" rel="nofollow noreferrer">live in Visual Studio</a> and at build process time, in a <a href="http://www.ndepend.com/Doc_CI_Report.aspx#CQLRule" rel="nofollow noreferrer">generated HTML+javascript report</a>.</p>\n'}]
['https://Stackoverflow.com/questions/27018', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2822/']