Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Things to be considered while building a framework

We are planning to build a framework: a cost-estimation framework that will be used across the domains in our organization.

The high-level requirement is something like this : If I develop a certain product, how much will it costs me? This generated cost will be used to compare with the cost the vendors have quoted and to come-up with a decision as to which vendor to choose.

Now, my question is: What things to considered while developing a framework?

Few of my thoughts:

  1. Implement the high-level requirements through Abstract classes and Interfaces
  2. Provide utility classes that might be useful for Framework users.
  3. Consider what should be internal - kind of metadata - that shouldn't be shown to framework users.
  4. The design patters to use like template.
  5. the properties and the methods of the input classes.
like image 343
jai Avatar asked Aug 26 '09 07:08

jai


People also ask

What makes a good framework?

Good frameworks are based on the value stream. This makes it easier for people to see their challenges and how they relate to each other. Roles are defined as responsibilities in the value stream and not as separate people. Roles can be expanded as required by the organization's size.


1 Answers

A few ideas:

  • It's easier to add useful features later than to remove features which have proved to be badly designed or harmful.
  • Design for inheritance or prohibit it: inheritance introduces a whole extra layer of complexity, as you need to work out the interactions between superclasses and subclasses. That's not to say it's evil, but it should be very carefully considered.
  • Interfaces are usually cleaner than abstract classes in my experience, as they promote composition over inheritance.
  • For interfaces, document both what the caller should expect and what the implementer should expect. Basically think of the contract from both sides, and document it. In particular, document nullity constraints - should methods accept null or not? Should they guarantee that they'll never return null?
  • Design for testability, both of your framework and others using your framework. Which bits of the framework can reasonably be used in test code, and which should be mocked out?
  • Use your own framework, right from the start. Build a sample application which others can use to understand the framework.
like image 98
Jon Skeet Avatar answered Nov 15 '22 21:11

Jon Skeet