Introduction and application of UML Unified Modeling Language

Source: Internet
Author: User
1. What is UML class diagram
UML (Unified modeling Language), the Unified Modeling Language, or the standard modeling language, was an OMG standard that started in 1997 and is a graphical language that supports modeling and software development, providing modeling and visualization support for all phases of software development, Includes requirements analysis to specifications, to construction and configuration
The role of 2.UML
When making a formal UML diagram, it may start to feel impractical, but creating UML class diagrams does have the following benefits:
1. If we draw a sketch of the class before we do any coding, we'll be more sure to encode it right from the start.
2. A UML class diagram, can act as a User Wizard role, class diagram enumeration class of familiarity, methods and parameters, and other information, we can according to class diagram to directly practical.
The basic structure of the 3.UML class diagram
The core structure of a class has three parts:
Class name
Property
Method
A complete UML class diagram is also divided into three parts:
Class name on top
Property in the middle
Method at the bottom
The following figure: 1. When we define attributes in a class diagram, we can annotate the types of attributes (e.g., strings, arrays, arrays, resources ...). is listed after the name of the attribute, such as:
Username:string
Count:number
If the attribute has a default value, we need to draw it in the diagram:
Count:number = 0
2. In defining a method in a class diagram, the method name is usually placed first, its arguments and types are enclosed in parentheses, followed by the return value type of the method:
ShowName (username:string): string
The user name passed in the string type, which returns a string
Note: If a method does not have any return value, we will set the return value to void, for example: The following method sets the user name without returning any values:
SetName (username:string): void
4. Using UML to design a class
Requirements: Design a class to complete the function of generating the verification code
Steps:
1. Design a class named Captcha to generate the verification code
2. Design the properties of the verification code:
of the Verification Code
Width widths, numbers, defaults to 0
Altitude height, number, default to 0
Length lenght, number, default to 0
3. Design the Verification code method
The construction method, the width, height, length, and return value of the incoming verification code are not
Methods for generating Authenticode generate ()
Set the width of the authentication code setwidth (Width:number)
Set the height of the authentication Code setheight (Height:number)
method to generate Randomcode (length:number=4)
Methods saved to session: Savetosession (): void
The method that writes the string to the picture Captcha (Randomcode): void
This article by the source Code age (www.itsource.cn) PHP training Discipline Teacher original, reprint please indicate the source.

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.