Can design by contract allow me to enforce private methods
Asked Answered
W

1

0

I can't do this with language How to enforce private method since interface methods are only public?

so can I use design by contract instead ?

Watson answered 23/4, 2011 at 18:45 Comment(3)
@user310291: Updated my answer in your previous questionStereotaxis
Please explain why you want to do that. I can't see no reason what so ever to do that.Supen
I already explained in previous post: it's for enforcing coding style for Internal team not external team.Watson
Y
1

If you are interested in enforcing a particular coding style, naming conventions, or things like that you are better off implementing custom rules for tools like FxCop or StyleCop. There really aren't any features in either the C# language or the .NET environment to help you enforce such things.

However, before you go to such lengths, you should really ask yourself whether the automated enforcement of such standards are sufficiently valuable to warrant the expense and difficulty of a solution. Are you dealing with a large team (dozens of developers) or a small one? Could simpler alternatives like code reviews be a sufficient means to enforce this? How will this kind of enforcement affect the over quality of the code vs. productivity/happiness of your team? What are the consequences of these standards aren't enforced?

These are important questions to consider before implementing such enforcement.

Yongyoni answered 23/4, 2011 at 20:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.