lundi 15 février 2016

Which pattern to use reading from configuration and start different runners using Java

I have simple problem and want advice how to improve the design I will try not to give details of my implementation but to be more abstract.

I have a configuration file with xml structure.(but can be changed)

<configurations>
   <conf>
     <path1></path1>
     <path2></path2>
   <conf>
   <conf>
     <path1></path1>
     <path2></path2>
   <conf>
</configurations>

where path1 and 2 are paths to some files which are needed in the business logic where I do repeatable actions with this paths many times(like banchmarks) Then using this paths I need to do some operations but the content of every conf is separated from one another they can run in parallel without problems.

So first I read the configuration and store them in a List and then iterate over the list and execute consecutively the business logic.

I am wondering how can I improve the design of my decision?

I think I can use Iterator patter to iterate over the structure and to accomplished the repeatable logic for every cong to use the Strategy pattern.

Am wondering how to separate logic to use different runners for operations in every conf tag?

Aucun commentaire:

Enregistrer un commentaire