当前位置:网站首页>Learning experiences on how to design reusable software from three aspects: class, API and framework
Learning experiences on how to design reusable software from three aspects: class, API and framework
2022-06-23 13:38:00 【Jingjingzi*】
Catalog
Classification of software reuse
Three aspects of software reuse
The reuse type of the framework
Software reuse
Software reuse is to use all kinds of knowledge about existing software to build new software , To reduce the cost of software development and maintenance . Software reuse is an important technology to improve software productivity and quality .
Early software reuse was mainly code level reuse , The reused knowledge refers to the program , Later it expanded to include domain knowledge 、 Development experience 、 Design decides 、 Architecture 、 demand 、 Design 、 Code and documentation and everything .
Classification of software reuse
Software reuse is mainly divided into code level reuse 、 Component level reuse 、 Module level reuse and architecture level reuse , Software reuse is to regard software as composed of different functional parts “ Components ” An organism composed of , Each component can be designed as a general tool to complete the same kind of work , such , If the components that do all kinds of work are established , The task of writing a particular piece of software becomes a simple problem of organizing different components into connectors , This will fundamentally change the final quality and maintenance of software products . Software reuse can reduce development costs 、 Effectively improve the development level , This technology is also the inevitable stage of the current software technology development .
Three aspects of software reuse
1. class
It is the basis of information encapsulation in object-oriented programming . Class is a user-defined reference data type , Also known as class type . Each class contains a data description and a set of functions that manipulate data or deliver messages . An instance of a class is called an object . It is actually a reference data type , Its essence is to represent a data type , It is the abstraction of a class of things with common characteristics in real life , Class encapsulates the properties and methods used to manipulate its own members , These methods are programs and procedures that operate on this object , The composition of a class includes member properties and member methods , The software reuse methods based on classes are inheritance and delegation , Inheritance is to extend a base class or override an operation through a new operation , A delegate captures an operation and sends it to another object , At the class level , With inheritance , You can make the subclass have the properties and methods of the parent class , It's also a kind of reuse , It can even be said to be a very important reuse , Subclasses do not have to use certain methods . And for the delegate method , stay java Class directly calls this class's static Method , similar c Functions in language , Call directly , This is also a kind of reuse , Similar ones Math.sprt() The call and use of this method .
2.API
Application programming interface , It is some predefined functions , Or it refers to the agreement on the connection of different components of the software system . A set of routines that applications and developers can access based on a software or hardware , Without accessing the original code , Or understand the details of the internal working mechanism .API Connecting data in different formats . Each data format requires different data commands and parameters to achieve correct data communication , But there are also different types of errors . therefore , In addition to the knowledge required to perform data sharing tasks , These types of API Many network parameter problems and possible error conditions have to be solved , That is, every application must know whether it has strong performance to support the communication between programs . On the contrary, because of this API Only one information format , So information delivery in this case API Only small commands are available 、 A subset of network parameters and error conditions . deliver API This method greatly reduces the complexity of the system , So when an application needs to share data through multiple platforms , Using information delivery API Type is the ideal choice .API Designed to be small 、 complete 、 Simple and clear , Make the calling code easy to remember 、 High readability , secondly ,API To follow LSP principle , That is, if for each type it is T1 The object of o1, All of them are of type T2 The object of o2, So that T1 All programs defined P In all objects o1 All generations into o2 when , Program P There is no change in behavior , So the type T2 It's the type T1 Subtypes of . And it is also necessary to realize that all the places that reference the base class must be able to use the objects of its subclasses transparently . All in all ,API The ground reuse technology has a great development prospect , But at the same time, the above-mentioned specifications shall be fully considered in the design ,
2. frame
Is a group of concrete classes 、 abstract class 、 And the connection between them According to framework The statute of , Fill in your own code , Form a complete system . The framework is usually extended by selective coverage ; Or programmers can add special user code to provide specific functions . We define the framework from the aspects of application and purpose :
Application aspect : A framework is a reusable design of a whole or part of a system , It represents a group of abstract components and methods of interaction between component instances .
Purpose : The framework is an application framework that can be customized by application developers .
Users can extend the framework , But its code should not be modified . In order to increase the reusability of code , You can use delegation and inheritance mechanisms . meanwhile , In the process of using these two mechanisms to increase code reuse , We also add relationships between different classes accordingly ( Delegation or inheritance relationship ). And for a project , The dependencies between different classes can be regarded as a framework . A large-scale project may consist of many different frameworks . Common frameworks are similar to spring Frame this ,spring The framework code cannot be modified but has DI,IOC, It is convenient for users to create objects , When to create an object , Leave it to the system to judge , Users only need to use objects .
The reuse type of the framework
White box reuse : The source code is visible , Modifiable and extensible , Copy the existing code when the system under development , Make changes
advantage : High degree of customization
shortcoming : Modifying it increases the complexity of the software , And need to fully understand its internal
Black box reuse : The source code is not visible , Do not modify , Only through API Interface to use , Unable to modify code
advantage : Simple and clear
shortcoming : Poor adaptability
summary
Software reuse will be further developed in the future under the current software development environment , How to better run the engineering thought is reasonable 、 The scientific application of these reuse technologies to create more perfect software engineering will also be a larger research topic , As a student majoring in Software Engineering , It is also necessary to understand and practice the reuse method pattern , Do a good job of excellent design thinking foundation for our career development .
边栏推荐
- 64 channel PCM telephone optical transceiver 64 channel telephone +2-channel 100M Ethernet telephone optical transceiver 64 channel telephone PCM voice optical transceiver
- Go写文件的权限 WriteFile(filename, data, 0644)?
- 16 channel HD-SDI optical transceiver multi channel HD-SDI HD video optical transceiver 16 channel 3g-sdi HD audio video optical transceiver
- 深入剖析MobileNet和它的变种
- Overview of national parks in the United States
- 交换两个数的三种方法原理解析
- Lm05 former VIX (second generation product)
- R language uses matchit package for propensity matching analysis (set the matching method as nearest, match the control group and case group with the closest propensity score, 1:1 ratio), and use matc
- Filtre de texte en ligne inférieur à l'outil de longueur spécifiée
- . Net how to use log framework NLog
猜你喜欢

Simplify deployment with openvino model server and tensorflow serving

2-optical-2-electric cascaded optical fiber transceiver Gigabit 2-optical-2-electric optical fiber transceiver Mini embedded industrial mine intrinsic safety optical fiber transceiver
[email protected] Hdmi2.0 optical transceiver HDMI HD video optical transceiver"/>4k-hdmi optical transceiver 1 channel [email protected] Hdmi2.0 optical transceiver HDMI HD video optical transceiver

智能数字看板解决方案

Hanyuan hi tech 1-way uncompressed 4k-dvi optical transceiver 4K HD uncompressed DVI to optical fiber 4k-dvi HD video optical transceiver

Online text filter less than specified length tool

CRMEB 二开短信功能教程

90%的人都不懂的泛型,泛型的缺陷和应用场景

Quartus II 13.1 安装步骤详解

quartus调用&设计D触发器——仿真&时序波验证
随机推荐
R language uses the polR function of mass package to build an ordered multi classification logistic regression model, and uses exp function and coef function to obtain the corresponding odds ratio of
The two 985 universities share the same president! School: true
What a talented company that can turn SAP system into a chicken rib!
How did Tencent's technology bulls complete the overall cloud launch?
How do the top ten securities firms open accounts? Is online account opening safe?
有向图D和E
TUIKit 音视频低代码解决方案导航页
Quarkus+saas multi tenant dynamic data source switching is simple and perfect
In flinksql, the Kafka flow table and MySQL latitude flow table are left joined, and the association is made according to I'd. false
Windows install MySQL
1 channel 100m optical fiber transceiver 1 100m optical 1 100m electric desktop Ethernet optical fiber transceiver built-in power supply
OpenVINOTM 2022.1中AUTO插件和自动批处理的最佳实践
互联网技术发展内卷后的出路——iVX的诞生
R language uses the multinom function of NNET package to build a disordered multi classification logistic regression model, uses regression coefficients and their standard errors to calculate the valu
4k-hdmi optical transceiver 1 channel [email protected] Hdmi2.0 optical transceiver HDMI HD video optical transceiver
Best practices for auto plug-ins and automatic batch processing in openvinotm 2022.1
Wallys/DR6018-S/ 802.11AX MU-MIMO OFDMA / 2* GE PORTS/WIFI 6e / BAND DUAL CONCURRENT
DBMS in Oracle_ output. put_ How to use line
Androd Gradle模块依赖替换如何使用
quartus调用&设计D触发器——仿真&时序波验证