Вопрос

I need to develop a simple declarative language to drive an application. I have various computational modules, some of them depending on other modules which also need setup. The problem is that I don't know how to manipulate the keywords. I will explain myself with an example

Task optimize
Units meters
System {
   // input data
}

Optimizer {
     type Simplex
     convergenceCriteria 0.001
}

PointEvaluator {
     type MyEvaluatorTechnique
     convergenceCriteria = 0.1
}

this is a solution, which has header very generic entities which describe the meaning of each section, but I could also have sections that explicity concern specific techniques

Task {
     type optimize
     optimizer Simplex
}
Units meters
System {
   // input data
}

Simplex {
     convergenceCriteria 0.001
     PointEvaluator MyEvaluatorTechnique
}

MyEvaluatorTechnique {
     convergenceCriteria = 0.1
}

I would like to hear your opinion on which method may sound better in terms of design correctness, and pros and cons of both solutions. One thing I don't like in the first solution is, for example, the fact that depending on the type, I may have options that do not make sense for that specific type. In the second solution, however, I am setting up not the generic task (which then uses specific types of subsystem). Instead, I specify the specific subsystems performing the task.

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
scroll top