Index
What is Context?


Context = Universe
The context is the "universe" for a given spot in the code.

The context is inside the box, not outside.
Keeps It Simple
Context keeps it simple.

We see that our context is surrounded by complexity.

Focusing on just the given context allows us to ignore the surrounding complexity simplifying things greatly.
Accessibility
The context tells us what is accessible (usable).

For this example our context includes elements A, B, C, D and E. We can access them.

The other elements are not in the context and we can not access them.

We are using arbitrary element names here (in coding these would be program elements like vars, methods, etc).


What Is Scope?


Visibility
Scope is similar to context.

Generally scope is "what is visible/usable".
Example
A, B, C, D, and E are all visible/usable components.

They are all within "scope" (inside the given context).


Context Example


Let's say we have this class:

class Person
private String firstName
private String lastName
	
public Person(String fn, String ln)
	
public String getName()
public String getName()
Now that person class is trivial right. Two ivars, one constructor, and two getter methods. If we asked "how does person work?", the answer would be you can construct it and you can get a first name and last name. Its behaviors are minimal and not even interesting. However, it may be a key player for a given software program.


We could easily code "Person" and give it a little test to make sure the constructor and getters are working. While coding it, we would not need to think about the software it will live in.

Let us say that "Person" is used in five large software systems involving the stock market, delivery of commodities, air travel, etc. It would take us years to even get familiar with these large systems. However, on the contrary, all we need to do is spend an hour and code up "Person" and a test, as it is simply defined. This is the essence the "object oriented programming".