Getting Started with Java: User Login and Registration Module 1 (Practice project)--analysis

Source: Internet
Author: User

Task Description: User Login and Registration is a module owned by most software. Write a console program that implements the user's login and registration functions, and users can modify their own information.

"Demand Analysis" because this program is a demo program, the user's information we do to simplify processing, only include: User name, password and email.

1. System function Analysis

To analyze a system or a module, we first need to understand what the system needs to implement, and often use a use case diagram to describe the results of the analysis. For this task, the use case diagram is:

For each use case, you can use the Use Case description table to elaborate on the use case content. The three use case description tables for user login registration modules are as follows:

(1) Login use case Description table

Use case name

Identifier

Use case description

Participants

Front-facing conditions

Post conditions

Basic Operating Procedures

Optional Operation Flow

UC001

Login System

User

No

Log in to the system

1. system prompt user for user name and password

2. user input user name and password

3. system authentication user name and password, if correct, log in to the system

If the user enters an invalid user name and password, the system displays an error message and returns to re-prompt the user for a user name and password: or cancel the login.

(2) Modify personal information Use cases:

(3) User Registration use case

2. Identification class

The use case diagram knows what the system has to function, and then needs to identify the main classes that the system should have from the use case diagram analysis.

1) Obviously, the user module is mainly to complete the management of the user, each "user" is an object, should be "user" as a system of a class,

Name: User Name

Password: User password

Email: User Email

Introduce (): Self-introduction, that is, in the console output user name and email

2) The program runs, need to display a variety of user interaction information, we can use an "interface" object to complete all the user-related interaction process, including displaying the main menu, prompting the user to enter information, display the results of the operation information.

Mainui (): Show main interface

Modifyui (): Display an interface to modify personal information

Registerui (): Display user-registered interface

3) The user fills in the login name, the password at the login, or fills in the personal information when the registration, or when modifies the personal information to fill in the information, then submits the information to a special responsibility processing user Information object (UserService object), lets this object complete the user authentication, the user registration, the User Information modification task. This object takes a user object as a parameter and then accesses the database or file to complete the read and write operation of the data. This is similar to the real life situation, we enter a company or a building, we need to submit their own information, and then by the doorman or security is responsible for our information processing, and finally tell us whether to go in or not to go in. The UserService object We are designing here is also the idea.

Login (user usr): The login authentication method, the parameter is the user object (which can also be a username and password), is verified by returning true, otherwise false is returned.

Logout (String name): Resets the specified user (username name) from the logon state to a non-logon state. The task of this project simple processing, direct output "log out" a line of information can be.

Register (user usr): Writes the incoming new user usr to the data file. Returns true to indicate an increase in success and false to indicate failure.

Modifyinfo (user usr): Modifies the users ' information. Modify all information for the user named Usr.name. Returns true to indicate that the modification succeeded and that false indicates that the modification failed.

Getting Started with Java: User Login and Registration Module 1 (Practice project)--analysis

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.