The comparison between the structured method and the object-oriented method

Source: Internet
Author: User

Introduction

  The so-called software development method, is to meet in the limited project investment, development time, as far as possible to design, achieve the user requirements and high-quality software proposed by the development strategy, according to these strategies to the entire software development process to become more scientific and systematic. Of course, there are a variety of system analysis and design methods in the field of software development, but the structure method and object-oriented method are the two core ideas in software development programming.

The structure method originates from the 1960s to the argument and the cognition of Goto statement, after decades of research and application, the most mature and the most influential, and object-oriented method has developed rapidly in the past 10 years, and is widely used in various fields of computer software.

The core idea of the structured method is the top-down (refinement) and modularization design (structured coding), which is divided and simplified from the original problem, and finally divides the problem into relatively independent multiple small problems, then programming in the form of modularization, and the object-oriented method is object-centric. The abstraction of the various transactions involved in the problem is decomposed into multiple objects, and the problem exists in the interaction and association between objects, which is manifested by the behavior of the object.

Structured approach

Overview

The Structured method (SD method) is a mature and traditional software development method. Its components include structured analysis (SA), structured Design (SD), and structured programming (SP), which correspond to the analysis, design, and coding phases of the software life cycle, respectively. The basic idea is to carry out the process of solving a complex problem in stages, and this decomposition is from top to bottom, decomposition by layer, so that the problems of each stage are controlled in the scope that people can understand and deal with easily.

Here, a classic graph is borrowed to represent the process of top-down decomposition:

Figure 1 Top-down decomposition example diagram

Structured analysis

The basic idea of structural analysis is "decomposition" and "abstraction", and finally the result of decomposition and abstraction is expressed by graph of data flow chart, database dictionary, decision table and decision tree. Here are three of the most--data flow diagrams, datasheets, and structure diagrams.

streaming Diagram (DFD )

Data flow Diagram, or DFD, is a common graphical tool to describe the flow of information in a system, graphically expressing the logical functions of the system, the logical flow of data within the system, and the process of logical transformation.

There are several main elements in the data flow diagram:

→: Data flow. A data stream is a path of data propagation within a system, and therefore consists of data fixed by a set of components. If the booking is made by the passenger name, age, unit, ID number, date, destination and other data items. Since the data flow is a flow of data, there must be a flow, in addition to the data stored between the data flow is not named, the data stream should be named with a noun or noun phrase.

-: Data source (end point). Represents an entity outside the system, which can be a person, thing, or other software system.

0: processing (processing) of the data. Processing is a unit of data processing, which receives certain data input, processes it, and produces output.

: Data storage. Represents the static storage of information, which can represent a file, a part of a file, an element of a database, and so on.

Also, for structural and modular requirements, the streaming diagram should be drawn in a hierarchical form. The method is as follows: 1, determine the input and output of the system, 2, the top-level flow chart of the system, 3, from the top down by layer decomposition, draw a hierarchical flow chart.

is an example of a typical streaming diagram:

Figure 2 Example of a data flow diagram

Data dictionary (DD )

Data Dictionary, or DD, refers to the definition and description of data items, data structures, data streams, data stores, processing logic, external entities, etc., and is intended to give a detailed description of each element in the data flow diagram.

The layered data flow diagram above only expresses the system's "decomposition", in order to fully describe the system, but also with the help of a dictionary of the graph of each data and processing to explain.

Figure 3 Data Dictionary sample diagram

With these presentation tools, we can summarize the analysis steps as follows:

① analyzes the current situation and makes a flow chart (DFD) that reflects the current physical model;

② deduces the equivalent logical model of the flow chart (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.

Structured design

Structured analysis completes the (requirements) analysis part of the software development cycle and knows what to do in the software development phase. Then it should be structured design (SD) to design the whole software project, describe the whole system design ideas and framework, understand how to develop the software.

The important purpose of structured design is to modularize the software project, so we need to introduce the module structure diagram first.

structure diagram (SC )

A structure diagram is a diagram that splits the system into a minimal manageable program unit. In structured design, the program module can be organized into a tree structure, each module is represented by a box with the module name, the tree structure can clearly represent the relationship between the modules.

Structural diagrams commonly used in structural analysis represent the top-level architecture of programs. The structure diagram helps the programmer to deal with the software problem in a broken way, that is, the problem will always be disassembled to a smaller problem until the final question is so small that it can be understood by humans. This program is called top to bottom design or function decomposition. The structure diagram acts like a blueprint used in building houses. In the design phase, the structure diagram is the way customers communicate with different software engineers. In the code implementation phase, the structure diagram can be used to learn the complete architecture of the system.

Figure 4 Example of a structural diagram

The basic idea of structured design is to construct the structure diagram (SC) based on the structured analysis method, so as to use the program structure to reflect the structure that needs to solve the problem. Of course, the structure chart obtained at this time is only a preliminary structure diagram, and the structure diagram should be further optimized according to the basic principles of structural design and relevant heuristic rules.

Structured programming

Structured programming (structured programming, SP) is divided into functional modules by structured design, the top-down decomposition of tasks, and the allocation of the corresponding developers, the development process generally requires only the use of order, selection, cycle three basic structures. In this way, developers do not need to consider the overall software project, but only need to analyze their own development of the part, which facilitates the detailed testing of the unit module, but also good to ensure the quality of software development.

Object-oriented approach

The starting point of object-oriented is to simulate the way of thinking of human beings as much as possible, and to make the software development process closer to human understanding and problem solving. In order to achieve this, the object-oriented approach supports its development method by introducing the concepts of object, class, encapsulation, inheritance, polymorphism, breaking the traditional code and data separation practices, and bundling a data structure and the method of manipulating this data structure together, encapsulating in a program, realizing the encapsulation and information hiding, through the " Operation as an interface for the delivery of information. To the outside, only know "what does it do", and do not know "how it is done", so that the data encapsulation, information hiding, abstract code sharing and other software engineering ideas are fully reflected.

The object-oriented approach (object-oriented) includes three parts of object-oriented analysis (OOA), Object-oriented design (OOD), and object-oriented programming (OOP).

Object-Oriented analysis (OOA )

The first part of object-oriented approach in object-oriented analysis, the task of this part is to set up the whole object-oriented software development base by abstracting the problem and the understanding of the project into normative object and message passing. This part of the general is more difficult for beginners, because it is necessary to adapt to the change of the corresponding thinking. At the beginning of the last semester's OO course, you should be able to feel that it is difficult to accurately classify the objects in the problem correctly, but after adapting to this type of thinking, it is easy to abstract the problem when dealing with other problems.

In general, OOA is based on the three concepts of encapsulation, abstraction, polymorphism.

Packaging

In an object-oriented approach, data and corresponding operations are bundled together by encapsulation mechanism to form a complete data type with attributes (data) and behavior (operations). This makes it possible to describe something in terms of data and operations in two ways, more in line with the thinking habits that people describe something, and therefore easier to understand and achieve.

Inherited

Inheritance allows a type to obtain another type of property (member variable) and a simple way of behaving (member functions). Inheritance, like evolution in the real world, inherits subtypes that can have properties and behaviors of the parent type, and can add new properties and behaviors that are specific to subtypes. This greatly improves the efficiency of development, which is difficult to achieve with traditional process-oriented development.

Polymorphic

Polymorphism is the direct result of inheritance. However, although inheriting the properties and behaviors of the parent type, there are different objects, there are various actions, so the object-oriented method realizes the polymorphism of the object by giving the "same behavior" of the different classes to the interface calls.

With the above three, OOA through the five levels (subject layer, object layer, structure layer, attribute layer and service layer) on the abstraction, complete the analysis of the problem, and finally get the abstract structure of the problem.

Object-oriented design (OOD )

OOA and OOD adopt consistent concepts, principles, and representations, and there is no gap between them, unlike the structured approach described above, from OOA to OOD without the need to convert from analytical documents to design documents. There is no obvious boundary between them, and there may even be some degree of intersection.

The difference between the two is mainly: OOA is more related to the problem domain of the system, the OOD is closer to the system, and OOD is the direct refinement and abstraction of the object model obtained by OOA, and the class diagram can be realized directly.

Through the preliminary analysis of Ooa we got: the problem = object + class + inheritance + message passing , while ood further transitions, The result of OOA analysis is further normalized so that it can be accepted directly by OOP.

Object-Oriented programming (OOP )

OOP is one of the most popular development methods in recent years and has shown great power in practical applications.

OOP achieves the three main goals of software engineering: reusability, flexibility, and extensibility. Through the design of the interface, the whole operation is realized, each object can receive the information, process the data and send the information to other objects. OOP mainly has the following main concepts:

Components: Data and functions together in a running computer program formed in the unit, the component in the OOP computer program is a modular and structured basis.

Abstraction: The program has the ability to ignore certain aspects of the information being processed, namely the ability to focus on the main aspects of the information.

Encapsulation: Ensure that the component does not change the internal state of other components in an unpredictable way, and that only those components that provide an internal state change method can access their internal state. Each type of component provides an interface that is associated with other components and specifies the method by which other components are called.

Polymorphism: Component references and class gatherings involve many other types of components, and the result of referencing a component depends on the type of actual invocation.

Inheritance: Allows the creation of subclass components based on existing components, which unifies and enhances polymorphism and encapsulation. Typically, a class is used to group components, and it is possible to define a new class as an extension of an existing class, so that the class can be organized into a tree or mesh structure, which embodies the versatility of the action.

The above four concepts focus on the angle of the system implementation, and the concept of the OOA segment is not exactly the same.

Comparison of object-oriented methods and structured methods

First, the object-oriented approach is unique compared to the traditional structured approach:

1) reusability. Reusability is a core idea of object-oriented software development. Through the inheritance of the class, the common features can be shared, the creation of objects and classes is simplified, and the weight of the code is increased. In addition, the reuse of tested code can also minimize the likelihood of generating additional errors.

2) Extensibility. Scalability is another important requirement for modern application software. The inheritance of classes enables classes to reflect the hierarchical structure of the real world, and polymorphism reflects the complexity and diversity of the real world. The inheritance and polymorphism of the class make the software coding have good reusability and expansibility. Software functionality can be easily expanded and modified without the need to modify the source code.

3) Data protection. The algorithms for data and operational data are no longer separated, they are encapsulated together, and the behavior implementation details inside the object are hidden. Encapsulation prevents the change effect of program interdependencies.

4) Manageability. The object-oriented development method adopts the class as the component of building the system, takes the object as the basic constituent unit of the system, makes the whole project organization more reasonable and convenient, because induces the thing, divides the class to carry on the management conforms to the people in the cognition and the management objective world the customary thinking way.

However, there are some drawbacks to the object-oriented approach and the structured approach:

1) slow to get started. When a novice is exposed to an object-oriented approach, it is often difficult to accurately decompose the problem into relationships between multiple classes. And even after a period of training, it is difficult for some of the more complex problems to be accurately described by the passing of information between classes and classes.

2) Recognize differences. For a similar problem, it is difficult to have a deterministic division, so there will be different designers of classes, classes, the understanding of the connection between the inconsistent, and this inconsistency is difficult to express in a unified way, which may lead to late-stage object-oriented programming oop in the process of divergence.

3) Ease of programming. In the process of writing, the structure of the method has a relatively strong advantage, it is clear-minded, methodical, clean steps, easy to read comprehension. This is also a lot of enterprise development projects in the first through the object-oriented approach to analysis and design, and then through a modular, structured way of software development reasons.

Summarize

The development of programming method has undergone four generations, and after several decades of change, the structural method and object-oriented method become the most essential methods in the program design of modern software engineering, which is sufficient to embody the superiority.

The structured method embodies the basic principle of abstract thinking and complex problem solving, and the object-oriented is a profound reflection of the essential characteristics of the objective world composed of objects. An important difference between the various programming methods is that the starting point of the problem decomposition is different (factor) and the thinking mode is different. The data structure and process are closely related in the computer, and the structured method considers the structure and process separately, and the object-oriented method is composed of the object and the process. In theory, the object-style method will produce better module cohesion and coupling characteristics, make the software easier to reuse and maintain, but in practice the programming method needs tools and environment support, need to consider all aspects of software life cycle, in the selection of programming methods, need to consider these factors, Choose one of them or use them synthetically.

Finally, a jest is used to describe the difference between the two: the structured approach is chronological; The object-oriented approach is biographical.

Resources:

[1] Wikipedia, structured approach, object-oriented approach

[2] Baidu baike, structured approach, object-oriented approach

[3] Fu Yujiang. A comparison of structured methods and object-oriented methods in program design [A]. Hainan: Computer knowledge and Technology, 2008

[4] Wang Hanhao. A comparison of the methods of software development with the method of structure and object-oriented methods [A]. Sichuan: Science and technology information, 2011

The comparison between the structured method and the object-oriented method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.