I used to want to build a MVVM project for myself, especially since I wrote my mementowriter project which is no jQuery, and that was very time consuming and tiring to create.
Last year, I had some inspiration, and really wanted to try to start fresh things in my tech skills stack, actually the frameowrks took me much time to think of how to design
The Java project which is CaloJMVC is what I wrote based on the simple server provided in newer JDKs, it is very simple, thus had quite a lot of work to do in order to implement a usable framework, I was not satisfied, so I put in a lot of efforts to investigate all the common pieces details, it is not that bad I think now.
The other project is the Calochjs, which is an MVVM javacscript framework, since traditional frontend is tiring, too much work to do. But I am not safisfied with using somebody else's frameworks, like VUE, React, Angular, etc. Using a framework is too easy to my level, just by reading the code, I can hands on in several minutes, because of the years' experience. Then how about crafting my own framework?
So I did it, it actually took pretty many tries to think of how to design the framework to make a data focused brief framework to save my future labor.
In the beginning was the Render Tree, then, the methods, how to bind them to events, then how to make any data change reflected on data take effect.
I got stuck many times when I was trying to design it. I tried many solutions, and many failed, some bugs are found just as I began to develop based on it.
In the beginning it was all based on static methods, because the Render tree is already very hard, it requires to take care of all data types, and the DOM, also think of templating.
Building such a framework is like managing a kingdom, the render tree took much time to precisely render every control, then another question came up, how to make to control's event respond to control value change and reflect the change on the data model.
It is like first scattering ID card to every resident in the kingdom, and everybody can respond to the data model. I thought and thought, and used the currently most brief way, every control should have a Path that points to it's value in the model.
Then other than basic Javascript skills to perfectly manage OOP objects and their instances with interactions, storing static things, I also had think of what if there are more than one APPs in the page, so, this time, another question came up, that's how it is like now, multi-instanced apps attached to more than one app root elements.
Then how about managing the routes to build a SPA webapp, and how to extend ajax utils, what about the callback expire due to page navigation. Would ajax same change its data model and apply the rendering.
Now it is more or less satisfying, I somehow dare say, it is my MVVM framework, and I know every design detail of it. And it will help me a lot in my future web apps!
Of course there may be other bugs which I haven't discovered, I will make more use of my own crafts, they two are my new future tech skills of my other works.
They are fundamentals, and there will be apps built upon them, I know there will be a long way, what if I meet with other hard problems? This is my way! Of doing them!
https://caloch.gitee.io/calochjs/spatester.html
标签:myself,satisfying,MVVM,how,data,project,framework,my,more From: https://www.cnblogs.com/hualiu0/p/17865980.html