in case 1 the program will ask the user to insert a set of parameter.
in case 2 the program will parse the input opts and related args
in case 3 the program will read a set of commmand inside a file and in that case will performs a task.
They might be other way to start the program but whatever is the way the goal is to build a particular object of a particular class (i think it doesn't matter know too many details of which task and how the task is performed).
My doubt is the following... i was wondering how to handle this step in a non "monolitic way". I mean... the simplest way could be
of course in this way i have to concentrate too much stuff in the same class... instead i'm implementing the whole by the design pattern "chain of responsability".
so... if i passed nothing/file/command line the proper handler would perform the correct task and moreover i suppose it would be easier to be extended with other class, decoupled from the old one.
Do you think that this kind of design can be good? i highlight the task is not trivial... so i'm struggling in find a good design.
if( case 1...) {...}
elseif(case 2...) {...}
elseif(case 3...) {...}
could be the basis of some kinda factory method, returning you one of 3 objects, all which implement some kind of interface with a "Run()" method, or something like that.e.g.
Because what i need is to initialize an object in one of the way...
I'm understanding that probably the best way is (simply) use the callback right?
PS. Further you've to consider that i could interact with such tool with a GUI in the future, so i want something of flexible to this. Probably thinking now at this things it's a bit tricky, but i think i can benefit from this kind of design.