Chapter 13 Graphical User Interface Components: Part 2 (Domain and web hosting)

Chapter 13 Graphical User Interface Components: Part 2 793 then be added to a menu, toolbar, popup menu or other mechanisms. This design pattern is called Command because it defines a user command, or instruction. This pattern allows a designer to encapsulate a command, so that the command may be used among several objects. Observer Suppose we want to design a program for viewing bank account information. This system includes class BankStatementData to store data pertaining to bank statements, and classes TextDisplay, BarGraphDisplay and PieChartDisplay to display the data.2 Figure 13.23 shows the design for our system. Class TextDisplay displays the data in text format, class BarGraphDisplay displays the data in bar-graph format and class PieChartDisplaydisplays the data as a pie chart. We want to design the system so that the BankStatementData object notifies the objects displaying the data of a change in the data. We also want to design the system to loosen coupling the degree to which classes depend on each other in a system. Software Engineering Observation 13.9 Loosely-coupled classes are easier to reuse and modify than are tightly-coupled classes, which depend heavily on each other. A modification in a class in a tightly-coupled system usually results in modifying other classes in that system. A modification to one of a group of loosely-coupled classes would require little or no modification to the other classes in the group. The Observer design pattern is appropriate for systems like that of Fig. 13.23. This pattern promotes loose coupling between a subject object and observer objects a subject notifies the observers when the subject changes state. When notified by the subject, the observers change in response to the change in the subject. In our example, the Bank- StatementData object is the subject, and the objects displaying the data are the observers. A subject can notify several observers; therefore, the subject contains a one-tomany relationship with the observers. notifies notifies notifies BankStatementData TextDisplay BarGraphDisplay PieChartDisplay Fig. 13.23Basis for the Observer design pattern. 13.23 2. This approach is the basis for the Model-View-Controller architecture pattern, discussed in Sections 13.17 and 17.11.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web design programs services

Leave a Reply