I was looking through some Objective C docs.. and got this :

UIGraphicsBeginImageContext : Creates a bitmap-based graphics context and makes it the current context.

Also, the same term is used in Robotlegs :

(http://www.adobe.com/devnet/actionscript/articles/intro-robotlegs-pt1.html) Context: Context is the bootstrapping mechanism that initializes dependency injection and the various core utilities that Robotlegs uses.

Dictionary meaning of context as i googled, doesnot seem to match the way it's used in programming :

con·text /ˈkäntekst/ Noun The circumstances that form the setting for an event, statement, or idea, and in terms of which it can be fully understood and assessed.

The parts of something written or spoken that immediately precede and follow a word or passage and clarify its meaning.

Anybody can throw some light pls!



The circumstances that form the setting for an event, statement, or idea, and in terms of which it can be fully understood and assessed.

That's really not too far from the programming sense of the word. Context generally has to do with some kind of state that's necessary to perform an operation.

A graphics context is typically an object or structure that contains all the information needed to draw in a particular place. Graphics contexts are often maintained in a stack, and any drawing operations happen using the information in the context at the top of the stack. A graphics context could contain information like the buffer in which to draw, current pen size, drawing color, background color, transformation matrix, pen location, and so on.

Similarly, you could have a database context, a file context, an audio context... none of these things are specifically defined outside the scope of a given API, but they all mean the same thing -- the set of conditions needed to properly carry out operations in the system in question.

  • So, whatever information ( objects, instances ) already available when i start programming, are context objects/instances ? – Vishwas G Apr 29 '13 at 6:19
  • 4
    I suppose you could say that. The word often implies a single object or structure containing all the necessary state, or at least refers collectively to all the necessary state. For example, when a context switch happens in a multithreaded system, one thread's context (the collection of stack, registers, etc.) is replaced with that of another so that the new thread can start running from where it last stopped. So, whatever's available when your program starts is part of that process's context, but you probably wouldn't refer to them as "context objects". – Caleb Apr 29 '13 at 6:34

protected by gnat Aug 14 '18 at 7:52

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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