Let's write a framework.

Let's write a framework.

  1. create a model var model={a:1,b:'b'}

  2. let's create a router, router maps url to concrete object and returns response, router is a collection

  3. let's create a manager for managing all our clients, to per request there is a client, or shared

  4. let's organize our request params, and apply request pipeline filters, read identity from cookie

  5. let's interact with database

  6. let's create a configuration manager which handles configuration loaders from different sources

  7. let's create a language manager

  8. let's create a base facade for our service base class

  9. let's create a type manager and apply di

  10. let's find from our ioc container the type that matches our router

  11. let's instantiate an object by the type

  12. let's execute the method router requires

  13. write the execution result to response

  14. apply result filters

  15. send to client.

  16. for model binding type, mvvm requires to audit property changes and recalculates the whole view model, mvc just binds the value to ui, mvp abstracts the view into an interface and handles all view relevant logic in presenter, old store pattern first gets all data, and keeps a state which is bad for interaction type apps.

  17. Further more, let's create a socket as server binded to a port and accepts data by tcp/ip protocol.

  18. Whenever our server socket receives a socket connection as client, store the client to static memory by a manager class.

  19. Write response by the client socket in store.

  20. Writing our ORM, we need to implement a pool which holds a certain number of connections to be performant

  21. Deassemble our models into k-vs, and create table oriented sql clauses by model type name

  22. For different operations, build different sql sentence

  23. Use sql driver and execute the sentence, so the data is finally hibernating in database;

  24. For relation type db, read index, foreign keys, keys, and instantiate different objects with data.

  25. Using a Serialization tool, create a serialization protocol, and reorganize the data into the form k-v by k-v

  26. Create

原文地址:https://www.cnblogs.com/hualiu0/p/11089498.html