Tuesday, July 06, 2004

Grouping Functions into Components

Once we understand the needs for having functions for generalized activities, we can analyze the application requirements to identify such functions. After carefully going through their base intents, we will find quite a few features that are common among them. These commonality can be based on generic functionality as well as it can be based on the application functions. If we go by the activities of the account transfer in details, we will find a few such characteristics on which are spread across the functions, such as:

1. Numeric and Logical Operations (addition between numbers, subtraction between numbers, identifying the greater number out of two numbers)
2. Making query into the accounts database to obtain the balance (will be required for both validation, addition, and sutraction)
3. Updating the accounts database with modified balances (will be required for both log activities)

If we go through each of these, #1 is a set of generic number crunchers. #2 requires a database connection to make queries. #3, on the other hand, requires database connection, as well as proper access to update and commit data.
Based on such analysis the required functions and methods can be now grouped into three groups, where each of these group will be having some properties to be applied upon all functions within this group.

Implementation of such groups are done through components.