Structured approach vs object-oriented approach

Source: Internet
Author: User

Structured Approach
    • What is a structured approach

By looking through the Web, I got this definition:

Structured Analysis Method (Structured Method) It is a software development method that emphasizes the rationality of the development method and the structure of the software developed.

the rationality of the structure is constrained by the interrelated and interacting framework of each constituent element in the system. The function of structured development method is to put forward a set of criteria to improve the rationality of software structure, such as decomposition and abstraction, module independence, information concealment and so on. It can be divided into structural analysis (SA), structured design (SD)for different stages of the software life cycle.

    • Streaming Chart ( DFD):

you have to say something about data flow. DFD). Its essence is a set of data, and the flow of data shows the transmission and processing of data, and expresses the logical flow of data and logical transformation.

Here is a streaming chart:

which

→: 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 or Homestay ("Homestay" represents the end point of the data). 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.

    • Structured Analysis ( SA): 

First of all, the structural analysis method, which is a kind of data flow, top-down, layered decomposition, the establishment of a system of processing flow, data flow chart and the database as the main tool, the establishment of a logical model of the system.

In the structural analysis, we need to make its flow chart according to the actual situation, to remove the non-essential factors to establish a logical model, and finally continue to improve until confirmed to meet the needs of users.

our website system uses the structured method, the cloud uses the structure analysis, our website is obtains the data from the front end to the back end processing completes then returns the front end, this is a very clear data flow, therefore the needle for such function demand, we determined uses SSH framework structure, so that in different data processing stage, we can be targeted at this stage of the functional requirements of writing, logic clearer.

    • Structured Design ( SD):

the previous phase was established. DFD, this phase requires a refinement of the streaming diagram to determine the type of the streaming diagram. After that, the diagram is mapped to the module structure of the software, which decomposes the high-level module and the middle-lower module. Finally, the module structure is optimized to obtain a more reasonable software structure and interface of the design module.

in the in the framework of SSH, the request can be distributed through Spring , so we only need to write the Controller and Service Layer to process the data, as for the acquisition of data, we flow out of the interface to get the data, in the Mybatis framework used, as long as the mapping configuration file corresponds to the interface, Can complete the data acquisition, is very convenient, the design process of the combination of framework and interface can greatly reduce the workload of developers.

Object-oriented methods:

The object-oriented approach believes that we are familiar with the concept of using the real world to divide the system into different objects, through the inheritance of objects, calls and other ways, in a relatively and real-world approach to solve problems in a way close to the problem.

pin for object-oriented approach modeling techniques, the most important of which is the class diagram ( UML), this sophomore object-oriented course has also been painted, the following is an excerpt from our project of a class diagram:

  

This includes the invocation relationship of the class. Visible the Controller class invokes the service class , and the service class calls the DAO class,whichDAO The following three entity classes are used by Le seed, which is the invocation relationship of the class of one of the processes.

    • Object-oriented development process:

The first thing you need to do is object-oriented analysis ( OOA), at this stage we need to determine which class the model needs to abstract, this can start from the actual division, taking the previously written elevator system as an example, the elevator is a separate class, and its scheduling function, operation function, printing function can be considered as different classes to divide.

We then need to determine the relationships between these classes, define the properties in the class, and provide the method that gives the constraints. Elevator system, for example, the elevator is the end of the class, he can have their own motion method, the location of the floor properties, open door properties, etc., but these properties will have other functional classes to modify, its motion method will be dispatched by the scheduling class to complete the elevator scheduling.

you can then work on the design ( OOD), we need to give the interface that the system interacts with the user based on the previously designed class, and the interface between classes and classes. In the elevator system, this is reflected in our input and output, you can do a GUI interface to standardize the user's input.

Finally, we need to design the coordination relationship between these classes, and design the global resources, and finally use the object to complete the corresponding functions. For a multi-threaded elevator, there is no direct scheduling relationship between different threads, so we need to set some global properties to standardize the scheduling of multi-threaded elevators, so that different threads can access to modify these global variables, so as to complete the coordination between the threads.

Compare the two:

Both development methods have their own strengths, personally, I am more inclined to object-oriented development, and this development method I also use more. So I'll start by talking about the advantages of an object-oriented approach to development.

    • Closer to the problem model in the real world. As an example of a typical object-oriented applet for an aircraft war, we can divide the aircraft, bullets, and controllers into three different objects and complete the design of the game through a direct logical judgment of the three objects. In comparison, if we try to use a structured approach to analyze this program from the perspective of a streaming diagram, it will feel impossible to begin with. This reflects the advantages of object-oriented design, and it is easier for us to design the model from the reality.
    • The code has a lower degree of redundancy. In object-oriented development, we can implement different functions to different objects, such objects can reuse the same function in the program. In contrast, if you use a structured design, if we modify a feature, then you might want to modify each part of the process that is relevant to that function, so that the code workload is much more than the object-oriented design.

Of course, structural design also has its advantages, and I think the object-oriented design method in the structural design also has a lot of applications.

    • easy to design reusable frameworks. For example , the SSH framework we're using now, I think this is a structured design application that gets the data from the front end to Spring for distribution, then internally, and finally through hibernate perform data operations on the database. However , in fact, Spring 's management of JavaBean is also an object-oriented management method, so it is no problem to use object-oriented design in structured design. Because of the certainty of the process, it is easy to design a framework to complete a structured design. For object-oriented design, there are few frameworks that can be used directly because of the uncertainty of objects. Therefore, the advantages of structured design at this time.
    • more suitable for the development of the system. For example, the review site, which we are now doing, is a structured design and uses the framework of SSH . The development of the system generally has the certainty of the process, so we can find a lot of high-quality frameworks available, which greatly reduces the workload of developers, and we can do different processes are independent of each other, so if you want to modify a function, you only need to adapt to the process of this function to modify it, This is also more convenient.

I think the object-oriented approach to development and structured designers complement each other, in software engineering, we often use structured design, but the structure of the method will actually use the object-oriented design method, so that the two complementary advantages, can greatly enhance the productivity of developers.

Reference Documents:

Research and application of software structure design based on frame technology --- Zhongshan University, Xu Zhihao

Baidu Encyclopedia - Structured design

Http://baike.baidu.com/link?url= Tlhxj5zu4e9h9iwmtfxcqykxoeo9esmrqui-szd9fc5y8wf2tvtknu71ro3fmld9z06qzqgtwn9ocrt_ Ifmphn1kgeo0ilm8v6o67tfjawhhwtxrzhhw9be-e1tqcodzhafpm1gfdkatqbkmtrqeqa

Sina Blog http://blog.sina.com.cn/s/blog_62b8fc3301013rm7.html

Structured approach vs object-oriented approach

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.