Small dictionary project code management

Software project development process
needs analysis ---- "outline design ---" project ---- "detailed design ---" encoding test ----- "

Project Test ---- "Debugging modify ---" project release ---- "post-maintenance
 
> requirements analysis: determine the user's real needs  
  . >> 1 to determine the real needs of users, the basic functions of the project
  >> 2 OK. the overall difficulty and feasibility analysis of the project
  >> 3 needs analysis documents, user confirmation.
 
> Summary of design: a preliminary analysis of the project and the overall design
  . >> 1 to determine the function module
  . >> 2 feasibility analysis to build the overall architecture diagram
  > .> 3 to determine the technical ideas and use frames
  >> 4 form a summary document to guide the development process.
 
> project plan: determine project development timeline and processes
  >> 1 to determine the sequence of development.
  >> 2 determine the timeline event. milestone
  . personnel division 3 >>  
  >> 4 formed subsidiary content Gantt and mind mapping, etc.
 
> Details design: specific project realization
  >> formed detailed design document 1: thinking, logic flow, functional description, technical points described , data structures, codes description
 
> encoding test: write code to achieve According to the schedule, and do basic tests
  . >> 1 code is written
  . >> 2 write test procedures
  >> 3 technology research.
 
> test project: the project in accordance with the function Try
  >> 1.


 
> Project release
  >> 1 items delivered to users to publish
  >> 2. Preparation of project documentation
 
> post-maintenance
  >> 1. Maintain the normal operation of the project
  >> 2. Iterative upgrade project

Function Description 
> Users can login and registration
    * Login with username login and password
    * Registration requires users to fill out the user name, password, and other content Custom
    * username requirements can not be repeated
    * require the user information can be stored for a long
        
> through basic graphical interface print input to prompt the client.
    * The program is divided into the server and client in two parts
    * client initiates a request through an input command to print a simple print interface
    main * server data processing logic responsible
    * After starting the server should be able to meet a number of clients operating
        
> After the client starts that is, into one interface, includes the following functions: Sign Out
    * exit after exit the software
    * Log into the secondary interface that is successful, failed Back to the previous interface
    * successful registration may continue to log back to the previous screen, you can also directly enter the secondary interface with a registered user
        
> When a user logs into the secondary interface, the following functions: search word history log out
    * select the write-off return to the previous screen
    * look up the words: circulation type the word, get the word interpretation, special symbols input word quit check status
    * history: query the current record the user's search term, requires records contain name word time. You can view all of the records or before 10 available.
    
> The present description the word
  >> row for each word must
  >> word in ascending order
  must have spaces between words and interpreted >>
        
> Search word description
  >> directly use this word queries (text manipulation)
  >> first word stored in the database, then the database query. (Database operations)

 

Technical solutions

* Tcp socket
   * more complicated process
   * History: Before 10
   * registered successfully log in directly

The word of this stored data table mysql

1. Create a database dict (utf8)
2. Create a data table words explain the word and the word are stored in a different field
3. word into word lists more than 19,500 words to

Data tables established

 * Word database

create database dictionary charset=utf8;

   * Word data table words -> id word mean

create table (id int primary key auto_incremant, word varchar(32),mean text);
   * 用户  user -> id  name  passwd

create table user (id int primary key auto_increment,name varchar(32) not null,passwd varchar(128) not null);
   * 历史记录 hist-> id name  word  time

create table hist (id int primary key auto_increment,name varchar(32) not null, word varchar(28) not null,time datetime default now() );

Insert word table

 1 import pymysql
 2 import re
 3 
 4 f =  open('dictionary.txt‘)
 5 db = pymysql.connect(host = 'localhost',
 6                      port = 3306,
 7                      user = 'root',
 8                      password = '123456',
 9                      database = 'dictionary',
10                      charset = 'utf8' )
 11  # create a cursor 
12 is CUR = db.cursor ()
 13 is  # insertion statement 
14 SQL = " INSERT INTO words (Word, Mean) values (% S,% S) " 
15  
16  for Line in F:
 . 17      # Ganso non-blank character, matches the intermediate space, explain the absence of some 
18 is      TUP = the re.findall (R & lt ' (\ S +) \ S + (*). ' , Line) [0]
 . 19      the try :
 20 is          cur.execute (SQL, TUP ) # cursor method 
21          the db.commit () # write operations need to submit 
22      the except :
23         db.rollback()
24 
25 f.close()
26 cur.close()
27 db.close()
View Code

 

Design

Several module package design
client:
server: a request processing logic, the database operation processing
function package: a function program to write directly available to users. Users run directly, rather than requiring the use of a certain part of my code.

 Functional analysis and communication structures

   Login Sign up words concurrent communication history Exit to return to the previous screen

Listed functional logic: each function to determine the server and the client what to do, write code test

Register the client: enter your registration information
                 to send a request
                 to get feedback
         server: receiving a request
                 to determine whether to allow registration
                 allows registration information stored in the database
                 to the client feedback results
  log on the client: Enter the user name and password
                  to send a request to the server
                  to get feedback server
             server: receiving a request
                   to determine whether to allow login
                  send the results
 look up the words client: enter the word
                  send a request Q name word
                  waiting to receive the results
          server: receiving a request
                  to find a word
                  to send the results
                  inserted history

Set Client Server protocol

Guess you like

Origin www.cnblogs.com/Alan-Song/p/11221973.html