开发者

Coming from a class diagram to a dialog window

开发者 https://www.devze.com 2022-12-27 12:06 出处:网络
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

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.)


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消