Code modularity

Zhanna Tsitkova tsitkova at MIT.EDU
Wed Oct 28 11:33:08 EDT 2009

This is the initial write-up for the Code Modularity proj. It's goal  
is to reorganize the code to simplify the construction of the code  
subsets (clients, servers, u2u etc for mobile devices, embedded  
systems etc) and, potentially, improve the quality of the code.

After analyzing various approaches in the constructing of the subsets,  
we agreed that the best one is to have related functions in the  
separate files so that building these files would produce the minimal  
lib with the required functionality. It is somewhat one-function-per- 
file approach without going into extremes of literal "one function in  
one file", rather "file is a holder of the equivalent functions".  
Equivalence relation is defined in terms of reflexivity, symmetry and  

We define two functions to be equivalent if they have the same parent.

Let X1, X2, X3, ... Xn denote kerb API's and lets call them "parents".

Example 1.
Suppose that x-reference analyzer shows the following function call  
X1 -> C1 -> B -> (A1, A2)   ( i.e X1 calls C1 which calls B, which  
calls two functions A1 and A2)
X2 -> C2 -> B -> (A1, A2)
Then the parents are:
X1 -----> X1
C1 -----> X1
X2-----> X2
C2 -----> X2
B  ----->   X1, X2   ( i.e. X1 and X2 are parents of B)
A1-----> X1, X2
A2-----> X1, X2
This brings us to the conclusion that the following functions are  
equivalent and may live in three separate files: (X1,C1), (X2, C2),  
(B, A1, A2).

Example 2.
Let x-ref for X1 and X2 be the same as in example 1 and add a new API   
X3 which calls only A2. Now the parenthood is:
X1 -----> X1
C1 -----> X1
X2-----> X2
C2 -----> X2
X3-----> X3
B  ----->   X1, X2
A1-----> X1, X2
A2-----> X1, X2, X3
resulting into five separate function holders (X1,C1), (X2, C2), (X3),  
(B, A1), (A2)

We might consider the case when X2 and X3 are serving similar purpose.  
For example, they are client-only code. Then, we can define group, say  
X1 -----> X1
C1 -----> X1
X2-----> X2
C2 -----> X2
X3-----> X3
B  ----->   X1, G23
A1-----> X1, G23
A2-----> X1, G23
so one needs four files to hold equivalent functions  (X1,C1), (X2,  
C2), (X3), (B, A1, A2)


More information about the krbdev mailing list