arcalot / arcaflow-expressions

Expressions language for Arcaflow
Apache License 2.0
0 stars 0 forks source link

Refactor to use Visitor Pattern #6

Closed jaredoconnell closed 1 year ago

jaredoconnell commented 1 year ago

Please describe what you would like to see in this project

We have determined that the visitor pattern is likely better than using switch cases for the evaluation of expressions.

By switching to the visitor pattern, the code will become more compartmentalized, which should improve maintainability and flexibility.

jaredoconnell commented 1 year ago

After exploring this, and trying generics, I think I will keep the switches, but refactor it to not have it all in one function. The biggest limitation of this pattern in Go is that there are restrictions on parameters and return values. So unless every permutation of args is specified in the internal structure, it doesn't work. And specifying each permutation defeats some of the purpose of it in this situation. I think switches are clearest, too.