c# - How to distinguish 'Role' interfaces from 'Result' interfaces? -
This issue often comes to me in my coding that I am surprised that I can get very little references to it, and The value of ideas and ideas of other people will be worth it.
I define several APIs, which I work for frameworks, and the APIs that I want to break within the larger domain model, almost completely interfaces (meaning, in my case, C #interface) included. I think that we want to differentiate between the interfaces twice, again and again. In the absence of the search for any more widely used words, I define these two as follows:
-
The purpose of the 'role' interface is by the objects outside the API To implement, so that those objects can be used as logic for methods defined in the API
-
'Results' are implemented by the objects inside the interface API And APIs Make available in other parts of the system. Object is intended to define the result interface instead of restricting the outside world to the object to eject it.
For them. Those generated payment objects can be recovered through the API, but the results can be defined by the interface IPMant. -
My results are abstract classes rather than interface interfaces should be there. This does not solve the problem, and potentially makes it even worse, because the external code can sub-class them.
-
I should return the concrete type and make sure that whatever I do not want to be accessible outside of the API is marked 'internal' There are many cases where I have an API There is a need for public, eg. Be accessible to other frameworks (not going through the API).
The only way I can distinguish them at present is by naming conferences and / or commenting Ideally, I want to like the difference applied by language, and have applied the rule: You can not apply a result interface outside the API, only use it but C # provides no such mechanism (Can someone give me advice about that language?) I have a feature I can define, but it still will not apply anything.
There is another important significance in the semantic version of the API. If I add a new member to a role interface then it should be seen as a breakable change (and therefore a first-level version) - because any existing external implementation has to be added to that member. But if I consider a member to be a 'result' interface, then it should only be my own code that is affected - this is just a new feature (second level version) for everyone but there is no difference between the two types It can not be that people are implementing risk interfaces and therefore their code will be broken.
Has anyone else had to face this dilemma? If so, how have you disposed of it? I look forward to your reply.
But please do not do both to answer with the following arguments (which I have heard many times):
I think what you are asking is an interface It is possible to disclose, but decide that you have made a given example?
If so, you can also create an internal personal interface, and you can mark all your implementations and apply the personal interface. After this, something is being given from the outer world, verify that there is an internal interface implementation too.
Public Interface IP Local {...} Internal Interface ISCate {} Public Sector Public Implementation: ISERCricket {...}
Only you to ISERTT Can apply, so even if a person applies the Lokpal and passes it to you, it will fail in the ISERTT examination.
Comments
Post a Comment