Interface and program framework

xiaoxiao2021-03-06  88

Oh, I wrote blog for the first time, talk about a little feeling in these days. In some programs, there is often some similar or identical operations, and we often do what to do and do. In general, the framework of the program is to determine when doing, and defining related class libraries to support. We want to operate at a certain time (what function to do) has the same parameters. In this way, the client can do not know the specific classes she call, it can be programmed according to this function prototype. Usually, I use a base class to define the interface, and then have the same steps inherit this base class, at the same time, according to the degree of acquaintance between the various types, the class is divided, and each class in the class step ladder There should be clear features. Inheritance, it will bring some additional benefits, for example, increase the interception point (this should be another advantage of layers), more easily increased. Especially large projects, a unified interface should be used. There are also some tips, for example, the class parameters in the interface definition function use the base class of the actual use class, when actually use, if needed to transform down.

转载请注明原文地址:https://www.9cbs.com/read-122501.html

New Post(0)