Both the structured approach and the object-oriented approach are the systematic methods used to guide development activities when developing software. There is a connection between the two, but there is also a big difference.
First, the method of construction
The concept of structured programming was first developed by Ezra · W. Dijkstra (Edsger wybe Dijkstra) proposed, after by Larry, Michael, Tom and other people to improve, and finally formed a structured method of this complete software development and development system.
The structured approach is a process-centric approach that consists of a structured analysis (SA), a structured design (SD), and a structured implementation (SP) consisting of three parts (another is the SA and SD). The basic idea is to decompose the complex application problems of the real world in stages, and to solve the problem space of process design, emphasizing the top-down, decomposition-by-layer refinement and modularization design. The issues that are dealt with at each stage are within the scope of what people can easily understand and deal with.
Method steps:
- Structured Analysis SA
(1) Analyze the current situation and make a flow chart (DFD) that reflects the current physical model;
(2) to derive the equivalent logical model of the DFD;
(3) Designing a new logic system, generating data dictionary and primitive description;
(4) Establishing the human-machine interface and proposing a DFD for the physical model of the target system;
(5) Determine the cost and risk level of the various programmes and analyze the various programmes accordingly;
(6) Choose a scheme;
(7) Establish a complete demand specification.
2. Structural design of SD
(1) Review and refine the streaming chart;
(2) Determine the type of the streaming diagram;
(3) Mapping the diagram to the software module structure, design the upper layer of the module structure;
(4) Gradually decompose the high-level module based on the flow graph, design the lower layer module;
(5) Optimizing the structure of the module to obtain a more reasonable software structure;
(6) Describe the module interface.
3. Structured implementation of SP
(1) Coding: According to the requirements, choose the appropriate language and compile the environment with the code to implement the design, while ensuring the simplicity of the code, legibility, and efficiency;
(2) Test: In order to find errors in the program, in the development process, according to the specifications of each stage and the internal structure of the program to design the corresponding test cases, and constantly test the program, to ensure the coverage of test cases;
(3) Debugging: In the test found errors after debugging to determine the cause and location of the error and correct.
Ii. Object-oriented approach
The object-oriented method is the same as the structured method, which originates from the programming method. The object-oriented originated in Simula, which was laid down by Smalltalk, and finally completed under the continuous improvement of people.
The object-oriented approach, as its name, is an object-centric approach, consisting of object-oriented analysis (OOA) and object-oriented design (OOD). The basic idea of object-oriented approach is to use the concept of the real world to think abstractly and solve problems naturally. Emphasis is placed on simulating concepts in the real world without emphasizing algorithms or processes and supporting reuse.
Basic concepts:
Object-oriented methods have many concepts that differ from structured methods.
Object: An object refers to anything that is to be studied. From a book to a library, a single integer-to-integer database, an extremely complex automation plant, and a space shuttle can all be seen as objects, not only to represent tangible entities, but also to represent intangible (abstract) rules, plans, or events. An object consists of the data (the attributes that describe things) and the actions that are used for the data (the behavior that manifests things) as an independent whole. From the programmer's point of view, the object is a program module, which, from the user's perspective, provides them with the desired behavior. Internal operations are often referred to as methods. The way an object requests another object for its service is by sending a message.
Class: A class is a template for an object. A class is a definition of a group of objects that have the same data and operations, and a class contains methods and data that describe the common behavior and properties of a set of objects. A class is an abstraction on top of an object, which is the materialization of a class and an instance of a class. A class can have its subclasses, or it can have other classes that form a class hierarchy.
Message: A message is a specification of the communication between objects. Typically it consists of three parts: the object that receives the message, the name of the message, and the actual variable.
Inheritance: Subclasses obtain all members and methods of the parent class from the parent class.
Method steps:
1.OOA
(1) Determine the problem area;
(2) district classification and object;
(3) Distinguish the whole object and component, determine the relationship and structure of the class;
(4) Defining attributes and services;
(5) Determine the additional system constraints.
2.OOD
(1) The result of the machine and the perfect system analysis;
(2) Design interactive process and user interface;
(3) Design task management, subsystems and the coordination between tasks;
(4) Designing a global resource you determine the resource allocation for a task or subsystem
(5) Object design.
Method Properties:
Object-oriented approach as a new software development method also has some new features
1. Encapsulation
Encapsulation is an information concealment technique, which is embodied in the description of the class and is an important feature of the object. Encapsulation makes the data and the method (function) of processing the data encapsulated as a whole, in order to achieve a very independent module, so that the user can only see the external characteristics of the object (the object can accept which messages, with those processing power), and the object's internal characteristics (the preservation of the internal state of private data and the implementation of processing capacity algorithm) is The purpose of encapsulation is to separate the use of the object's designer from the object, and the user does not have to know the details of the implementation of the behavior, but only accesses the object with the information provided by the designer.
2. Inheritance
Inheritance is the mechanism by which subclasses automatically share data and methods between parent classes. It is represented by the derivation function of the class. The entire description of a class directly following the other classes can be modified and expanded.
Inheritance has transitivity. Inheritance is divided into single inheritance (a subclass has only one parent class) and multiple inheritance (a class has more than one parent class). The objects of the class are closed, and if there is no inheritance mechanism, the data and methods in the class object will be duplicated a lot. Inheritance not only supports the reusability of systems, but also facilitates the extensibility of the system.
3. Polymorphism
The object is acting according to the received message. When the same message is accepted for different objects, it can produce completely different actions, known as polymorphism. The use of polymorphic users can send a common message, and all implementation details are left to the object receiving the message, so the same message can invoke different methods. The implementation of polymorphism is supported by inheritance, with the hierarchical relationship of class inheritance, the protocol with common function is stored at the highest level of class, and the different methods of implementing this function are placed at a lower level, so that the objects generated at these low levels can respond differently to generic messages. Polymorphism can be achieved in OOPL by redefining a base class function (defined as an overloaded function or virtual function) in a derived class.
Iii. similarities between structured methods and object-oriented approaches [1]
1. Decomposition and abstraction
Decomposition and abstraction are important principles in the complexity of control problems in software development. Decomposition of the whole score 0, the problem silking, layer digestion, abstraction is through decomposition, in the decomposition, the upper layer is the lower level of abstraction, the lower layers are the specific interpretation and embodiment of the upper layer, the use of abstraction can not consider too much detail, and gradually have a plan to learn more details. Object-oriented methods and structured methods are fully consistent in the application of decomposition and abstract principles.
2. Localization
Localization is an important principle in software development, that is, you do not want to involve too much of the software in or affect other parts of the software. In the structured method, localization is mainly embodied in the separation of code and data, that is, the program parts in addition to the necessary information exchange, each other apart from each other, and the object-oriented approach is the data, code encapsulation, the data, code and operation methods are packaged into a similar "black box" of the whole object, It improves the reliability and security of the program, and enhances the maintainability of the system. This means that the object-oriented approach is more thorough than the structured approach.
Four, the difference between the structured method and the object-oriented method
1. The point of view for dealing with problems
The structured approach, as mentioned above, is a method of emphasizing the process, which decomposes the problem into process abstraction, modularity to solve the problem, and an object-oriented approach that abstracts the problem into one object.
2. Basic unit
The basic unit of a structured approach is the module, which represents the relationship between the modules, and the basic unit of the object-oriented approach is the class, which represents the relationships between the classes through inheritance and implementation.
3. Impact of the basic unit on the whole
In a structured approach, if there is a problem with a module, the whole process will be affected, unless a thorough inspection is performed, the problem cannot be located. In the object-oriented approach, the problem of the single class has a relatively small impact on the whole software, and is easy to locate.
4. Re-usability
Software developed using a structured approach is difficult to modify and expand after it is completed. The system interface has been defined in structural analysis, and when it comes to changing interfaces, the structure of the system often needs to be drastically changed, and the software for object-oriented method development can be done simply by using inheritance.
[1]http://wenku.baidu.com/link?url=xupunm5bnpsmrrsjj0oflw0qtkqwnwipbzshi8ij-2lynrofaejepwbboasfq_ Mjzs3hmdxsfjooeusimpjht_fbfzrpa9gm_8izjdhjc93
Comparison between structured method and object-oriented method