L
L
Lopus2020-01-20 17:39:47
Software design
Lopus, 2020-01-20 17:39:47

How can the architecture of the tree menu module be organized?

A console application in which you need to organize a menu with sequential selections, delving into the specifics.
For example, when the application starts, a list of 5 items is displayed. Choose. Then again the list (2-10 items). The third time we choose. And on the fourth, when choosing, some action is already taking place. There can be many levels.
So far, one sees either some kind of multidimensional array with a tree and links to listing objects, or a one-dimensional array of objects and each object has a childs with its own one-dimensional array of nested objects.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2020-01-20
@sarapinit

The State design pattern is designed for this purpose. https://refactoring.guru/ru/design-patterns/state

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question