Jump to content
Sign in to follow this  
Unity+

What is context-oriented programming?

Recommended Posts

So, I came across a paper that talked about something called context-oriented programming. My understanding of it is the program adapts based on the environment in which it is being run in, including hardware environment and other factors that can involve sensors.

 

http://www.jot.fm/issues/issue_2008_03/article4/

 

While I feel that I have interpreted the article correctly, I feel I am missing something about it. Also, does anyone know if any languages have applied this paradigm besides what is specified in the article? I want to know about this stuff to determine if I want to apply some independent research for this kind of thing.

Share this post


Link to post
Share on other sites

This is the answer according to my understanding, you can read the paper Context-oriented Programming by Robert Hirschfeld and the others for more details. To learn more, find best online programming courses here: https://hackr.io/

Context-Oriented Programming is a programming paradigm that support the dynamic software adaptation with repsect to the execution context. Here, context is defined in a quite broad and open way: it is any computationally accessible information. However, most of the time the context is considered as the information sensed from environment by sensors (location, temperature ...) or internal changes of the system (energy consumption, bandwidth...).
One of the main concepts in COP is behavioral variations which express partial definitions of the basic behavior of the systems (and thus they can replace or modify (a portion of) the behavior of application logic). We can see them ass chunks of code which will be activated at runtime in order to reflect the context changes.
Behavioral variations are often crosscutting concerns which scatter over the code base (to some extend, this concept is similar to aspects in aspect-oriented programming - AOP). COP copes with this by providing layer for grouping related behavioural variations and thus "modularize" them, which make the development and maintain phases easier. Two main strategies for modularization are: layer -in -class and class-in-layer.

From layer-in-class view point, COP modularisation is different from AOP one because AOP aim at modularize textually crosscutting concerns in a form of aspects while in COP the layer-in-class notion denotes that it could scatter layer-specific definitions in the classes to which they belong.

Edited by NIhar

Share this post


Link to post
Share on other sites

This is the answer according to my understanding, you can read the paper Context-oriented Programming by Robert Hirschfeld and the others for more details. To learn more, find best online programming courses here: https://hackr.io/

 

Context-Oriented Programming is a programming paradigm that support the dynamic software adaptation with repsect to the execution context. Here, context is defined in a quite broad and open way: it is any computationally accessible information. However, most of the time the context is considered as the information sensed from environment by sensors (location, temperature ...) or internal changes of the system (energy consumption, bandwidth...).

One of the main concepts in COP is behavioral variations which express partial definitions of the basic behavior of the systems (and thus they can replace or modify (a portion of) the behavior of application logic). We can see them ass chunks of code which will be activated at runtime in order to reflect the context changes.

Behavioral variations are often crosscutting concerns which scatter over the code base (to some extend, this concept is similar to aspects in aspect-oriented programming - AOP). COP copes with this by providing layer for grouping related behavioural variations and thus "modularize" them, which make the development and maintain phases easier. Two main strategies for modularization are: layer -in -class and class-in-layer.

 

From layer-in-class view point, COP modularisation is different from AOP one because AOP aim at modularize textually crosscutting concerns in a form of aspects while in COP the layer-in-class notion denotes that it could scatter layer-specific definitions in the classes to which they belong.

Okay, but what languages have applied this concept?

Share this post


Link to post
Share on other sites

I would say that any larger application must be adjusting to environment.

Take for example application with GUI.

If user changes resolution of display screen, used font etc. in system configuration *), size of window, input device like mouse, tablet, application must detect it, and adjust accordingly to change.

Applications with fixed window size (because they don't care about font size and display screen resolution), are very annoying for users.

 

Another example, we compile base version of DLL for generic x86, yet another for CPU with SSE1, yet another for CPU with SSE2, yet another for CPU with SSE3, some AMD extensions, x64 etc. etc.

And program during execution is checking which hardware/extensions are built-in CPU, and loads appropriately optimized version.

 

Do you think above are examples of context-oriented programming.. ?

 

*) it can be in the middle of running application. .NET Framework C#/C++ have special events that are send to controls and windows after user changed something in system.

Edited by Sensei

Share this post


Link to post
Share on other sites
If user changes resolution of display screen, used font etc. in system configuration *), size of window, input device like mouse, tablet, application must detect it, and adjust accordingly to change.​

 

 

How is that different to feature-oriented programming?

Share this post


Link to post
Share on other sites

*) it can be in the middle of running application. .NET Framework C#/C++ have special events that are send to controls and windows after user changed something in system.

The difference between this and context-oriented programming is in the .NET libraries, most likely, these determinations are spread across the code to account for the changes being made to the environment. In a context-oriented paradigm, this is not a necessity in the fact that the code being used adapts to the environment.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.