Students who have studied C and Java must know that these two languages represent two different ways of development, namely the structured development method represented by C and the object-oriented development method represented by Java. Because the two are very different in the program structure, therefore, in the software development field, according to their own needs to choose a reasonable development mode is particularly important.
There are usually three levels of development software:
1. Meet user needs
2. maintainability, can be modified, so that the software can be changed as the user needs change and easy to change
3. reusability (in other software, the module that can reuse the software as far as possible)
Through the analysis of these three major layers of software, we can determine our choices in real-world development.
Structured approach
Overview of structural methods
The structured method is the decomposition of the real problem, the solution domain of the process design space, the emphasis on the top-down, the gradual refinement and the modular design, is a data flow chart, the information dictionary, structured language, decision table, decision tree and other graphic expression as the main means, The software analysis method which emphasizes the structure rationality of the development method and the structure rationality of the system.
L Structural method analysis steps
Application-oriented, decomposition requirements (SA):
① analyzes the current situation and makes a DFD that reflects the current physical model;
② deduces the equivalent logical model of the DFD;
③ Design new logic system, generate data dictionary and primitive description;
④ establishes the human-machine interface and proposes a DFD for the physical model of the target system;
⑤ determine the cost and risk levels of the various programmes and analyze them accordingly;
⑥ Choose a scheme;
⑦ establish a complete requirements specification.
Refine analysis results, transition software Architecture (SD):
① review and refine the streaming chart;
② determine the type of the streaming diagram;
③ maps the flow chart to the software module structure, and designs the upper layer of the module structure;
④ based on the flow diagram to decompose the high-level module, design the lower module;
⑤ optimizes the structure of the module and obtains a more reasonable software structure.
⑥ describes the module interface.
As can be seen, the flow chart (DFD) is the core of the structured approach, the entire analysis process is based on the flow chart as a tool. The data flow diagram depicts the process of the flowing and processing in the system graphically, because it only reflects the logic function that the system must complete, so it is a function model. In the structured development method, the data flow diagram is the result of the requirement analysis stage.
There are two typical structure of the flow chart, one is the transformation structure, the work described can be expressed as input, main processing and output, linear state. The other is a transactional structure, which is a bundle of data streams that flow in or out parallel, possibly with several transaction requests.
Transform-type Structure streaming chart
Transaction-type Structure streaming chart
After the completion of the structure of the flow chart, we need to gradually subdivide the requirements, level by layer, to complete the design of the steps, and then only need to implement specific functions. The overall structure is as follows:
Each circle in the diagram corresponds to a streaming diagram
L Basic principles of structured methods
(1) Abstract principles
Abstract principle is the basic principle that all systems scientific methods must follow. It is a basic cognitive process and mode of thinking, which focuses on grasping the essential content of the system and ignoring the content of the system's current goal.
(2) Decomposition principle
The principle of decomposition is the most basic principle in the structured method. It is a kind of first-general after-local thought principle in constructing information system model, it adopts top-down layered solution method.
(3) Principle of modularization
Modularization is a concrete application of the most basic decomposition principle of the structured method. It mainly appears in the structural design stage, its goal is to break down the system into several modules with specific functions to complete the functions specified by the system.
• advantages and disadvantages of the structured approach
Advantages:
① emphasizes the integrity and locality of the system development process, and emphasizes the consideration of the specific analysis design problem in the premise of the whole optimization. That is, the top-down view.
② emphasizes the completeness and sequencing of each stage of the development process, emphasizing strict differentiation of the development phase, rigorous system analysis and design, timely summarization, timely problem feedback and correction, thus avoiding the chaotic state of the development process.
③ the problem of the objective world into the process that the computer can handle, the basic unit of dealing with the problem is the module that can express the process clearly, use the hierarchy structure of the module to summarize, the relation and function between module or module.
The ④ structured approach is more straightforward and higher than the executable code produced by the object-oriented approach. Therefore, for some embedded systems, the structured method produces smaller systems and more efficient operation.
Defects:
① its starting point is too low, resulting in a series of problems due to the long system development cycle.
② It requires the system developers in the early investigation to fully grasp the user needs, management status and anticipate the changes that can occur, which is not in line with the gradual understanding of the objective regularity of the affairs.
③ systems with structured methods are difficult to modify and expand. Structural analysis and design clearly defines the interface of the system, when the system changes to the external interface, it often causes large changes in the system structure, it is difficult to expand the new function interface. The reusability of the system using the structured method is poor. The structured approach separates data and operations, resulting in reusable software artifacts that can be applied in a specific application environment, reducing the reusability of the software.
The ④ structure method is suitable for the problem of less data and more operation, but for the database, information management and other data-based systems, the structured method is not suitable.
In a word, in the actual development, if the target system has the function to determine, after the completion of the basic need not change, the requirements of high efficiency and accuracy, do not require the use of a large number of data, structure clear, small and fine, allow the development cycle is long enough, suitable for the use of structured methods. For example: Bottom system, embedded system, mechanical control system and so on.
Object-oriented approach
L Overview of Object-oriented methods
Use the concept of the real world to abstract the problem of thinking and thus solve the problem naturally. Emphasis is placed on simulating concepts in the real world without emphasizing processes and algorithms, and supporting reuse. Ideology, the object-oriented approach is closer to the actual situation, starting from the actual situation. is a methodology based on the concept of "object".
L Structural method analysis steps
Based on application, characterizing the problem (OOA):
① determine the problem domain.
② Area Classification and objects
③ distinguish the whole object and its components, determine the relationship and structure of the class
④ Defining properties and services
⑤ to determine additional system constraints
Refine analysis results, Supplement implementation related (OOD):
① Improving and perfecting system analysis results
② design interaction process and user interface
③ Design task management, and how subsystems and tasks are coordinated
④ Design Global resources to determine resource allocation for tasks or subsystems
⑤ Object Design
In object-oriented approach design, the tools we use are UML diagrams, and the structure of the object in UML diagram design is as follows:
After the design is finished, we can implement our object according to the design. The object-oriented method can be closely combined with the design document, and the inner information of the encapsulated object can only be viewed and changed by the corresponding methods and interfaces, which is closer to the real-world operation. is an approximate illustration of an object-oriented approach:
L Basic principles of object-oriented approach
(1) Abstract
Abstraction is the most basic way to deal with the complexity of the real world. In the Oo method, it emphasizes that the essential characteristics of the difference between an object and other objects. Determining a reasonable abstract set for a given domain is one of the key problems in object-oriented modeling
(2) package
Encapsulation is the process of dividing an abstract element by a structure and behavior that encapsulates the original interface used to separate the abstraction and its execution.
Encapsulation is also known as information hiding information hiding it separates the external features of an object from the internal execution details and hides the latter from other objects.
(3) Modular
Modularity is a system feature that has been divided into a series of clustered and coupled modules to determine the correct set of modules for a given problem almost as difficult as determining the correct abstract set, usually each module should be simple enough to be fully understood
(4) Level
Abstract sets usually form a hierarchy, which is the collation and sorting of abstractions. There are two very important levels in the complex real world, one is the type hierarchy and the other is the structural level. Determining the level of abstraction is based on the inheritance of objects, which helps to discover the relationship between abstractions in the inheritance of objects, and to understand the nature of the problem.
L The advantages and disadvantages of object-oriented approach
Advantages:
① emphasizes that the problem domain and the tectonic system are understood from the real world objective objects, which makes the system developers greatly reduce the difficulty of understanding the problem domain, so that the system can reflect the problem domain more accurately.
② uses the human daily thought method and the principle (manifests in the Oo method abstraction, the classification, the inheritance, the encapsulation, the message communication and so on basic principle) carries on the system development, is advantageous to the human thought ability, and effectively controls the system complexity.
The concept of ③ object runs through the end of the development process, so that the system components in each stage of development are well corresponded, which significantly improves the system's development efficiency and quality, and greatly reduces the difficulty of system maintenance.
The consistency of the ④ object concept enables the various people involved in system development to have a common language in each of the developed segments, effectively improving the communication and collaboration between people.
The relative stability of the ⑤ object and the isolation of the variable factors enhance the strain capacity of the system.
The inheritance relationship between ⑥ object classes and the relative independence of objects provides strong support for software reuse.
Defects:
① Object-oriented method, which implements the object-oriented of code through compiler. This means that after the compiler, the code is translated into the corresponding structured code. So to be proficient in development, but also to understand a certain structure of the method as the basis.
② object-oriented methods are more complex and difficult to understand than structured object methods.
③ the object-oriented approach is less efficient in terms of execution efficiency
④ requires a certain software support environment.
⑤ is not suitable for large-scale MIS development, if the lack of overall system design division, easy to cause the system structure is unreasonable, the relationship between the parts of the problem.
⑥ because of the higher logic abstraction layer, so that object-oriented in the implementation of the time, have to make performance above the sacrifice, computing time and space storage size is very expensive.
In a word, in the actual development, if the target system needs more flexible, the implementation efficiency requirements are low, need to upgrade or change the requirements of the management and use more data, the system needs more functions, data, such as a small number of operations are more suitable for object-oriented development. For example: database, the usual use of apps, games and so on.
The comparison of structured method and object-oriented method in software development