OOP technology applied to the surface layer: db2js
In other words, oop is inferior to the database in terms of business processing and then to the Web server. It is not a result of success or failure.
It raises a philosophical question: Where can OOP be used to bring pleasure without side effects.
Review the fields occupied by OO:
1) Personalized encapsulation of flat function libraries. For example, socket, I used a pretty csocket class, which is much better than a function. By the way, sesame seeds have blossomed from below, and I have not yet met a success precedent. After this encapsulation, the obvious advantage is that the class members are much more secure and won't be named again. :)
For example, windows. Forms. Button is also an encapsulation of flat functions.
2) advanced technology. In fact, it is encapsulation advanced.
3) if there is no structure, oo can be used as the structure ~~
The structure expressed by Oo is particularly handy because the object variable is a pointer.
4) to be added to the official website.
The conclusion is that OO is a superb encapsulation technology that can flexibly express the data structure.
Even algorithm programs such as chess do not require encapsulation of OO. The most important thing to express the data structure flexibly is the interface.
For example, a commonly used List View (listview) has a complex organizational structure. Let alone correct responses. A listview corresponds to a batch of data. If the data is not encapsulated as an object, it is difficult to use it by pointer alone. memory management problems such as adding and deleting are undoubtedly easy to lose hands. On the contrary, it would be much easier to implement it by using the OOP language with the ability to reclaim memory.
This article mainly discusses the creation of the Web interface of the JS center and the layout of the entire system structure.
Compared with winform, although there are few ready-made libraries, the Web has powerful text-and-text mixing capabilities. A table tag can act as both listview and Treeview, or even more. The javascript language used for web control is also designed to be powerful enough and has dynamic language features such as anonymous methods and later binding.
Therefore, the Web interface design is actually the JS design with HTML as the terminal. Classic MVC theory can still be applied here. A typical element, such as Div, can be referenced with a JS object. The update method of the JS object is used to render the webpage element. The webpage element calls the processing code of the JS object for response.
JS Object serialization and deserialization, as well as service processing capabilities, are implemented using Ajax.
As a result, JS objects are the core of the entire system. From the business-centric perspective, database tables are the core of the system. Apart from these two, I don't know if there is any center.
Therefore, the most important problem today is to solve the ing between JS objects and databases. There are two ways to implement db2js:
1) on the web server or data layer, the query results are packaged as XML, parsed on the client, deserialized into JS objects, and saved in the opposite process.
2) The web server or data layer directly generates "companylist. add (ID, name ...); "This JS statement directly forms a JS object on the client using the JS eval command. This is my favorite method.
This method is more interesting to directly generate the creation statement in the SQL statement query. For example
Select 'companylist. Add ('+ ID +', "'+ name +'"); 'from Company
You can create an object by throwing the query result to the foreground. The overall cost benefits brought about by such implementation have not been carefully considered. But for development, it is undoubtedly very simplified.
Currently, developers only have two roles, database and Js. The Web server serves only as an intermediate medium. It can be ignored if it is written once and never rewritten.
During the first development, You can first create static pages, manually construct several JS objects, and first make the results. This is the interface model. Because custom tags such as struts are not used, artists can beautify static pages without barriers.
After that, developers will replace the code that generates pseudo objects with the code that can operate databases in Ajax. The system can be applied.
Finally, add the data check capability, and the project may end.
Permission implementation is considered in the database. You can use roles or self-made ACL tables to check whether a stored procedure is called.
This technology has been used less or less and is suitable for development, but it is still not widely used. To come.