Structured approach and object-oriented approach

Source: Internet
Author: User

Structured approach and object-oriented approach

A Structured approach

1.1 Overview of Structured methods

The structure method originates from the structure programming, has the function-oriented, the structure is clear, supports the gradual refinement and so on the characteristic, makes the software easy to maintain. In the application of structured development methods, designers first need to use the abstract (abstraction) method to describe the problem at the highest level of the solution, after the designers in the gradual refinement (refinement), that is, through the gradual refinement of the structure of the final solution to the problem, In this process, the information inside each structure is invisible to the outside, that is, information hiding.

1.2 Origins of the structured method

  In the late the 1960s, programmers found that the software development cycle and the quality of the software is not clearly proportional to the existence of the relationship, then our programmer began to explore a more mature and reliable software development method, wherein: The structure becomes the "leader" at that time.

As a sculpture, when Michelangelo put David in front of the world, people will marvel at his refinement and vitality, but: Michelangelo at the beginning of his creation in the heart of the construction of David's full picture, so as to ensure that the framework of the direction and correctness. The structure method is so, in the design process emphasizes: from top to bottom, gradually refinement, modular design and other principles. When our programmers know the full picture of the software to be completed, they can brush the night, but in the process of implementation, because the overall framework has been built, so the details of the programmer's attention to the global construction moved to a lower layer of the design, simply speaking, is to dissect the problem by layer, gradually down the details.

Characteristics of 1.3 structured method

structured method based on functional decomposition design system structure   , it simulates the objective world from the internal function. The main tool used is the dataflow diagram DFD. Simplify the problem by continually decomposing the complex processing of the DFD into a sub-flow diagram.

Advantage: The structure method can increase the readability of software specification and the reliability of software system. the flow chart is easy to understand and facilitates the communication between developers and customers.

Disadvantage: The software system structure is very sensitive to the change of function , and the function change often means redesign. The design of software is difficult to reuse, delaying the development process.

Two Object-oriented approach

2.1 Overview of Object-oriented methods

Object-oriented ( object+oriented, or Oo) method is the general term of a kind of method which is guided by the object-oriented thought to develop the system. This kind of method takes the object as the center, takes the class and the inheritance as the construction mechanism to abstract the real world, and constructs the corresponding software system.

2.2 Characteristics of object-oriented methods

  In the software system constructed by object-oriented method, any element in the software is an object, and the complex software object is composed of relatively simple software objects, and the objects can only be connected with each other by passing messages. Using object decomposition instead of traditional function decomposition. Divides objects into object classes, each of which defines a set of data and a set of methods. According to the relationship between the subclass and the parent class, several object classes are composed into a hierarchical system.

Encapsulation: The data and implementation of the code of the operation is placed inside the object, can not be directly accessed or modified from the outside. Inheritance: A subclass can directly acquire the properties and attributes of a parent class without having to redefine it.

Polymorphism: A technique that allows a parent object to be set equal to one or more of its sub-objects, allowing each object to respond to a common message in a way that suits its own. That is, sending the same message to a different type of object can lead to a completely different behavior.

2.3 The process of object-oriented methods

2.3. 1 Object-oriented analysis (OOA):

The Ooa method is an analytic method that combines the concepts in the entity-Relationship diagram with the main concepts in the programming language. In this method, the concept of information model analysis, such as entity, relation and attribute, is adopted, and the concepts in object-oriented programming language such as closed, class structure and inheritance are adopted. Its 5 basic steps for ① determine the problem domain ② area Classification and object ③ distinguish the whole object and the components ④ define attributes and Services ⑤ determine additional system constraints

2.3.2 Object-oriented design (OOD):

The design phase is mainly to determine the implementation of user requirements , that is, how to meet the needs of users, and construct a blueprint for the implementation of the system. Ood first begins with the results of OOA and maps it from the problem domain to the implementation domain, adding classes, structures and properties and services to meet the needs of the implementation, and adjusting the original classes and attributes. In addition, to complete the application control, human-computer interface design and so on. OOA and Ood Adopt a consistent representation, so that there is no conversion from OOA to Ood, only local modification or adjustment, and added independent parts related to the implementation, therefore, there is no gap between the analysis and design of the traditional method between Ooa and Ood, which becomes the main advantage of the object-oriented method.

2.3.3 Object-oriented programming (OOP):

This is a computer programming architecture. one of the basic tenets of OOP is that a computer program is composed of a single unit or object that can act as a subroutine. OOP achieves the three main goals of software engineering: reusability, flexibility, and extensibility. To achieve the overall operation, each object can receive information, process data, and send information to other objects.

three . Comparison of two types of methods 3.1 Conceptual Comparisons3.1.1 Modules and Objects

The module in the structured method is a data processing unit, which can accept certain input and produce corresponding output, which is a purely functional entity. An object in an object-oriented approach can also accept input and produce output, but it can also store data as a whole of data and operations. Thus, an object is an abstraction and unification of data and functionality, and its concepts include the concept of a module. With the object, the program effect can be achieved more than the use of modules to enrich a lot of, therefore, the design of the object than the module a more brilliant point.

3.1.2 Procedure calls and message passing

 In a structured approach, a process is an independent entity that is explicitly seen by its users; the procedures and functions involved in a procedure call belong to a program entity. In object-oriented programming, the method is subordinate to the object, it is the function of the object, it is an entity that cannot exist independently, and the message passing between different objects is the interaction between different program entities. It can be said that the program entities in object-oriented design are loosely coupled, while structured entities are tightly coupled. In a structured design, the same argument is called, and its structure is the same. However, in object-oriented message passing, the delivery of the same message may produce different results, which is the embodiment of the object-oriented method polymorphism.

3.1.3 Static connection and dynamic connection

 In the object-oriented approach, the activation mechanism of the message dynamically links the different objects together to make the whole organism work. The modules in the structured approach can only be executed sequentially in accordance with the code that was originally written.

Comparison of basic principles of 3.2

3.2.1 structured methods follow the basic principles of:

(1) Abstract principle: It is the basic principle that all systems scientific methods must follow, it pays attention to grasping the essential content of the system, ignoring the content which is irrelevant to the current goal of the system, it is a kind of fundamental cognition process and thinking way.

(2) Decomposition principle: is the most basic principle of the structure method, it is a general after the local principle of thought, in the construction of information system model, it adopts top-down, layered solution method.

(3) modularization principle: The concrete application of the most basic decomposition principle of the structured method, which mainly appears in the structural design stage, the goal is to decompose the system into several modules with specific functions, thus accomplishing the functions specified by the system.

3.2.2 Object-oriented methods follow the basic principles of:

(1) Abstract: Abstract refers to the practice of discarding individual, non-essential features in the object, and extracting the common essential characteristics. The advantage of using abstraction: one is easy to access, the external object only need to know a limited number of operations (interfaces) to access the object, and the second is easy to maintain, if the program internal changes and its interface does not change, it only need to modify its internal.

(2) Classification: The role of classification is to classify the categories of things according to a certain principle, so as to help to understand the complex world. In object-oriented classification, objects with the same properties and methods are transformed into a class, and classes are used as abstract descriptions of these objects. Classification is actually a form of expression that applies abstract principles to object descriptions.

(3) Encapsulation: In object-oriented encapsulation is to use the object to attribute and manipulate these attributes of the operation of packaging, forming a separate entity unit, reflecting the relative independence of things. Another implication of encapsulation is information concealment, that is, the outside world can not directly access the object's internal properties and hidden internal operations, the outside world does not need to know the internal implementation details of the object operation.

(4) Polymorphism: An operation or property with the same name can be defined in a class hierarchy with an inheritance relationship, but these properties and operations have different meanings, that is, they have different data types or behave differently.

Comparison of 3.3 program design ideas 3.3.1 Structured approach

The design of structured method is biased to the process, in its basic guiding ideology, a complete program is composed of two parts of algorithm and data structure, the work of developers is to realize the content of these two parts, and make the connection between them in proper way, and realize the desired program function.

In the concrete design process, the structured method follows the design idea of bottom-up, that is to design the bottom module, determine the internal algorithm of the module, design the internal program of the module, and carry on the unit test. After the module is completed, the module is assembled and the module is integrated. A validation test and system test are then performed to complete the design and commissioning tasks.

3.3.2 Object-oriented approach

  For the object-oriented method, the only composition is the object, and the relationship between the objects forms the basic framework of the program. Because the object is a unified entity of data and functions, developers need to implement the data structure and algorithm inside the object, but it is obviously more difficult to achieve than a complete program is much smaller. Then the focus is to coordinate the communication between the objects, so that they can work together to achieve the desired results.

Contrary to the structured approach, the object-oriented approach uses a top-down design concept, first design the parent class, then design the subclass, and inherit the parent class's properties and methods, and the object is generated dynamically during the last program run.

Four Summary

Before software development, it is important to choose a reasonable model for development. Both the structural method and the object-oriented approach have merits and demerits, and are not completely opposed, and need to be selected according to the actual situation. Structuring small projects with a structured approach is simple and logical, but can become difficult to maintain when the volume of the software increases, and the object-oriented approach facilitates the processing of complex system relationships, but it is necessary to be mindful of the existence of overly encapsulated or design errors. Software development does not have silver bullets, only to the facts, local conditions, to obtain the best development results.

Structured approach and 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.