Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you know any patterns for GUI programming? (Not patterns on designing GUIs)

I'm looking for patterns that concern coding parts of a GUI. Not as global as MVC, that I'm quite familiar with, but patterns and good ideas and best practices concerning single controls and inputs.

Let say I want to make a control that display some objects that may overlap. Now if I click on an object, I need to find out what to do (Just finding the object I can do in several ways, such as an quad-tree and Z-order, thats not the problem). And also I might hold down a modifier key, or some object is active from the beginning, making the selection or whatever a bit more complicated. Should I have an object instance representing a screen object, handle the user-action when clicked, or a master class. etc.. What kind of patterns or solutions are there for problems like this?

like image 342
Peteter Avatar asked Aug 14 '08 16:08

Peteter


People also ask

How do you know which design pattern to use?

To use design patterns effectively you need to know the context in which each one works best. This context is : Participants — Classes involved. Quality attributes — usability, modifiability, reliability, performance.

What are the 3 design patterns?

Design Patterns are categorized mainly into three categories: Creational Design Pattern, Structural Design Pattern, and Behavioral Design Pattern.

What is an example of a design pattern?

Design patterns provide a standard terminology and are specific to particular scenario. For example, a singleton design pattern signifies use of single object so all developers familiar with single design pattern will make use of single object and they can tell each other that program is following a singleton pattern.


2 Answers

I think to be honest you a better just boning up on your standard design patterns and applying them to the individual problems that you face in developing your UI.

While there are common UI "themes" (such as dealing with modifier keys) the actual implementation may vary widely.

I have O'Reilly's Head First Design Patterns and The Poster, which I have found invaluable!

Shameless Plug : These links are using my associates ID.

like image 174
Rob Cooper Avatar answered Sep 20 '22 05:09

Rob Cooper


Object-Oriented Design and Patterns by Cay Horstmann has a chapter entitled "Patterns and GUI Programming". In that chapter, Horstmann touches on the following patterns:

  • Observer Layout Managers and the
  • Strategy Pattern Components,
  • Containers, and the Composite Pattern
  • Scroll Bars and the Decorator Pattern
like image 22
DTS Avatar answered Sep 21 '22 05:09

DTS