views:

21

answers:

2

Hello,

I have a class diagram ("Customer") with some private and public attributes as well as some operations. Now I want to model a dialog (GUI) for editing this customer. The window represents the class Customer and some drop downs and checkboxes the attributes. The operations ("save", "refresh") are represented by buttons.

Design Question: Do I design my GUI dialog only for editing public attributes or also for editing private attributes?

(This is a pure object-oriented design question, there is no implementation.)

+1  A: 

The GUI should only interface with the class via public methods, not attributes, and never private members.

Generally it's a good idea to separate the GUI from the Model. The Model-View-Controller design pattern is a common, tried and true approach.

bitc
+1  A: 

If we apply the 'encapsulation' concept, the UI should take care only for the public properties (better if them have accessors methods).

Aito