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.
'Domain > Software' 카테고리의 다른 글
[GNU] Issues of cross-compiling in GNU build system. (0) | 2011.04.21 |
---|---|
[Tips] Cyclic Queue (0) | 2010.10.18 |
[SW] Questions to evaluate SW Engineer (0) | 2009.04.09 |
[Prog] Take care of errata when using float/double at all times! (0) | 2007.01.26 |
[Spec] DWARF2 (0) | 2006.08.30 |