"Structured Programming-01"

Source: Internet
Author: User
Tags dashed line

Brief introduction of Structured programming

• Structured programming method advocates the analysis of system requirements by function, and its main principles can be summarized as top-down, gradually refinement, modularization and so on. Structure of

The programming first uses the structured analysis (structrued, SA) method to analyze the requirements of the system, then uses the structured design

(structrued design, that is, SD) method of the system is outlined, detailed design, and finally the use of structured programming (structrued

program, or SP) to implement the system. The use of this SA, SD and SP can be a good way to ensure the development of software system progress and quality.

This method is also a function-oriented program design method because the structured programming method advocates to subdivide the software system by function.

Each function of the structured programming is responsible for processing the data once, each function accepts some data, and then outputs some data after processing, this processing party

is also known as a data flow-oriented approach.

Limitations of structured programming

   • The design is not intuitive and inconsistent with human habit thinking. With structured program analysis and design, developers need to break down the objective world model into a

A function, each function is used to complete a certain data processing.

• Poor adaptability, not strong scalability. Since the structured design uses a top-down design approach, when the user's needs change or need to be modified

The existing implementation mode needs to modify the module structure from top to bottom, and the maintenance cost of this method is quite large.

Three kinds of structure of the program

  

• Structured programming emphasizes the algorithm that implements a function, and the implementation of the algorithm is made up of a series of operations that perform

The order is the control structure of the program. In 1996, computer scientists Bohm and Jacopini proved the fact that any simple or complex algorithm could

Made up of three structures

– Sequential structure

– Select Structure

– Loop Structure This

• These three structures are referred to as the three basic structures of the program design, as well as the structures that must be used for structured programming

Sequential structure

Select Structure

Loop structure

Object-Oriented Programming

• Object-oriented is a better method of program design, its basic idea is to use class, object, inheritance, encapsulation, message and other basic concepts to carry out

Programming. It is from the real world objective objects (i.e. object) to construct the software system, and in the system structure as far as possible to use human nature

The way of thinking, emphasizing directly to the real world of things (that is, objects) as the center to think about problems, understanding problems, and according to the nature of these things, it

are represented as classes in the system as the basic constituent units of the system (rather than in relation to things in the real world, and there is no corresponding

Other processes to construct the system), which allows the system to directly map the objective world and maintain the original face of things and their interrelationships in the objective world.

• If a software system is developed in an object-oriented manner, its smallest program units are classes that can generate multiple objects in the system, which

The elephant is mapped directly into the various things of the objective world.

Object-oriented features

• The object-oriented approach has three basic features: Inheritance (inheritance), Encapsulation (encapsulation), and polymorphic

(polymorphism).

• Object-oriented also supports several features such as:

– object is the most basic concept of object-oriented approach, its basic features are: identity uniqueness, classification, polymorphism, encapsulation, module Independent

Good sex.

– A class is a collection of objects that have common properties and common methods. A class is an abstraction of an object, and an object is an instance of a class. And the class is the entire software system most

Small program Unit, the encapsulation of the class hides various information details and exposes the functionality provided by the class through a common method, thus improving the class's

Cohesion, reducing the coupling between the objects.

– This mutual cooperation between objects requires a mechanism to assist, and such mechanisms are called "messages". The message is between an instance and another instance

The information passed.

– In an object-oriented approach, the mechanism for sharing properties and operations between classes is called inheritance. An existing class can be referenced as a base class, and the new class is appropriately

Referred to as a derived class. Inheritance has transitivity. Can be divided into single inheritance (an inheritance is only allowed to have a direct parent class, that is, the class level is a tree structure) and the multiple secondary

(A class is allowed to have multiple direct parent classes).

UML Development History

use case diagram

• Use case diagrams are used to describe the series of functions provided by the system, while each use case represents a functional module of the system. The main purpose of use case diagrams is to help develop

The team understands the requirements of the system in a visual way, and the use case diagram does not explain the implementation of the system, only the description of the system function.

• Use case diagrams are primarily used in the requirements analysis phase to communicate with customers to ensure that system requirements are not two-dimensional, use case diagrams represent system appearances, and do not expect

There is any connection between the example diagram and the classes within the system. Do not make use cases too much, too many use cases will lead to difficult to read, difficult to understand, as much as possible

Use a text description.

Class diagram

• Class diagrams are the oldest, most versatile, most widely used UML diagram, which represents which entities should be included in the system, how the entities are closed

In other words, it shows the static structure of the system, which can be used to represent logical classes, which are usually the kind of things the business people are talking about.

• Class diagrams can represent the relationships between entities in addition to the static internal structure of the entity, and there are three basic relationships between classes:

– Associations (including aggregations, combinations).

– Generalization (same concept as inheritance).

Dependency

Component diagram

• For modern, large-scale applications, usually not just a single class or a single set of classes can be done, usually by one or more deployable

Components. For Java programs, reusable components are often packaged into a jar, war, and so on, and for a C + + application, reusable components Pass

is often a library of functions, or a DLL (dynamic link library) file.

• Component diagrams provide a physical view of the system. Its purpose is to display the dependencies of software in the system on other software components (for example, library functions). Component

Graphs can be displayed at a very high level, showing only coarse-grained components, or at the component package level.

Deployment diagram

• Deployment diagrams Describe how software systems are deployed to a hardware environment. Its purpose is to show where different components of a software system will run physically to

And how they will communicate with each other.

• Because deployment diagrams are modeled on physical operations, the production staff of the system can use this diagram to install and deploy software systems well.

Sequence diagram

• The sequence diagram shows the detailed process of a specific use case (or part of a use case) and shows the call relationship between the different objects in the process, as well as

Different calls to different objects can be displayed in great detail. The sequence diagram describes the interactions between objects (both sequence and communication diagrams are called interaction graphs), focusing on

To describe the message and its chronological order.

• The sequence diagram has two dimensions: the vertical dimension displays the sequence of messages/calls in the chronological order in which they occur, and the horizontal dimension displays the objects that the message is sent to.

Cases. The key of the sequence diagram is the message between the objects, the information passing between the objects is so-called message sending, the message usually manifests as the object calls another

The object's method, or the return value of the method, represents the message between the sender and the receiver.

Draw sequence Diagram

• The sequence diagram is very simple to draw. The top of the sequence diagram each box represents an instance (object) of each class, in the box, between the class instance name and the class name

A colon or a space to separate, for example, Myreportgenerator:reportgenerator. If a class instance sends a message to another class instance

Message, a line with an open arrow pointing to the receiving class instance is drawn, and the name of the message/method is placed above the wire.

• For some particularly important messages, we can also draw a dashed line with arrows pointing to the originating class instance, marking the return value on the dashed line, drawing

The information about the return value is made to make the sequence diagram easier to read.

Evolution Diagram

• The activity diagram and the state machine diagram are called Evolution diagrams, in fact the difference and contact are as follows:

– activity Diagram : A process used to describe an activity or method inside a use case, which becomes a flowchart if the parallel activity description in the activity diagram is removed.

– state machine Diagram : Describes the different states that need attention in an object's life cycle, and describes in detail the events that stimulate the state of the object, as well as the

The action taken as the state changes.

• The five elements of the evolution diagram are as follows:

– Status: The state is the different face before and after the object responds to the event, and the state is the stable state maintained by the object for a certain time period, and the current software calculation is

Based on stable state, the stable state of an object is an intrinsic characteristic of an object, and the states of an object are generally limited. Objects of limited state are easy to calculate, objects

The more states, the more complex the state migration of an object, the object state can be imagined as a snapshot of the object's evolution.

– Events: Stimuli from the outside of an object, usually in the form of a message, but an event occurs relative to the object. An event is an object state,

The driving force of the change of life.

– Action: An action is an object's handling of an event, which in fact usually manifests itself as a method being executed.

– Activity: Activity is a follow-up system behavior triggered by an action.

– Condition: Condition refers to the condition in which the event occurs.

Events that excite the state of an object

• There are usually two types of events that excite an object's state change:

– Internal event: an event that is fired from within the system, an object's method (action) call, and (through an event activation) Another object method (action).

– External event: an event that is fired from outside the system boundary, such as a user's mouse, keyboard action.

Activity Chart

• Activity diagrams are primarily used to describe process principles, business logic, and workflow techniques, and in many cases, activity diagrams are very similar to traditional flowcharts

Not the activity diagram supports concurrency. The activity diagram is very similar to a traditional flowchart, which also uses a rounded rectangle to represent the activity, using a solid line with arrows to represent the event.

• When drawing an activity diagram, the activity is centered, the entire activity diagram has only one start activity, there can be multiple end activities, and the activity diagram requires parallel activities and strings

Separation of line activities, it is best to express the branching and looping conditions clearly as traditional flowcharts when encountering branching and looping. The biggest advantage of activity diagrams is that they support parallel behavior,

Parallelism is important for workflow modeling and process modeling. Because of parallelism, synchronization is required, and synchronization is indicated by convergence.

State machine Diagram

• A state machine diagram represents the different states in which a class is located and the state transformation information for that class. In fact, we seldom draw the state machine diagram, we are only interested in

class to draw the state machine diagram. That is, classes that have three or more potential states during system activity need to be considered for description using a state machine diagram.

• The symbol set of a state machine diagram consists of 5 basic elements:

– The initial state, which is drawn using a solid circle;

– Transitions between states, which are drawn using line segments with open arrows;

– state, which is drawn using rounded rectangles;

– Judging point, which is drawn using a hollow circle;

– One or more termination points, which are drawn using a circle that contains a solid circle inside.

• When drawing a state machine diagram, you should ensure that the object has only one initial state and can have multiple finalization states. State to represent a critical snapshot of the object, there are important

The actual meaning, insignificant state is not to be considered, the event and method should be clear when drawing the state machine diagram.

Everything is an object.

• In the Java language, everything is an object except for the 8 basic data type values. The object is the center of object-oriented programming. object is human

Anything that we want to study, from the simplest integers to the complicated planes, can be seen as objects, not only to represent specific things, but also to represent abstract

A rule, plan, or event.

• The object has a state, and an object describes its state with a data value. Java by defining a field for an object, formerly known as a property, is now also known as

To describe the state of the object, the object has operations that can alter the state of the object, the object's operation is also called the object's behavior, and the Java

Describes the behavior of an object by defining a method for the object.

• Objects combine data and operations to encapsulate data and operations in the unity of the object.

Classes and objects

• An abstraction of a group of objects of the same or similar nature is a class, a class is a description of a class of things, is an abstract, conceptual definition; The object is actually stored

Each individual in that class of things, thus also called instances (instance).

• An object's abstraction is a class, the materialization of a class is an object, or an instance of a class is an object. Class is used to describe a series of objects, and the class outlines each object

The data that should be included, the class outlines the behavior characteristics of each object. So we can understand the class as a kind of concept and definition, which stipulates that some kind of object has a common

of data and behavioral characteristics.

The Java language uses the class keyword to define classes, and Java allows developers to freely define classes that can be defined using field to describe the number of objects in the class.

Methods can be used to describe the behavior characteristics of the class object.

Main structure between classes

• General-Special structure: Also known as classification structure, this classification structure relationship is a typical inheritance relationship, the Java language uses the extends keyword

To represent this classification structure, the subclass of Java is a special kind of parent class. So this general-special structural relationship is actually a kind of "isa" relationship.

• Overall-part structure: Also known as the assembly structure, this classification relationship is a typical combination of relationships, the Java language by saving another in one class

object, so this whole-part structure relationship is actually a "hasa" relationship.

"Structured Programming-01"

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.