Dictionary Builder Application

Discussion in 'Java' started by j1mb0jay, Jan 27, 2008.

  1. j1mb0jay

    j1mb0jay Guest

    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
    j1mb0jay, Jan 27, 2008
    #1
    1. Advertising

  2. j1mb0jay

    Christian Guest

    j1mb0jay schrieb:
    > 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
    Christian, Jan 27, 2008
    #2
    1. Advertising

  3. j1mb0jay

    j1mb0jay Guest

    Christian wrote:
    > j1mb0jay schrieb:
    >> 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)

    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
    j1mb0jay, Jan 28, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ilias Lazaridis
    Replies:
    6
    Views:
    438
    Ilias Lazaridis
    Feb 21, 2006
  2. james_027
    Replies:
    1
    Views:
    325
    Marc 'BlackJack' Rintsch
    Aug 22, 2007
  3. Phlip
    Replies:
    5
    Views:
    562
    Stefan Behnel
    Jan 13, 2010
  4. Navkirat Singh
    Replies:
    6
    Views:
    3,033
    Navkirat Singh
    Jul 29, 2010
  5. Chris Rebert
    Replies:
    0
    Views:
    524
    Chris Rebert
    Jul 29, 2010
Loading...

Share This Page