Java chat room detailed design document (rookie level)

xiaoxiao2021-03-06  113

table of Contents

First part of the project overview

1. Project description .......................................................................... 4.4 2. Project background .................................. ..............................................4

Part 2 Project Plan

1. Project objectives ......................................................................................................................... ................................... 4 3. Project strategy ............................................................................................................................................................................................................... 4 4. Project development Cycle ......................................................................................................... .................. ..5 6. Tools and technical list used .......................................................................... 5 Part III project design

1 demand analysis .......................................................................... 5 2 software function ..................................................................... .................................. 5 3 summary design .............................................................................................................................................. 6 4 Detailed design ... ...................................................................... .6

Section IV Project Test

Test phase

2. Program interface. ................................................................... 7

3. Conditions for program operation

4. Reference information

Part 5 Summary

First part of the project overview

Project description

Project Name: Java chat room system.

Customer: General Volkswagen. 2, project background

In the process of completing two years of software college, the Advanced Teaching Law of India, which has greatly improved professional knowledge, and has also been significantly improved for students' hands-on capabilities. In order to further examine the professional knowledge ability of students, let them clarify the level of self-expertise, improve the interest of learning, and clarify the professional development direction, and lay the foundation for future employment, now specialize in the first session of the Software College " Software technology monthly activities. This event is facing the whole school computer enthusiasts and jointly conducts a series of activities with many universities and IT companies in Chengdu. Activities are subject to software college students, advocate "exposure to IT companies, clear professional directions, and hard work."

Part 2 Project Plan

Project objectives

(1) Allow new users to register and open an account. (2) Allow users to conduct online public chat and private chat. (3), you can create a message lookup and leave a message. (4) Allow users to create private private rooms, look up the private room and chat in the private room. (5), the user data can be queried by the account ID number. (6), friendly welcome interface and display last login time. 2. Project scope

This software applies to the general public.

3. Project strategy

Implemented by visual programming Java programs and SQL databases.

This project is designed and developed by incremental development.

Use the set of words to communicate with the client and the server.

4. Project development cycle

the first week

Demand Analysis and Preliminary Design Phase (Determines the types and data types required for each function)

the second week

Designs various methods and data types used in accordance with the corresponding functions

The third week

Specifically realize the various methods in each class

the fourth week

Adjustment and testing of each interface and servers

5. Skills required for each task

Database Establishment: Skilled SQL Database Programming.

The connection between the server and the client: familiar with the protocol and data stream in network programming

Program interface design: visual programming skills.

Code implementation: Java and database programming. 6. Tools used

Development Tools: Microsoft Javale (JDK1.3) Microsoft SQL Server

Development Environment: Windows2000 PC Part 3 Project Design

Demand analysis

With the growing economy, the concept of the network is deeply rooted. People are increasingly needed to communicate efficiently through the network, and the chat room is one of them.

2. Software main function

(1) Allow new users to register and open an account. (2) Allow users to conduct online public chat and private chat. (3), you can create a message lookup and leave a message. (4) Allow users to create private private rooms, look up the private room and chat in the private room. (5), the user data can be queried by the account ID number. (6), friendly welcome interface and display last login time.

The class to use in the program

1, client

Baojiannew >> Create a private room

BaojianFind >> Find the private room to join the private room

Baojiannter >> Enter the private room

Baojianqu >> Chat area

NewPanel >> Interface Background Chart Processing

PrivateMessage >> Private chat function

UserFind >> Find User Features

Register >> Registration function

Entergui >> Landing function

Chatroom >> Public Chat Function

Liuyan >> Message board

SocketConstants >> Interface (including server IP address, as well as custom port number # 6655)

2, the server

Server >> Handling chat content

Third, design details and construction

(1) Write a server (1) Problem statement requires to develop an intermediate layer server application in Java, which is as follows: a. Accept user registration information and saved in a table (you need to connect to the database). b. Execute the lookup function of the user's settings. c. Ability to log in to the chat interface and chat. d. Can accept private chat information and send to a specific user E. Accept the package information created by the user and save to Baojian f. Can be used to find, login, join the private room and chat g. Can accept the user's message, And saved to the file in the file named file name, the server runs on the custom port # 1001. (2) Plan a solution a. Select the class and method you need to create a web server application. b, determine the user-defined class, their purpose, method.

c and determine the data type and variable in the user-defined class.

d, determine the IP address and port number of the server.

E, determine when to connect to the database.

f, determine the query parameter.

g, determine the exception to be processed.

H. Determine the error information.

Task a. Select the classes and methods required to create the network server application.

task

Source

result

Select the classes and methods required to create a web server application.

class

method

Serversocket

accept ()

Thread

Start (), run ()

Socket

GetInputStream (), getOutputStream ()

ObjectInputStream

ReadObject ()

ObjectOutputStream

WriteObject ()

BufferedReader

Readline ()

Vector

AddElement (), removeelement ()

Task B, determine user-defined classes, their purpose, methods. Task Answers Source Results Determine user-defined classes, their purpose, methods.

Class Method SERVERSOCKET listens to customer request run (), serversocket () Connect processing client (), enter (), register (), find () send (), enter (), time () MEMBERS reserved Applicant information

Baojian reserves the package information

Applicant Reserved Message Information

Task C, determine the data type and variable in the user-defined class.

task

Source

result

Determine the data type and variable in the user-defined class.

class

type of data

variable

Serversocket

Serversocket

Socket

Thread

Server

FromClient

Serverthread

Connect

MEMBERS

ObjectInputStream

ObjectOutputStream

PrintStream

BufferedReader

String

StringBuffer

Vector

Vector

Vector

Vector

Result

Data

Objin

StreamfromClient

OUT

in

User

VMessage

vprivate, vprivateMessage

Vbaojian, vbaojianmessage

VbaojianClient

VPEOPLE

Result2

MEMBERS

String

String

String

String

String

String

String

String

MEMBERID;

MEMBERNAME;

MEMBERPASSWORD;

MEMBERSEX;

Memberaddress;

MEMBERPosition;

MEMBERAGE;

MEMBERINTEREST;

Baojian

String

String

String

Baojianid

Baojianname;

Baojianmiaoshu;

Applicant String

UTXT

Task D, determine the IP address and port number of the server.

task

Source

result

Determine the server's IP address and port number.

IP address: native IP address

Port: 1001

Task E, determine when to connect to the database.

task

Source

result

Determine when to connect to the database.

(1) When the user registers, insert the registration information

(2) When the user logs in, the inspection is an ID

(3) When the user is found, the relevant information is selected.

(4) When the user is created, lookup, add, enter the private room

Task f, determine the query parameter.

task

Source

result

Determine the query parameter.

Vmemberpassword, Vmembername, VBaojianid

Task G, determine the exception to process.

task

Source

result

Determine the exception to process.

exception

Occasion occasion

EXCEPTION

IOEXCEPTION

INVALIDCLASSEXCEPTION

NotSerializableException

When you create a THREAD object,

When calling the accept () method,

When calling getInputStream ()

And the getOutputStream () method,

When calling writeObject (), println (), readline () method when connecting the database

When calling the readObject () method

When calling the readObject () method

When calling the readObject () method

Task H, determine the error information of the exception. task

Source

result

Determine the error information of the exception.

exception

Error message

EXCEPTION

IOEXCEPTION

INVALIDCLASSEXCEPTION

NotSerializableException

"Cannot Start the Thread"

"Not listen to the client"

"The Wrong IS this:" E

"The WRONG IS here:" E

"The WRONG IS here2:" E

"The WRONG IS here3:" E

"The WRONG ........:" E

"Cannot Read from Client:" E

"Cannot Write the VMessage E

"Cannot Serialize MEMBERS CLASS" E

"Object is not serializable" e

(3) Implementation Answer a. Write a server program B. Save the program C. Compiler D. Run the program (4) Verification answer: Verify after the client is created.

(2) Write a client program

1. Write a registration interface program (1) Problem: Write a client program to send the user registered information to the server. (2) Plan a solution a. Select Class and Method B for creating the program. Determine user-defined packets, classes, their purpose and method c. Determine the data type and variables in the user-defined class D. determine the establishment When the server is connected, the server's IP address and port number E. Determine the data f submitted to the server. Determine when the data g is submitted. Determine the exception h. Determine the error information task a. Select to create the program. Class and method

Task Answers Source Results Select the classes and methods that you need to create the program

Class method Socket ObjectOutputStream PrintStream BufferedReader ObjectInputStream PrintStream out = null; BufferedReader in = null; ObjectInputStream objIn; ObjectOutputStream objOut = n PrintStream out = null; BufferedReader in = null; ObjectInputStream objIn; ObjectOutputStream objOut = n PrintStream out = nu BufferedReader getOutputStream () writeObject (); Readline (); ReadObject (); Task b. Determine user-defined packets, classes, their purpose and method task answers Source results. Determine user-defined packets, classes, their purpose and methods

Category Method MEMBERS Reserved Applicant Information

Register implementation interface and function OpenRegister () register () actionPerformed () task c. Determine the data type and variable in the user-defined class

Task Source Results Determine the data type and variable in the user-defined class

Class data type variables Members String String String String String String String String memberID; memberName; memberPassword; memberSex; memberAddress; memberPosition; memberAge; memberInterest;. Register Socket ObjectOutputStream and wherein a number of air control ClientSocket objOut task d determines to establish an IP connection the server Address and port number

Task solution source result d. Determine the IP address and port number of the server when the connection is established

IP address: Native IP address port number: 1001 task e. Determine the data submitted to the server

Task Source Results E. Determine the data submitted to the server

An object task f in the MEMBERS class f. Determines when

Task solution Source results determine when to submit data

Task g. OK to handle the exception to handle

Task Answers Source Results. Determine the exception to handle

Exception occasion InvalidClassexception notserializableException IOException When the WriteObject () method is called when the WriteObject () method is called when the WriteObject () method is called when the WriteObject () method is called when the WriteObject () method is called. Determines the error information of the exception to determine the error information.

Exception Error Information InvalidClassexception NotSerializableException IOException "The Registerapply Class Is Invalid:" E1 "The Object IS Not Serializable:" E2 "Cannot Write to the Server:" E3

(3) Implementation Answers (4) Verification Solution 2, Writing Find Interface Programs (1) Problem Stavences to write a program that looks up the interface, display the information in the text box. (2) Plan a solution (omitted) (3) Implement a solution a. Write a registration interface program B. Save the program c. Compiler D. Run the program (4) Verification answer: Enter a registered ID execution to see if the information is displayed ; Enter an effect after an ID without registration;

3. Write the login interface program (1) Problem (2) Plan a solution (omitted) a. Select Class and Method B for creating the program. B. Determine the user-defined package, class, their purpose and method C. Determine the data type and variable d in the user-defined class D. Determine the IP address and port number E of the server when the connection is established. Determine the data f submitted to the server. Determine the data G. Determine the exceptions to be processed. Error information

(2) Implement the answer A. Write a registration interface program B. Save the program c. Compiler D. Run the program (4) Verification answer 4, write a chat interface program (1) Problem statement (2) Plan to answer a. Select to create the program The classes and methods B. Determine user-defined packets, classes, their purpose and method c. Determine the data type and variable d in the user-defined class D. Determine the IP address and port number E of the server when the connection is established. Determine the data f submitted to the server. Determine when the data g is submitted. Determine the exception h. Determine the error information task a. Select the class and method you need to create the program.

Task Answers Source Results Select the classes and methods that you need to create the program

The method of class Thread Socket PrintStream BufferedReader ObjectInputStream ObjectOutputStream Vector Timer run () getInputStream (), get ...... .. println () readLine (); readObject (); writeObject () elementAt (), size () .start (), actionPerformed task b. Determine user-defined packets, classes, their purpose and methods

Task Answers Source results determine user-defined packets, classes, their purpose and methods

Package method method chartingroom.room room

TimeAction processing message

Send timing accept the message and display the main () Openroom () actionPerformed () run () actionPerformed () run () activity c. Determine the data type and variable in the user-defined class

Task Source Results Determine the data type and variable in the user-defined class

Data type variable Socket PrintStream BufferedReader ObjectInputStream Vector String Int clientSocket, time clientSocket out, timeout in, timein; objIn, timeobjIn; vmessage, vpeople sDate, sTime, sStatus;. Countmessage, countpeople task d determines to establish a connection server's IP address and port number

Task Answers Source Results Determine the IP address and port number of the server when connecting

IP address: Native IP address port number: 6655 Task E. Determine the data submitted to the server

Task Answers Source Results Determine the data submitted to the server

Send Zone Mainland Message Task f. Determine when

Task solution Source results determine when to submit data

When you click the button "Send" task g. Determine the exception to handle

Task Answers Source Results Determine the exceptions to be processed

Exception InvalidClassexception NotSerializableException IOException Exception InterruptedException When accepting a message, when accepting a message, Timer starts time thread startup

Task h. Determine the error information

Task Answers Source Results Determine Error Information

InvalidClassException NotSerializableException IOException Exception InterruptedException "The RegisterApply class is invalid:" e "The object is not serializable:" e "Can not write to the server:" e "Timer has wrong" e6 Timer println (e) (3) Implementation A. Write a registration interface program b. Save the program c. Compiler D. Run the program (4) Verification Solution 5. Writing the login interface program (1) Problem statement (2) Plan a solution (omitted) a. Select Create the program The classes and methods B. Determine user-defined packets, classes, their purpose and method c. Determine the data type and variable d in the user-defined class D. Determine the IP address and port number E of the server when the connection is established. Determine the data f submitted to the server. Determine when the data g is submitted. Determine the exception H. Determine the error information

(3) Implement a solution a. Writing the inter-package interface program B. Save the program C. Compiler D. Run the program 6. Writing Creating a Package Interface Program (1) Problem (2) Scheduled Answers (omitted) a. Select Class and Method B for creating the program. B. Determine user-defined packets, classes, their purpose and method c. The user-defined data type and variable d. Determines the IP address and port number E of the server when the connection is established. Determine the data f submitted to the server. Determine the data G. Determine the exception to the exceptions. Error message

(4) Implement the answer A. Write a registration interface program b. Save the program c. Compiler d. Run the program 7. Write the Find Interpolation Interface Program I. Question Statement (2) Plan Solution () a. Select Create the program Class and method B. Determine user-defined packets, classes, their purpose and method c. Determine the data type and variable d in the user-defined class D. Determine the IP address and port number E of the server when the connection is established, determined submission Data f on the server, determine when the data g is submitted. Determine the exception h. Determine the error information II. Implement a solution a. Write a registration interface program B. Save the program c. Compiler D. Run the program

8. Enter the package and chat in the private room (omitted) 9. Private chat interface (omitted)

10. Message interface (omitted)

Control Condition Value Expected Results The actual results Conclusion Concord button "Send" None is clicked Message Display YES OK OK button "Find" None is clicked OK button "Exit" NONE Click to exit in the user list Clear the username OK OK TimeAction

NONE Automatic Update Message YES OK OK Menu "Message" None is clicked

YES OK OK Menu "interface

None is clicked

YES OK OK menu item "Create" None is clicked

YES OK ----- OK ----- Menu item "Find" None is clicked

YES OK ---- OK --- Menu item "Enter" None is clicked

Open the inter-private interface OK ---- OK --- User list

None is double

Open private chat OK OK Send Area NONE Press ENTER

Send information OK OK

2, registration interface

Control Condition Value Expected Result Actual Result Conclusion Corrupted button "Register" table No Same ID in the table The yes ok button "REWRITE" None is clicked in the clear content YES OK button "Goout" None is smashed out of Yes OK OK

3, login interface

Control Condition Value Expected Result Actual Result Conclusion Conceivers the button "Enter" in the table exists in the table and password is correctly clicked into the chat room, and the name is displayed on the title YES OK button "Register" None is clicked into the registration interface YES OK OK button " ReWrite "None is clicked by Clear the content YES OK OK button" Goout "None is clicked exits YES OK 4, Find Interface Control Conditions Value Expected Result The actual results Conclusion Concord Finding button" Find "table There is a click display to find a user Information YES OK OK button "goout" None is clicked to exit Yes OK 5. Private chat

Control Condition Value Expected Result Actual Result Conclusion Claim button "Reply Send Information Chat

YES OK OK button "Return" None is clicked to exit Yes OK Send Area

ENTER button

Timer object constant acceptance automatic acceptance letter display

6. Inter-package chat interface (similar to private chat interface)

Control Condition Value Expected Result Actual Result Conclusion Claim button "Reply Send Information Chat

YES OK OK button "Return" None is clicked to exit Yes OK Send Area

ENTER button

Timer object constant acceptance automatic acceptance letter display

7. Interpolation lookup creation interface (omitted)

8. Message interface

Control Condition Value Expected Result Actual Result Conclusion Conclusion Claim button "Submit" NONE Click Submit Information YES OK OK button "Return" None is Clicked Exit Yes OK OK

转载请注明原文地址:https://www.9cbs.com/read-98437.html

New Post(0)