当前位置:网站首页>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 .
边栏推荐
- RestCloud ETL解决shell脚本参数化
- Online text entity extraction capability helps applications analyze massive text data
- OS的常见用法(图片示例)
- Quickly understand the commonly used asymmetric encryption algorithm, and no longer have to worry about the interviewer's thorough inquiry
- Is it safe for flush to open an account online? What should we pay attention to
- 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
- Quarkus+saas multi tenant dynamic data source switching is simple and perfect
- 通过 OpenVINO Model Server和 TensorFlow Serving简化部署
- The filter function of dplyr package in R language filters the data rows containing the specified string in the specified data column of dataframe data based on the grepl function
- Loss, duplication and backlog of message queues
猜你喜欢

20 years' Shanghai station D question Walker (two points, concise)

618的省钱技术攻略 来啦 -体验场景 领取10元猫超卡!

64 channel telephone +2-channel Gigabit Ethernet 64 channel PCM telephone optical transceiver voice telephone to optical fiber

How deci and Intel can achieve up to 16.8x throughput improvement and +1.74% accuracy improvement on mlperf

Go write permissions to file writefile (FileName, data, 0644)?

Configure SSH Remote Login for H3C switch

32-way telephone +2-way Gigabit Ethernet 32-way PCM telephone optical transceiver supports FXO port FXS voice telephone to optical fiber

PHP handwriting a perfect daemon

Multi-Camera Detection of Social Distancing Reference Implementation

那些技术实战中的架构设计方法
随机推荐
POW consensus mechanism
理解ADT与OOP
Quartus II 13.1 安装步骤详解
理财产品长期是几年?新手最好买长期还是短期?
Online text entity extraction capability helps applications analyze massive text data
实战 | 如何制作一个SLAM轨迹真值获取装置?
32-way telephone +2-way Gigabit Ethernet 32-way PCM telephone optical transceiver supports FXO port FXS voice telephone to optical fiber
PHP handwriting a perfect daemon
The R language inputs the distance matrix to the hclust function for hierarchical clustering analysis, uses the cutree function to divide the hierarchical clustering clusters, specifies the number of
Cloud native essay deep understanding of ingress
Go写文件的权限 WriteFile(filename, data, 0644)?
Hanyuan high tech USB3.0 optical transceiver USB industrial touch screen optical transceiver USB3.0 optical fiber extender USB3.0 optical fiber transmitter
[website architecture] the unique skill of 10-year database design, practical design steps and specifications
R language uses the polR function of mass package to build an ordered multi classification logistic regression model, and uses the summary function to obtain the summary statistical information of the
C语言的基本数据类型及其打印输出
How to solve the task cache compilation problem caused by gradle build cache
MIT 6.031 Reading5 : Version Control学习心得
How do the top ten securities firms open accounts? Is online account opening safe?
Simplify deployment with openvino model server and tensorflow serving
Wallys/DR6018-S/ 802.11AX MU-MIMO OFDMA / 2* GE PORTS/WIFI 6e / BAND DUAL CONCURRENT