• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Can anyone please review my design?

 
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, I am preparing for toefl and thought why not write an application which asks me a random meaning for a word from a dictionary. Then I started coding this application. I have written this and its also working fine. I would like programmers here to comment on my design and code. So that I can learn and become better.

Dictionary is nothing but a properties file. I will enter the key value pair in the properties file myself. My program will load all words and corresponding meanings from the properties file at initialization itself. Then my application will pick a random word and its corresponding meaning(s). There is a UI from which the user will input the answers and then the program will check and alert the user whether the answer is right or not.

Later I am going to add soundex functionality also, suppose in case a user enters a misspelled word.

I can also attach the code to this post. But I am not sure whether I can attach or not according to the policies and standards of coderanch.
vocabulary_class.png
[Thumbnail for vocabulary_class.png]
Class diagram
 
Ranch Hand
Posts: 859
IBM DB2 Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quite a difficult task IMHO.

How will you know the user gives the correct definition?
An exact String comparison which would have to match your property value?

As for your Class diagram, not sure what it's telling me.

WP
 
Sheriff
Posts: 17665
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why go to all the trouble of implementing your own dictionary? Why not build on something that's already there? If you're just studying for the TOEFL, all you really need is a way to get definitions of words, right? I would start with finding a Word of The Day site, then maybe find an API to get word definitions, like http://developer.wordnik.com/

Here's what my first-cut design might look like:

Maintenance:
1. Grab a word from word-of-the-day site.
2. Add it to my list of study words.

Drill:
1. Randomly pick out a word from the list of study words - present this as the "test" word
2. Call the API to get the word definition
3. Randomly pick out 3 or 4 other words from list of study words and get their definitions
4. Present the definitions for the user to choose the right one
5. User enters answer
6. Tell user if they are right or wrong

Even though this might turn into a fun little side project, that's way too much programming for me if all I really wanted to do was study for the TOEFL. I'm just lazy, I guess.
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:Why go to all the trouble of implementing your own dictionary? Why not build on something that's already there? If you're just studying for the TOEFL, all you really need is a way to get definitions of words, right? I would start with finding a Word of The Day site, then maybe find an API to get word definitions, like http://developer.wordnik.com/

Hi Mr. Junilu, the idea behind my own dictionary is, I am reading Cambridge preparation for TOEFl textbook. So I am noting all the words I hit in the book in my mobile. Now instead, I wrote my own small java program to ask me a random question from the properties file at scheduled intervals. So that I can be in track with my preparation while at office also.

Moreover my application asks me to enter the meaning instead of a word instead of selecting from a list. can do this using the web services also. Again I would want to store the word and corresponding meaning(for future use) if I am using a web service. So at the end of the day again I will have a dictionary.

My intention is to save a word when I hit it while reading something and let my program ask me the meaning of the word sometime in the future. Instead of pinging a web service and getting a word I don't know and dint even heard. Basically I am poor at vocabulary.

Or instead of doing all this java stuff, I can simply go to www.freerice.com and learn vocabulary. I can save more time. I want to combine my learning with java.

For example I used to use the word "Best" to praise something. I don't know about the word "Elite" before I read some passages. So if I ping a service and get a word which I don't even know, it is of no use to me.

This is how I learn.

Can I attach my code to this post so that you or someone can review it and suggest me regarding some best coding practices.

Thank you, good day
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William P O'Sullivan wrote:Quite a difficult task IMHO.

How will you know the user gives the correct definition?
An exact String comparison which would have to match your property value?

As for your Class diagram, not sure what it's telling me.

WP


To match the word even if the spelling mismatch I will use soundex algorithm. Of course I need not implement this functionality because there should not be spelling mistakes. If the user enter a misspelled word he will become aware if my application says it is wrong. One can learn better.

I may or may not add the soundex functionality.
 
Junilu Lacar
Sheriff
Posts: 17665
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chaitanya, you are welcome to post short snippets of code for discussion about specific questions or doubts you may have. Posting 100+ lines of code is less useful because few people will take the time to read through that much code. Posting code as an attachment is the least useful for you because hardly anyone, if any at all, will take the time to open up the attachment and go through potentially hundreds of lines of code.

If you post small snippets of code, please use the code tags (click on the Code button in the editor) to make the code more readable and preserve indentation and spacing.

Thanks
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:Chaitanya, you are welcome to post short snippets of code for discussion about specific questions or doubts you may have. Posting 100+ lines of code is less useful because few people will take the time to read through that much code. Posting code as an attachment is the least useful for you because hardly anyone, if any at all, will take the time to open up the attachment and go through potentially hundreds of lines of code.

If you post small snippets of code, please use the code tags (click on the Code button in the editor) to make the code more readable and preserve indentation and spacing.

Thanks

Thank you Mr. Junilu, I will post some sample code snippets. I will just list the snippets where I want you people to focus and will update this thread ASAP. However I found that the present architecture is tightly coupled. In my next reply I will post the previous code snippets and new design.

Thank you.
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, this is how I designed my application.

1. There is a main class called EntryPoint.
2. First initializes the Dictionary. The DictionaryImpl needs a properties file.
3. Next it will initialize the Validator. The ValidatorImpl has methods defined to check the inputted answer with the exact answer.
4. Initializes the UI and supplies dictionary and validator to the UI.
5. The UI class takes over from this point.
6. UI will call a populate() method which randomly selects a word from the dictionary. When the user inputs a value and hits check button the, it calls the Validator's validateInput() method.


This is how it works. Below are the code snippets of some crucial elements. I would like experts here to comment on my code.DictionaryImpl.javaUI.javaComments are appreciated. Thank you all in advance. Good day.
 
Popeye has his spinach. I have this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic