Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Labels:None
-
Number of attachments :
Description
when looking through some GroovyFX code with @aalmiray,
he frowned at lengthy switches on type codes as e.g. in TransformFactory.
The alternative would be to use separate builder instances as e.g. with ShapeFactory.
When Andres first voiced his disapproval of the switch statements, I converted a couple of the worst offenders and profiled. It basically comes down to a slight gain in performance (separate instances) vs a slight savings in memory overhead (one instance with switch). The differences were minimal, so I didn't bother converting the rest of the factories.
Given that, it's mostly a code style issue. If you feel strongly enough about it that you want to refactor the rest of the factories, I say go for it!