Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This question already has an answer here:

I designed an application framework by considering the SOLID design principles and supported by design patterns. However, I wonder if there are any automated tools or well-known approaches to evaluate whether the SOLID design principles are satisfied or violated in the proposed design?

share|improve this question

marked as duplicate by gnat, Kilian Foth, Joris Timmermans, Jalayn, Frank Shearar May 3 '13 at 21:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
By definition that is impossible, since one of the principles of SOLID design is to have one purpose for each class. How would you go about determining how many purposes a class has? Perhaps you could make some sort of conclusions about the other principles, but definitely not all are possible. –  Neil May 2 '13 at 13:44
1  
In the future, please do not cross-post questions between Stack Exchange sites. This question belongs on Programmers, where it is on-topic. If you ask a question on the wrong site, flag it for moderator review and request a migration. –  Thomas Owens May 2 '13 at 17:15
    

2 Answers 2

At least the S, O, and L in SOLID stand for semantic principles - one has to understand what the code does and what its purpose is to validate those things. I am pretty sure A.I. research has not gotten so far (at least, not yet) to make a computer really understand the meaning of programs. So don't expect anything automatic nowadays.

But you have also asked for "well-known approaches" - well, there is one very well-known approach, it is called "code review by an expert" and I am pretty sure you have heard of it ;-) So the best suggestion I can give you is to post some parts of your code at http://codereview.stackexchange.com/ and discuss it there.

share|improve this answer
    
+1, that they're semantic principles is the root of the problem here, well said. –  Jimmy Hoffa May 2 '13 at 15:47

Even if it were possible, I think the effort might be wasted. What you can do is measure the impact of adherence to the principles has on the maintainability of your code. Coupling, cohesion, and cyclomatic complexity can all be measured by static analysis tools.

Also, if you're using .NET, you might be able to leverage StyleCop to create rules for adherence to certain guidelines. Again that might be more effort than it's worth. Either way, it can't hurt to use it.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.