Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Building classes in gui apps

  Asked By: Fern    Date: Feb 20    Category: Java    Views: 517

In theory, what is the best way to break down a Java program into appropriate
classes? For example, I hava a small GUI based program, One book I've read
shows creating one class for the complete program. Another book I have shows
breaking this type of program into seperate classes for the Gui, actionPerformed
for each type of GUI object, the closing method, and a seperate main() class.
In the "Real programming world", how is this to be done?



3 Answers Found

Answer #1    Answered By: Mercedes Andrews     Answered On: Feb 20

For anything larger than a sample program  it is a good idea to break  it
up into several classes. You should try your best to design your system
so that each class  is a black box component which can be reused as

One thing though: I hope you are not confusing methods with classes. It
is hard to tell from your message below.

Answer #2    Answered By: Fuzairah Neeman     Answered On: Feb 20

What do you mean by a black box component? Could you
care to elaborate this a little tad more?

Answer #3    Answered By: Brandi Ramirez     Answered On: Feb 20

create his classes  so they can easily be re-
used. Black Box is frequently mentioned in testing. BlackBox refers
to knowing the input and output without knowing the inner workings of
the class. Another programmer can take Tim's class  and use it in
thier program  without worrying about how it works, just that it works
correctly. Of course Tim can re-use his class in other programs as
well. The class should be a free standing component. By contrast,
White Box aka "Glass Box" refers to knowing the code inside the

Didn't find what you were looking for? Find more on Building classes in gui apps Or get search suggestion and latest updates.