Solved

Help required in designing a Java application

Posted on 2012-04-12
5
603 Views
Last Modified: 2012-08-13
I am seeking the help for the best Java design that I should use for a particular scenario described below.

1) A button press generates a String Array that contains 'n' strings.

2) I need to check whether this 'Generated Array' contains a pre-defined string(out of 'n' pre-defined strings).

3) If the 'Generated Array' contains any of the pre-defined strings, I need to take an action.

What is the best way of designing this application/ How should I model the classes?

Following is the raw thought I have

1) Main class which handles the Array Generation on Button press
2) A dedicated class for pre-defined strings in which I define 10, 100 , 1000 or more pre-defined strings alone?
3) A dedicated class to handle the actions, if match occurs between 'Generated Array' strings and pre-defined string?

Is this the correct model? Are there any other better design than this?


Best suggestions and guiding is much appreciated
0
Comment
Question by:Sreejith22
5 Comments
 
LVL 41

Expert Comment

by:HonorGod
ID: 37844389
When you say "a button press", that implies a graphical user interface (GUI).
Did you really mean that?

If so, which GUI framework will you be using?  Swing?

How familiar are you with event driven application development?
0
 
LVL 20

Assisted Solution

by:gatorvip
gatorvip earned 117 total points
ID: 37844412
>>A button press generates a String Array that contains 'n' strings.

I don't understand this part - you create random strings? Otherwise this reads like a simple array declaration to me.
i.e., String[] arr = new String[n];

>>2) I need to check whether this 'Generated Array' contains a pre-defined string(out of 'n' pre-defined strings).

How do you populate your array, where are the string values coming from?
0
 
LVL 37

Assisted Solution

by:zzynx
zzynx earned 116 total points
ID: 37844910
>> 1) Main class which handles the Array Generation on Button press
Agree. And that also triggers the action to be taken in case of a match [3)]

>> 2) A dedicated class for pre-defined strings in which I define 10, 100 , 1000 or more pre-defined strings alone?
Agree. And that also contains a method that takes an array of strings as a parameter and returns a boolean telling you if the passed Array contains any of the pre-defined strings.

>> 3) A dedicated class to handle the actions, if match occurs between 'Generated Array' strings and pre-defined string?
Can be a dedicated class. But can also be a method defined in your main class. Depending on how complex the action to be taken is
0
 
LVL 8

Accepted Solution

by:
stmani2005 earned 117 total points
ID: 37896981
Use Abstract class and Interface

Abstract class you define the method and generate Array Using Interfact Reference you get the arrat

Use Swing Button When Action Perform method you would call the Interface and abstract class

Or JSP UseBean you callt the abstract class or Intrface
0
 
LVL 37

Expert Comment

by:zzynx
ID: 37918081
Thanx 4 axxepting
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
topping2 challenge 13 83
what is the difference between "sudo su" and "su - root" 6 107
HSSFWorkbook cannot be resolved error 10 51
Java SE 8u111  Lot of stuff broke 11 54
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now