What does 'fidelity' of accessor keywords mean?

青春壹個敷衍的年華 提交于 2019-12-10 14:10:21

问题


I'm reading through .Net Docs and i came across this term "fidelity",

Type safety is also used to help enforce encapsulation by guaranteeing the fidelity of the accessor keywords.

What does it mean (in relation to accessor keywords)?


回答1:


Sigh.

There is simply too much documentation and not enough time for the development team to review it for accuracy in jargon. This overview is a mess of small errors and confusing, non-standard jargon usages.

The paragraph in question is:

Type safety is also used to help enforce encapsulation by guaranteeing the fidelity of the accessor keywords. Accessor keywords are artifacts which control access to members of a given type by other code. These are usually used for various kinds of data within a type that are used to manage its behavior.

Yuck. So much wrong here. "accessor keyword" should be "accessibility level". "Other code" is confusing; "other code" means code which is other than what exactly? Accessibility modifiers control access to members everywhere, not just in "other code". Why are we talking about members and then suddenly switching to data? What does "manage behaviour" mean?

Let's rephrase using standard C# jargon.

Static type checking helps enforce encapsulation by ensuring that a program respects the accessibility levels declared by a member of a type. For example, if type Dog has a private member mother, then static type checking helps ensure that attempts to access that member from code outside the Dog class will be prevented.

Fixing all the rest of the crazy mistakes in this document is left as an exercise to the reader. For example, what's wrong with this code sample?

Dog dog = AnimalShelter.AdoptDog(); // Returns a Dog type.
Pet pet = (Pet)dog; // Dog derives from Pet.
pet.ActCute();
Car car = (Car)dog; // Will throw - no relationship between Car and Dog.
object temp = (object)dog; // Legal - a Dog is an object.


来源:https://stackoverflow.com/questions/57097636/what-does-fidelity-of-accessor-keywords-mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!