mercredi 5 février 2020

Design Pattern for invoking a Parser in a callback

I have an application that invokes callback function when a certain action is performed on the application.

Inside this callback function, I would like to invoke a Parser (a command line parser for instance).

This Parser would be running in a while loop and exits and comes back to the callback only when the user uses the command 'quit' on the command line.

Inside the while loop, the user always has access to the command line. Based on the user input on the command line, the Parser takes a unique action. For instance, it will set a variable and it goes to a database like so:

command-line>a 100
command-line>

Here the parameter a in DB would be set to 100.

I want to model the Parser using Object-Oriented Design. Which Design Pattern can I use in this case?

Aucun commentaire:

Enregistrer un commentaire