KJW
KJW

Reputation: 15251

Netbeans: how to separate application logic from view?

When creating a desktop application in Netbeans,

what is the recommended approach in separating application logic from the view (gui builder) ? The two files are generated by the gui builder in Netbeans.

Upvotes: 1

Views: 413

Answers (2)

MTS
MTS

Reputation: 55

Well the short and general answer (for any object oriented language) is to use the Model View Controller or MVC design pattern.

What's so cool about this, is that in decoupling the view (the interface code) from the model (your app logic) you can easily add multiple interfaces (such as a command line and a GUI), or port to different platforms, while keeping your back end business logic the same.

Check out the book Design Patterns: Elements of Reusable Object-Oriented Software by the "Gang of Four". It is the canonical design pattern book. In addition to MVC, there are a ton of other really useful design patterns. Even skimming it will pay great dividends when you go to architect some software.

Upvotes: 0

Peter Lang
Peter Lang

Reputation: 55594

You might want to read the Sun article about Java SE Application Design With MVC.

Here is an example: Model-View-Controller (MVC) Structure.

Upvotes: 1

Related Questions