Dictionary Builder Application

J

j1mb0jay

I have created a program to build a dictionary file. This program uses a
simple socket connection to a news server and stores each word in a
article found in every group. These words are stored in a hash table to
help make the insert time of each word as small as possible. The
popularity of each word is also stored and the list is sorted before
saving to a text file. Please if you have time can you download the
source code and let me know what you think of it.

http://users.aber.ac.uk/jap6/filedetails.php?id=wordlistbuilder&type=zip

Regards j1mb0jay
 
C

Christian

j1mb0jay said:
I have created a program to build a dictionary file. This program uses a
simple socket connection to a news server and stores each word in a
article found in every group. These words are stored in a hash table to
help make the insert time of each word as small as possible. The
popularity of each word is also stored and the list is sorted before
saving to a text file. Please if you have time can you download the
source code and let me know what you think of it.

http://users.aber.ac.uk/jap6/filedetails.php?id=wordlistbuilder&type=zip

Regards j1mb0jay

I am sorry to say it but I think your application is horrible.

several things:

- try using lower case letters for method names (have a look at Java
coding conventions)
- Don't implement your own HashTable use Java's HashMap
- Don't implement your own LinkedList .. use some list implementation
Java already has
- There is really no need for you to store the hashcode of a string..
(Word.java)
- I would recommend against reusing the name of java api classes.
Especially don't reuse popular names like "Socket" or if you even use
Socket in your own Socket class.

- code looks cleaner if you use import statements consequently

About your IO
Its better to throw exceptions to a level that can handle it
If an IOException occurs for example when writing your word list. The
exception will be printed out.. still the hashtable will keep writing to
your FileWriter as it doesn't know that an exception occured.

Also don't simply catch Exception .. be a bit more specific .. just
catch IOException ..



I recommend you to practice coding. May be start reading some example
code on Java's learning trails. Try to adapt the coding style you can
see there.


Christian
 
J

j1mb0jay

Christian said:
I am sorry to say it but I think your application is horrible.

several things:

- try using lower case letters for method names (have a look at Java
coding conventions)
I will take this into consideration (have been used to writting C#
before this point).
- Don't implement your own HashTable use Java's HashMap
- Don't implement your own LinkedList .. use some list implementation
Java already has
I have to implement my own version of these data structures as this is
coursework and i require an understanding of how these work and i feel
this is a good way of doing this.
- There is really no need for you to store the hashcode of a string..
(Word.java)
I understand where you are coming from, and will remove this propriety
from the word class. I just thought it would be faster if i stored it
rather than calculating it each time (but this thought is wrong as i
would just look at the index into the array - as this is the hashCode)
- I would recommend against reusing the name of java api classes.
Especially don't reuse popular names like "Socket" or if you even use
Socket in your own Socket class.

- code looks cleaner if you use import statements consequently
I will start working on renaming the class names.
About your IO
Its better to throw exceptions to a level that can handle it
If an IOException occurs for example when writing your word list. The
exception will be printed out.. still the hashtable will keep writing to
your FileWriter as it doesn't know that an exception occured.

Also don't simply catch Exception .. be a bit more specific .. just
catch IOException ..
Throwing exceptions is something i will start working on the final
version of the application. At the moment I just wanted to test to make
sure it worked.
I recommend you to practice coding. May be start reading some example
code on Java's learning trails. Try to adapt the coding style you can
see there.
I have read an understand some of the Java coding practices. Like i said
i am used to writing C#.
Christian

Thanks for your time. Hope the code didn't make you cringe to much
....!!! Have not been writing Java for to long.

Regards James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top