Phonebook Lite 1.0 - Software Design Document

moodusroundoΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 1 μήνα)

680 εμφανίσεις







Human Computer Interaction CSCi
-
488



Software Design Document



Phonebook Lite 1.0


Luke Kubat and Harshwardhan Sharma

12/6/2009





INDEX



Introduction




Objective



Interface Mockup



Design Considerations


o

Assumptions and Dependencies


o

General Constraints


o

Goals and Guidelines


o

Development

Methods




Development Strategies



Programming Strategies

o

Import Phonebook Database.

o

Filter Class Used for Searching
.

o

Search Functionality
.

o

Using Search Functionality to group the data alphabetically

o

Saving the Phonebook
.




Implementation

Plan
.




Sources.



Introduction

This document will serve the purpose of discussing the design and development of the project
that simulates a “phonebook” for the course of HUMAN COMPUTER INTERACTION as the
semester project.

The target audience for the project is the facult
y i.e. Dr. Kong and the students of the course.

The operating system used to develop the application is Windows Vista. Language used is Java
and integrated development environment

used is Netbeans.

Description of the products used
:
-

IDE
---------------
Net
Beans IDE 6.1 (Build 200805300101)

Java
--------------

1.6.0_10; Java HotSpot(TM) Client VM 11.0
-
b15

System
-----------
Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)



Objective

Phonebook lite is basically a simulation of a real life phonebo
ok/address book. The basic
features will include:
-



Adding Contacts :
-

o

You can add new contacts i.e. Name, Address, Email, Phone Number etc. to a
new or pre
-
saved phonebook.



Deleting / Editing Contacts.

o

You can remove or change any of the data in the
phonebook conveniently.



Adding/Deleting Columns.

o

You can add or remove the whole column from the phonebook i.e. if you have a
name address and phone number column and you want to add a email column.
You can conveniently do that.



Sorting Contacts.

o

You have

a flexibility to sort the phonebook table in respect of any column you
want in ascending or descending order.



Opening/Editing/Saving phonebooks.

o

You can Access saved phonebooks and edit them. Formats accepted are *.pbd or
*.csv files.



Searching.

o

You can s
earch for a specific name or number in the phonebook.



Accessing phonebook alphabetically

o

If you have a big phonebook and you want to access it alphabetically to make it
easy to look up contacts. It is possible by the click of button.



Interface mockup.

We

plan to implement a phonebook and intend to reach an end result that looks like:
-



Design Considerations



Assumptions and Dependencies.

o

It is assumed that java will be
pre
-
installed on a system that this software is
running on.

o

Operating system used is windows based.

o

End User is the faculty of the course and students.

o

It is possible that this software will have a slightly different GUI on different
machines it is executed on .



General Constraints.

o

Operating System is windows vista.

o

Java version is 1.6.0_10; Java HotSpot(TM) Client VM 11.0
-
b15

o

Phonebook that is intended

to be accessed should be in recognizable format i.e.
*.pbd or *.csv .

o

No Necessary memory constraints.

o

Network Based access is not implemented.



Goals and Guidelines.

o

Prime goal is to achieve full functionality of the intended software.

o

To build a user fri
endly application.

o

To build an application that is easy on the eyes and is simple and pleasing.

o

To lay emphasis on fast access speed.



Development Methods.

o

Major development strategy was following a waterfall model i.e. first going
through the requirements

and then laying out a basic design for the software
and eventually implementing it in java and finally testing it.




Development Strategies

The Core strategy was to import a pre
-
existing phonebook and be able to manipulate it in
various ways.

We decide t
o use java because of its flexibilities and various useful built
-
in features.


And as far as the database is concerned, we settled on working on CSV files and to import them
into jtables and then using java’s jtable functionalities to work with the importe
d CSV’s and
then save them as *.pbd(phone book data) format.



Programming strategies

Classes Defined

DataTableModel


This class will handle the data of the phonebook that is exported into a jtable.

PhoneBookView


This Class will serve as the user interface.


PhoneBookApp


This will serve as the main class to initiate the application.

Filter


Used to implement the search algorithm.

CustomRowSorter


Used for sorting of the
jtable.

CustomFileFilter


Class responsible for importing and exporting
the database file.

CustomComparator



Implemented to compare
strings.

PhoneBookAboutBox


To Display the About Box for the application




Note:
-

The following pages will cover the programming used implementation of the basic
functions for the phonebook simulation



Import CSV/PBD/phone book database:
-


public DataTableModel(String file){


if(file == "")


{


String[] theaders = {"First Name","Last Name","Phone Number"};


headers = theaders;


data = new ArrayList<String[]>();


this.insertRow();


}


else


{


try {


this.importFromCSV(file);


} ca
tch (FileNotFoundException ex) {


Logger.getLogger(DataTableModel.class.getName()).log(Level.SEVERE, null, ex);


} catch (IOException ex) {


Logger.getLogger(DataTableModel.class.getName()).log(Level.SEVERE, null, ex);


}


}


}







Filter Class Used for Searching:
-

public class filter extends RowFilter<DataTableModel,Object>

{ public boolean include(Entry entry) {


if (PhoneBookView.filterText.isEmpty())


return true;

for (int i = 0; i <
entry.getValueCount(); i++)


{


String value = entry.getStringValue(i);


if (value.toUpperCase().indexOf(PhoneBookView.filterText) !=
-
1 )


return true;


}


return false;

}

}



Search Functionality:
-

public void search()


{


String response =
JOptionPane.showInputDialog(null,


"Search/Filter",


"Enter the text to search for",


JOptionPane.QUESTION_MESSAGE);


filterText = response;


final TableRowSorter<DataTableModel> sorter = new
TableRowSorter<DataTableModel>((DataTableModel) jTable1
.getModel());


jTable1.setRowSorter(sorter);


sorter.setRowFilter(RowFilter.regexFilter(response));


}




Using Search Funcitonality to sort the list alphabeticaly.

public void searchA() {


String response = "A"; filterText = response;


final TableRowSorter<DataTableModel> sorter = new
TableRowSorter<DataTableModel>((DataTableModel) jTable1.getModel());


jTable1.setRowSorter(sorter);


sorter.setRowFilter(RowFilter.regexFilter(response));


}



Saving a new phonebook :
-

private

void writeData() {


JFileChooser chooser = new JFileChooser(currentSave);


chooser.setFileFilter(new CustomFileFilter());


int n = chooser.showSaveDialog(this.getFrame());


if (n == JFileChooser.APPROVE_OPTION)


{

try


{


String savepath = chooser.getSelectedFile().getPath();


if(!savepath.endsWith(".pbd"))


{ savepath = savepath + ".pbd"; }


BufferedWriter output = new

BufferedWriter(new FileWriter(savepath));


String line = "";


for (int i=0;i<jTable1.getModel().getColumnCount();i++)


{ line = line + "," + jTable1.getModel().getColumnName(i);


}



output.write(line.substring(1));


output.newLine();


for (int i=0;i<jTable1.getModel().getRowCount()
-
1;i++)


{ line = "";


for(int j=0;j<jTable1.getModel().getColumnCount();j++)


{ line = line + "," + jTable1.getModel().getValueAt(i, j);


}


output.write(line.substring(1));


output.newLine();


}


output.close();



currentSave = savepath;


jLabel1.setText(currentSave);


} catch (IOException ex)


{ Logger.getLogger(PhoneBookView.class.getName()).log(Level.SEVERE, null, ex);


}



}


else if (n == JFileChooser.CANCEL_OPTION)


{ if (confirmQuit())


{ System.exit(
-
1);


}


else


{ dataCheck();



}


}


}




Implementation Plan

These are steps to be followed throughout the implementation of the programming strategies.

1.

Basic GUI.

2.

Successful import of the database.

3.

To be able to successfully edit the database imported/created.

4.

Implement the search functionality.

5.

Clean up the code.

6.

Run tests.

7.

Make the GUI user friendly and suitable for everyday use.


Note :
-

Following pages will cover the different steps of the plan.



Step 1.

Basic GUI








Step 2.

Successful import of the da
tabase








Step 3.

To be able to successfully edit the imported/created database

a. import









b. Edit

A
dding / removing columns



Adding/removing Rows








Step 4.

Implement Search Functionality.









Step 5.

Clean up the code and provide necessary comments.

Code can be read from the src folder in the project folder.

Step 6.

Run Tests.

The tests that were conducted showed promising results. Except the search functionality which
has to be worked on. The problem

is that the search option is able to search for very specific
strings in a row and is not very flexible. This can be understood by observing an example.

Condition : two person in the list have same names but the way they are entered is different
one have

the first letter capitalized and the other doesn’t i.e. for e.g. one is “Steve” and other is
“steve” now if you search for ‘steve’ only ‘steve’ will show up not ‘Steve’ and vice versa.

Solution (temporary): the system should automatically change the first

letter of the name to
uppercase.



Step 7.

Make the GUI user friendly and ready for everyday use.

This is the final screen of the application:


About Screen




Sources:

The World Wide Web

http://Wikipedia.org

http://Java.sun.com

http://www.cmcrossroads.
com/bradapp/docs/sdd.html

Java How to Program, 6/e Deitel and Deitel.









**************************End of Document**************************