Introduction and comparison of structured method and object-oriented method

Source: Internet
Author: User

Introduction and comparison of structured method and object-oriented method

Structured and object-oriented, these two concepts are widely used in the field of computer. In software engineering, the thought of structure and object-oriented also occupies an important position, resulting in a structured approach and an object-oriented approach to guide the production of software.

I. Structured approach

Structure refers to the framework of the interaction and interaction between each constituent element in the system. The structural method emphasizes the reasonable structure of the development method and the structure rationality of the software developed. For the different stages of software life cycle, it can be divided into structural analysis (SA), structured design (SD), structured programming (SP) and so on.

1.1 Structural analysis methods

The structural analysis method is a data-oriented analysis method, which was put forward and developed by Yourdon, Constaintine and DeMarco in the 70 's, and has been widely applied, and its basic idea is decomposition and abstraction.

The design principles of structured analysis methods are:

(1) make each module as far as possible only one function (adhere to the functional cohesion);

(2) Each module calls other modules with the procedure statement (or function mode, etc.);

(3) The parameters transmitted between the modules for data use;

(4) The information shared between modules, such as parameters, and so on as little as possible.

Among the structured analysis methods, the commonly used tools are:

Streaming chart

Data Flow Diagram, or DFD, is a graphical tool that describes a system's logical input and logic output, as well as the processing required to convert logic inputs into logical outputs. Usually, a DFD diagram of a system is layered, making the process of data processing more hierarchical and logically clearer. the design principle of DFD diagram is: Data conservation and data closure principle, processing decomposition principle, sub-graph and parent graph balance, reasonable use of files.

Data dictionary

Hierarchical data flow diagram only expresses the system's "decomposition ", in order to fully describe the system, but also with the help of "dictionary" to explain each data and processing in the graph. A collection of definitions of all the elements contained in the data flow diagram forms a dictionary of the database. It has four categories of entries: Data flow, data items, files, and basic processing. When defining a data flow or file, use the symbols given in the following table to organize the entries into a data dictionary according to certain rules.

With the help of the above tools, we can carry out a complete structural analysis, a typical structural analysis process is:

① 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.

1.2 Structured Design method

The structured design (structured, SD) method is the most widely used design method, which is suitable for the overall design and detailed design of the software system, especially the transformation of a complex system into a modular structure system, which has the advantage of this method. The structured design approach has the following characteristics:

Relatively independent, single-function modular structure

The basic idea of structured design is to design the system into a structure composed of a plurality of relatively independent and functionally single modules. As the modules are relatively independent, each module can be individually understood, written, tested, misplaced, and modified , effectively preventing errors from spreading across modules, improving the quality of the system (maintainability, reliability, etc. ). Therefore, the work of system development and development is greatly simplified.

module Performance standard for "block contact large, small link between blocks"

"The module internal contact is big, the module links to be small ", this is the structure design in the measurement module "Relatively independent " performance standard. In fact, intra-block linkages and inter-block linkages are two aspects of the same thing. The components of the system are related to each other, if the closely related components organized in the same module, the block contact is high, the relationship between the block less natural. Conversely, if the closely related components scattered in each module, it is bound to cause very high inter-block connection, which will affect the maintainability of the system. Therefore, in the system design process must take the Structural design module performance standard as the guidance.

Using the description of the module structure diagram

A structured design method is described in the form of a control structure diagram (a module structure diagram).

The most common tools for structured design are:

Program Flowchart

Program Flowchart is a traditional, widely used software process design representation, usually also known as the program block diagram. The most basic graphic symbol that makes up the flowchart of a program is:

According to the structural program design requirements, the program flowchart is composed of any program can be described in 5 control structures, respectively:

(1) sequential type: Several successive processing steps are arranged in sequence.

(2) Select type: A logical judgment of the value of the decision to choose one of two processing.

(3) The first decision-type cycle: first to determine whether the loop control conditions are set up, the implementation of the loop body statement.

(4) After the decision-type cycle: Repeat some specific processing, until the control conditions are established.

(5) Multi-branch Select Type: List a variety of processing conditions, according to the value of the control variable, choose to perform one of them

Box Diagram (n-S diagram)

In 1973, American scholar I.nassi and B.shneiderman proposed a complete removal of the process line in the flowchart, the entire algorithm written in a rectangular array, in the box can also contain other boxes of the flowchart form. The box diagram has three kinds of basic control structure, which corresponds to the program flowchart.

Sequential structure

Branching structure

Cyclic structure as type cycle

Loop structure until type cycle

Ii. Object-oriented approach

The object-oriented approach (Object-oriented method) is a system approach that directs the development activities of the object-oriented idea to the software development process, or the OO (object-oriented) method, which is based on the object "Methodology based on concept. An object is a package of data and allowable operations that directly correspond to an objective entity, and an object class defines a set of objects with similar properties. Each inheritance is a way to share the properties and operations of classes that have hierarchical relationships. The so-called object-oriented is based on object concept, Object-centered, class and inheritance as the construction mechanism, to recognize, understand, depict the objective world and design, build the corresponding software system.

2.1 Basic Principles

(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 is almost as difficult as determining the correct set of abstractions, 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.

2.2 Features

(1) Emphasizing the integrity and global nature of system development

(2) focus on the process of data conversion rather than the data itself

(3) long development cycle of the system

(4) encapsulation

The concept of objects breaks through the separation of traditional data from operations. Objects act as independent entities, enclosing free data and operations to make their state and behavior localized.

(5) Inheritance

Inheritance is object-oriented and the most powerful mechanism. Class inheritance can compensate the problem of data or operation redundancy caused by encapsulated object, and realize software resource sharing, evolution and augmented expansion through inheritance support reuse.

(6) polymorphism

Sending the same message to different classes or objects can cause different operations, making software development and design more convenient and coding more flexible.

(7) Ease of maintenance

Object-oriented abstract encapsulation makes object information hidden locally. When the object is modified, or the object itself produces an error, the resulting effect is confined to the inside of the object without affecting the other objects or even the whole system environment, which greatly facilitates the software design, construction and operation of the process of detection of errors, modifications.

Three, the comparison and thinking of the two

I think that the structured approach is primarily about one thing, which is also the main difference between a structured approach and an object-oriented approach, because the object-oriented approach is for a single object and class. This embodies two different ways of thinking about the problem. The former seems to embody a precise, rigorous logical thinking, the latter is more close to the nature of the analysis. The structure method is easy to use, the various modules are convenient and efficient, while the object-oriented method is more troublesome than the former. So for small projects, our best choice is a structured approach. When the scale of the project grows up, the flexible and independent features of each module in the structured approach make them difficult to manage, whereas the object-oriented approach attaches particular importance to the management of functional methods, and this management uses the way that is close to human nature thinking, so it is more convenient to use. Therefore, in larger projects, the structured approach is less object oriented.

Introduction and comparison of structured method and 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.