The development process of Python's object-oriented ultimate Advanced

Source: Internet
Author: User

All right, you're going to get it now. Object-oriented syntax, but you will find many students have learned the object-oriented grammar, but still can not write object-oriented program, why? The reason for this is that you don't yet have an object-oriented design tool, and the people who are experienced at the moment may think of the waterfall model, the Helix model, the iterative development, the agile, the RUP and so on a bunch of software engineering-related development processes, but for most people these processes are just the process of project management.

In this section we will look at the development process as a programmer based on an object-oriented development program:

Implementation model--design model----domain model, demand model

One, the demand model 1. Demand vs function
Requirements: The customer wants the effect, the customer has the value of things function: The system to achieve customer value and provide the ability/function Example:    car: Driving is the demand, braking, acceleration, turn is the function of the    printer: printing is required, paper feed, settings, and computer connection is a function    POS: Buy demand, product scanning, sum of money, silver, etc. is a function
2. The importance of demand
1/3 of projects failed or got into trouble because of the demand cause of garbage in,garbage out garbage on the production line of biscuits, and finally produced a cookie like Raj

  
The cost of fixing the problem of a demand error is extremely high

1 Coding phase fix found an error cost human is 1 Units 2 test phase repair requirements error costs are 5-10 times 3 maintenance phase (after product launch), repair demand error cost is 20 times times PS: Fix errors in the requirements phase, Cost only 0.1 to 0.2. Conclusion: The demand is wrong, almost to the software project re-done again

  

3. Purpose of the demand analysis
1 recorder, record the needs of customers 2 analysts, and customer analysis, improve the needs of 3 of the Guide, to guide the needs of customers

4. Methods of demand Analysis
Requirements Analysis 518 method, referred to as I want to send, specifically is 5w1h8c
 
5w + 1h is a function attribute 8c belongs to the mass attribute 5w:
When: What time does the user want to use, such as a midnight backup task, it is clear that we are aware that the need needs to be automated where: where the user wants to use it, such as the difference between the garbage can and the outside, the same thing in different places. WHO: Users want to use, not only people, It can also be a system what the user wants our program's output to be, a piece, a document, a system why: Ask the user why to do so, (you do not ask, he basically does not say), including all the customers feel uncomfortable things ps:why is the core

1h:how  


8c:8 a constraint constraint

Performance Performance    performance is the efficiency of the system to provide the corresponding services. Mainly including response time, throughput    performance is one of the key constraints of many system architecture design    For example, the same Web site, although it is to provide information to user traffic, design a daily visit volume of 1w website and Daily visit volume of 1 billion of the site, the design of the two different cost costs    cost    is one of the key constraints in the design of many system architectures, which is the cost to implement the system.    For example, the customer is only willing to spend 100w, and we have designed a 1000w time    -consuming system. When a customer asks for a delivery reliability reliability refers to the ability of the system to run correctly for a long period of time, such as banks, securities, and telecommunications companies, which require very strict safety security, which refers to the protection of information security, involving money, identity cards, The requirements for social Security numbers are high. Compliance compliance means meeting a variety of industry standards, laws and regulations, such as 3 C, SOX, 3gpp,itut Technical technology    Some customers may require us to adopt a technology    For example, customers are now Windows servers that require us to develop compatibility based on the Windows platform compatibility refers to the compatibility of our products with other customers ' existing products or systems, knowing that few products are running in isolation now, especially in large enterprises, large companies, Multiple systems are interactive and compatible with each other. The new system must be able to work with existing systems or it will not run
5, the use case of the requirement model

5.1 Tips for writing use cases

Three-segment method: NEA1 normal processing (regular): Analysis of normal process 2 exception handling (Exception): Analysis of each step exception and corresponding processing 3 alternative processing (alternative): Analyze whether there are other alternatives to each step, and how to do

5.2 Writing formats for use cases

#1. Use case name in general, the use case name is the requirement name # #. The scene scenario is the context in which the use case occurs, exactly as in 5w: When,where,who#3. The use case description describes the detailed use case content, which corresponds to what the user should do in 5w, and the output in each step, but does not require a certain output for each step, can or does not, or can have multiple # #. Use case value describes the customer value of the use case corresponding to the why#5 in 5w. Constraints and constraints are related constraints and constraints in the requirements process, corresponding to the 8C in the 518 method

5.3 Use case writing case

#用例名    Answer System # Scenario:    when:8.10 start    Where: Xi ' an    who:linux college, Network Customer # Use case Description: Linux Academy offers 50 questions each customer can participate in the answer without entering any personal information. Randomly select 20 questions, give the customer answer, 5 points for each question,    3. After the answer, enter the phone number, submit, calculate the total score of 60 points to participate in the lottery, <60 the basic video # user value:    answer prizes, input their own mobile phone number to obtain results, Get contact information for prospective customers and prepare them for later transfer to trainees # constraint:    No

  

Two, domain model

The requirement analysis phase does not differentiate between object-oriented or process-oriented

Domain model is a bridge from requirement analysis to object-oriented design

Domain Model definition:

    A domain model is a visual representation of a concept in a domain or a real-world object, also known as a conceptual model, a domain object model, an analytical object model, which focuses on analyzing the problem area itself, discovering important business domain concepts, and establishing relationships between business domain concepts

The domain model mainly consists of two functions:

1 Exploring key Business Domain Concepts 2 establishing the relationship between business domain concepts

  

Methods for inductive domain modeling:

1 from the use case to find a noun (after looking for the need to delete the domain object is not the noun, specifically delete what, with different fields, no unified standard, by experience) 2 plus attributes (some attributes are not explicitly given in the use case, by industry experience to add) 3 links (UML diagram)

  

Three, design model
Specific steps for object-oriented class design the    first step: Domain class mapping (not full copy)        class filtering: Not every domain class will appear in the software        Name Mapping: corresponding        attribute mapping: Correspondence, Copy        refining method: There is no method in the domain class, Find a verb in a use case    Step two: Apply design principles and Design patterns    step three: Split auxiliary classes (domain classes can be split into several classes in the implementation phase)

  

Iv. Implementing the Model

Choose a Support object-oriented language to implement our design, such as C++,java,python

Five, answer system case first step, requirement analysis (write use case)
#用例名    Answer System # Scenario:    when:8.10 start    Where: Xi ' an    who:linux college, Network Customer # Use case Description: Linux Academy offers 50 questions each customer can participate in the answer without entering any personal information. Randomly select 20 questions, give the customer answer, 5 points for each question,    3. After the answer, enter the phone number, submit, calculate the total score of 60 points to participate in the lottery, <60 the basic video # user value:    answer prizes, input their own mobile phone number to obtain results, Get contact information for prospective customers and prepare them for later transfer to trainees # constraint:    No

  

The second step: domain model (find noun, plus attribute, even relationship = = =) plot

2.1 Find a noun:

Find a noun: Linux Academy, title, customer, score, award, Video # Filter: Remove nouns unrelated to the field. Video should count as a prize Linux academy, title, customer, score, award

2.2 Plus Properties:

#加属性加属性名词         attribute                        notes Linux College    NA                       does not require the properties of the Linux Academy for the answer system, so in the domain model, the Linux Academy is a problem number with no attributes, a          problem type, Title description, answer options, correct answers, score customer        customer number, name, gender, age, phone number answer record     number, customer number, title number list, total score, time     through the answer record can know who the user is, and the user answered the title of the prize        Prize number, prize name

2.3 Connections:

#连关系: Drawing 1: The answer record is the relationship between the customer and the question class, and the customer and the prize can be built a relationship class, so that after the relationship class can know who won what Prizes 2: To find a verb:    create a topic    randomly select the topic    answer the    total score    Lottery

2.4 Plot

Step three: Design the model

Fourth step: Implementing the Model
Link: Https://pan.baidu.com/s/1jHYFKWI Password: WIMC

  

VI, UML diagram uml-unified model Language Unified Modeling Language, also known as the standard Modeling language. is a language used to visually model software-intensive systems.  The definition of UML includes two elements of UML semantics and UML notation. UML is an open method for explaining, visualizing, building and writing an object-oriented software-dense system in the development phase. The best application is engineering practice, which is proven effective in modeling aspects of large-scale, complex systems, especially at the software architecture level. Unified Modeling Language (UML) is a modeled language. The models are mostly represented in a graphical way. A typical modeling diagram typically contains several blocks or boxes, connectors, and text that is used as additional information for the model. These are simple but very important, interconnected and extended in UML rules. Main model
There are three main models in UML system development: The UML Diagram function model shows the function of the    system from the user's point of view, including the use case diagram. The UML Diagram Object Model    uses the concepts of object, attribute, operation and association to display the structure and foundation of the system, including class diagram, object graph and package diagram. UML diagram Dynamic Model    shows the internal behavior of the system. Includes sequence diagram, activity diagram, State diagram.
The function of graphs
UML is a further modeling in the process of database design, after the design of E-r diagram (Entity-contact diagram). To understand some of the UML design of the legend and the basic role. First of all, the function of the diagrams in UML is a brief introduction: use case diagrams describe roles and the connection between roles and use cases. It explains who wants to use the system and what they can do with the system. A use case diagram contains several model elements, such as systems, actors, and use cases, and shows the various relationships between these elements, such as generalization, association, and dependency. Class diagram class diagrams are static views that describe the classes in the system and the relationships between the classes. Allows us to have a comprehensive understanding of the system before writing the code correctly. A class diagram is a model type, exactly, a static model type. Class diagrams represent classes, interfaces, and collaborative relationships between them. An object graph is very similar to a class diagram, an instance of a class diagram that shows multiple object instances of a class rather than the actual class. It does not describe relationships between classes, but relationships between objects. Package diagrams package diagrams are used to describe the hierarchical structure of a system, consisting of packages or classes, that represent the relationship between packages and packages. Activity diagrams Describe the activities that are required by use cases, as well as the constraint relationships between activities, which facilitates the identification of parallel activities. The ability to demonstrate where features exist in the system, and how these functions and the capabilities of other components of the system together meet the business needs of using use case diagrams to model earlier. A state diagram describes all possible states of an object of a class, as well as the transition condition of the state when the event occurs. You can capture the life cycle of objects, subsystems, and systems. They can tell the state that an object can have, and how events (such as the receipt of messages, the passage of time, errors, conditions becoming true, etc.) will affect these states over time. A state diagram should be connected to all classes that have a clear, identifiable state and complex behavior, which determines the behavior of the class, how the behavior changes depending on the current state, or what events will change the state of the object of the class. A state diagram complements a class diagram. Sequence diagrams (sequence diagrams) sequence diagrams are models that show how your participants interact with the system's objects in a series of sequential steps. Sequence diagrams can be used to show how objects interact with each other. The sequence diagram will focus on the message sequence, emphasizing how messages are sent and received between objects. collaboration diagrams and sequence diagrams are similar, showing dynamic relationships between objects. Can be seen as the intersection of a class diagram and a sequence diagram, a collaborative diagram modeling object or a role, and how they communicate with each other. If the time and order are emphasized, the sequence diagram is used, and if the subordinate relationship is emphasized, the collaboration diagram is selected, and the two graphs are called interaction graphs. Component Diagrams (assembly diagrams) describe the physical structure of code artifacts and the dependencies between the various constructs. The components that are used to model the software and their relationships with each other, and these graphs are composed of component markers and componentRelationship composition. In a component diagram, a component is a single component of a software, which can be a file, product, executable, script, and so on. A deployment diagram (configuration diagram) is a physical deployment used to model a system. such as computers and devices, and how they are connected. The users of the deployment diagram are developers, system integrators, and testers.  The deployment diagram is used to represent a set of physical nodes and the relationship between nodes, thus establishing a system physical level model.

A: Each of the 10 model maps have a focus
1: Use case diagram focuses on describing user needs,
2: The class diagram focuses on describing the system implementation;


Two: The description of the aspects are not the same
1: The class diagram describes the structure of the system,
2: The sequence diagram describes the behavior of the system;


Three: The level of abstraction is also different
1: Component diagram describes the modular structure of the system, high level of abstraction,
2: Class diagram is a description of the structure of specific modules, the level of abstraction is general,
3: Object graph describes the concrete module implementation, the level of abstraction is lower.


In some literature books, these nine models are divided into three categories:
Structural classification, dynamic behavior, and Model Management:
1: Structural classifications include use case diagrams, class diagrams, Object graphs, component diagrams, and deployment diagrams.
2: Dynamic behavior includes state, activity, sequence, and collaboration diagrams,
3: Model Management contains class diagrams.

The class diagram is represented by a plus sign (+) to indicate that public is using a minus sign (-) to indicate that the private passes the pound (#) protected

  

Seven, homework practice

See more: http://www.cnblogs.com/wj-1314/p/8707772.html

The development process of Python's object-oriented ultimate Advanced

Related Article

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.