Evolutionary Software Design: How you grow
Software evolves around few operations, events, business elements, and their interconnections. Lets call them software basic elements. The key to software design is where you start (which element) and how you grow. Its not just about code reuse rather is about artifact reuse i.e. reuse of these basic elements.
When you start you could go from top down (when you know all about the software system you are going to develop) or from bottom up. While going bottom up, you choose one of the basic elements and add other elements to it. Let me take an example of search engine and more specifically search on structured dataset. Search in itself is a vast field and when we start its easy to get overwhelmed. Then, what we can do is think carefully what are the most important operations in search.The key operations here are: sorting and set operations. Suppose, we choose sorting to start with. So, what, how, how often to sort? What gives us the answer what data structure to represent. Then, how the sort operations are expected to be used and how often. After knowing these, just start with a very simple data structure that represents a tiny part of your sorting use. For example, I need to sort all the health care claims according to paid amount. Then I would choose the sorting key as floating point data and sort the records according to that. Next, how that would be used? Let us say, I would sometimes need to sort top 20, sometimes bottom 100, sometimes top 100 thousands, sometimes top 1 million and sometimes even whole dataset. These numbers are good enough to play with. We can play around with many alternative algorithms in different conditions and get some real numbers for each.
By now, we get the idea of which algorithm and which data structure suits our use cases. Once, we analyze our problem in terms of such operations, we get their interconnections revealed to us. Like: how we are going to use that data structure, how that can be accessed from other components. This gives a well defined interface for our core operations and that's it. The next step is to add the interconnections to this basic element we developed. Besides this do not forget to reuse the pattern you identified while solving and playing around with the core operations.
Not always we get the basic operations to play with. Sometimes we get basic business elements that form the base of the software and that is the only thing we know best. For example, I want to develop a health care software that just analyzes the clinical issues of members in a dataset, not financial ones. So, the input is the health care dataset that centers around the members for which the software is analyzing. The health care dataset would then consists of medical and pharmacy claim (diagnosis) records of members which says the time and nature of each event. The basic element to play with is the event itself. The events could include: when a member meets a doctor, member gets diagnosed, member gets prescription, member follows some procedure, and so on. So, each event has some starting and ending date. That's it.
My event dataset is complete. I have a set of members and each member has a set of events each having starting and ending date. Now, the client asks me to generate a set of quality of cares for the members. Then, I simply create rule of each care based on those events. Members meeting those rules will meet the conditions for quality of care, otherwise not. Next, client asks me to generate alerts if member does not do some preventive care. Then, I simply build rules for alerts that says, trigger alert if a member does not have this event on some defined date patterns. In this way, when we could figure out the most re-used and most simple business element, then everything can be build around this.
The advantage of reuse of basic operations or basic business element is that you build the most basic thing you can imagine of, foresee its very simple use cases and then design very simple solution that can address your need. You can test the element and retest for all scenarios. The result is unbelievably strong foundation for the software that you will be building. In fact this is where you can kick start most complex things in your business with a lot of simplicity. In the next article I will cover how you grow your software on top of this. Stay tuned.