?
Solved

Help required in designing a Java application

Posted on 2012-04-12
5
Medium Priority
?
622 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 351 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 348 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 9

Accepted Solution

by:
Manikandan Thiagarajan earned 351 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month15 days, 23 hours left to enroll

850 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