How to create Frame work and How to call all functions in one main?
- 4 years ago
1.1 How to design a framework.
This is a tough one and can't be fully explained in forum message, need a real worksop because depends a lot of you, your goal, your team, your business, ..
But in a quick guidance view, below my way of doing :
- Have technical object to manage things not related to business/TC (e.g. Services, Cmd, System, DB, ..).
- Have one object dedicated to one app;
- Build this object as OOP as you can
- Build it with at least 3 layers; base function not linked to business, base business function and complex business function.
- Think about useful properties (e.g. Performance or Functiunal exec mode, log level, base path, ..)
- Use documentation framework (i use jsdoc style comments and a tweaked jsdoc module of nodejs)
- Include self test in your object
2.2 Usage
Several techniques, pseudo-class, closure, useunit, modules ... depends again of multiples things.
Personnally i use a closure object method and 2 units (one for global keys mappings/variables, one for business object/methods). And the call from tests cases is made by //USEUNIT