Interface system (screen+inputs) design pattern

Hi, I’ve been reading classic design patterns in https://refactoring.guru, however I can’t find some specific examples on how to design a simple menu system.

Say you have a hardware screen, and some up+down+enter input buttons. How would you design that in pseudocode? do you have any videos or posts to recommend?

I imagine having these classes:

  • Widget
  • WidgetOne(Widget)
  • WidgetTwo(Widget)
  • Screen
    • list of widgets
    • render() loops through widget’s render()
  • Controller
    • has the input button callbacks

Inside Screen might start a thread to update the display, rendering all widgets.
However, I don’t understand how the Screen & Controller could communicate each other to display.

This is not a great example, but I’m sure there are patterns for something similar.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.