1.3 Developing Frameworks
Developing a framework involves more than just the product (that is, what you are going to ship as part of the framework, its architecture, and how it is factored). It also encompasses the process used to develop the framework (including the evolutionary iterations), the development team and organization that developed it, and the customer using it (including the business models and processes supported by the framework). All of these factors need to be taken into account during framework development and should be captured as part of your development process. Ignoring any of these factors is likely to result in disaster.
Developing frameworks is both similar to and different from developing applications. In either case, you should follow a methodical development process (see the Alles in Ordnung pattern, Section 3.1), such as the Unified Software Development Process [Jacobson 99]. A framework goes though each of the stages of methodical software development and will likely require more iterations than an equivalent application development effort.
The first key to successfully developing a framework is deciding what domain (functional models and processes) or domains you want to address and, within that, what applications you want to address. You can say you want a framework that addresses all applications in all domains, but be carefulif you take on too much, you will end up with requirements like "be able to write any business application," which quickly leads you to developing a programming language or a class library. These have value, but to be a framework, or at least a framework of value, the framework needs to be more focused. What about component frameworks like Java 2 Platform Enterprise Edition (J2EE)? Aren't they focused on being able to write any business application? Although they appear to be broadly applicable, these frameworks are actually narrowly targeted and support a specific domain, namely, the domain of distributed software component management.
A factor here is how much time you want to (or can) spend gathering the requirements. In order to develop a framework that addresses a set of applications in a domain (or domains), you need to have requirements from each of these applications (for each domain). Requirements are best gained from experts in the domain, for example, from business analysts for business applications. These domain experts do not have to be technically savvythat is your technical team's jobbut they need to know the applications (or more specifically, the business processes) in the domain (or domains) very well. This is unique to business application frameworks since, when developing most technical frameworks, the developer knows enough (or can quickly learn) about the domain. For example, with our prior engineering experience we could develop a device-management framework, however, we could not develop an accounting application; to do this, we need accountants.
Your process artifacts will vary depending on the development process you use. When developing the IBM SanFrancisco frameworks, we followed a process similar to the Rational Unified Process (which didn't exist at the time). For our process the deliverables were
Requirementsa business-level description of what the framework does (what it does, not how it does it)
Use casesthe business processes and tasks used to fulfill the requirements
Analysis modelthe business-level breakdown of the solution into business objects
Design modelthe design-level breakdown of the solution into classes
Source codethe implementation
Test casesincluding both the business-level description and the code to test the framework code
Each of these artifacts was developed in an iterative fashion. Figure 1.1 shows how they relate to one another and who (technical versus domain experts) is responsible for them.
Figure 1.1 How deliverables relate to one another and who owns them
These and other deliverables are discussed in detail as part of the Unified Software Development Process [Jacobson 99] and in Appendix B.
An area that becomes challenging in business application or framework development is the split between domain and technical expertise. This split (having two people or groups of people own some of the artifacts) provides two challenges: (1) initially developing the artifacts, since each group will need to participate, and (2) keeping the related artifacts coherent with one another during development iterations. To address these two challenges we add distinct points of contact between the domain and technical teams.
Use case handoffthe completed requirements, use cases, and first-pass analysis model are given to the technical team by the domain team. The purpose of this meeting is for the members of the domain team to educate the technical team members so they can begin the design. At this point the technical team works with the domain team to refine the analysis model and begin producing the design model.
Combined reviewthe domain and technical teams review a package consisting of the requirements, use cases, analysis model, design model, and test case definitions. This is to ensure that all of these deliverables are consistent before code development begins. The test cases are usually defined by the domain team from the use cases and then implemented by the technical team.
Within our process, these meetings form the minimum set of interactions the two teams can have.
These interaction points and the systematic development process into which they fit are critical for producing and keeping the artifacts consistent. Why should you care about keeping these internal artifacts consistent? Although they are internal when developing an application, they also become part of a framework's external deliverables. 1 If a framework provided only the code that implemented it, you would be able to map only above the code level once you did a lot of reverse engineering. The learning curve is big enough without that kind of obstacle! As discussed in the next section, the sooner the framework
Another aspect of developing a framework is maintenance. Once the framework is developed, it will need to be maintained. The increased number of artifacts is both a blessing and a curse. It is a curse because you have more to maintain. You now have to consider sending out patches to your requirements, use cases, or models. This not only reduces user confusion but is also required by any tools that use this information. For example, a code generator that uses information in the design model to create the correct code depends on that model providing an accurate representation of the associated source code. It is a blessing because, especially when you provide the source code, it provides some of the benefits of open source software development. Your customers can provide their own patches and can send you their patches. This doesn't mean you have to accept their patches blindly, but it does give you a huge jump start in identifying and fixing problems.