我已经编程好几个月了,在课堂上经常使用的一个词是“上下文”。比如ServletContext (Java), Activity (Android), Service (Java, Android), NSManagedContext (Objective-C, iOS)。
通过查字典,我知道这个词的意思是:处境,环境,情况等。然而,因为我的母语不是英语,我不知道我应该直接翻译成什么。例如,如果我要编写一个命名为SomeClassContext的类,或者一个具有上下文参数的方法,我就不知道什么时候应该将其命名为context,因为我不理解它。
我一直在Stack Overflow上搜索上下文,但没有问题/答案能够帮助我。
如果有人能给我解释一下,我将非常高兴。
作者常常假定读者对“上下文”这个词所处的语境有详细的了解。
如何在下面的句子“the ?”运行时创建一个上下文,其中可以存储可能的注入值。这个上下文可以被修改,例如,应用程序和框架可以向上下文添加元素。
It would seem the author is using context to mean some kind of container, perhaps a heap, that holds the context of something. It has become buzz word that is taking on many meaning and confusing things. Is it the elements that are the context and are being stored in a context. To reduce the confusion of the context that the word context is being used it could be said that "the runtime creates a container to store the context in the form of elements." Better yet "the runtime creates a container to store the state in the form of elements and this container with it's state is called the CONTEXT."