[Prog] Using so-called ‘context’ data structure.

Sometimes, so-called ‘context’ data structure is used to handling set of related information. And this context data tends to be required as parameter by various functions. Here is pros and cons.

Pros:
– It is easy to handle lots of related data – data allocation and free etc.
– We can save costs of parameter passing; Passing context is enough.

Cons:
– It is difficult to know which one is input and which one is output, because whole context is passed as parameter. This decrease readability very much.
– Usually, context is passed as parameter to lots of functions. So, just like ‘global’ data, it is very difficult to trace the value-change-history. That is, debugging/maintaining becomes difficult.

One good way to using context structure; Only very few modules can change/modify context data. And others only can read this one. Than, lot’s of issues in “Cons” can be overcome.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s