Why not use a map of types (CImplCImpl
concrete instances) that are instantiated upon FactoryFactory
initialization? The values of the map would be instances of BImpl
, DImpl
, etc, and the respective keys would be the types. The function getBuilderFor()getBuilderFor()
would just do a map lookup and on the value returned from the map, call BuilderImpl()BuilderImpl()
and return the result.
This approach would allow to avoid the if/else block. Additionally, it would make it easier and more elegant to add more types in the future.
Why not use a map of types (CImpl concrete instances) that are instantiated upon Factory initialization? The values of the map would be instances of BImpl
, DImpl
, etc, and the respective keys would be the types. The function getBuilderFor() would just do a map lookup and on the value returned from the map, call BuilderImpl() and return the result.
This approach would allow to avoid the if/else block. Additionally, it would make it easier and more elegant to add more types in the future.
Why not use a map of types (CImpl
concrete instances) that are instantiated upon Factory
initialization? The values of the map would be instances of BImpl
, DImpl
, etc, and the respective keys would be the types. The function getBuilderFor()
would just do a map lookup and on the value returned from the map, call BuilderImpl()
and return the result.
This approach would allow to avoid the if/else block. Additionally, it would make it easier and more elegant to add more types in the future.
Why not haveuse a map of types (CImpl concrete instances) that are instantiated upon Factory initialization?
For example, the The values of the map couldwould be instances of BImpl
and, DImpl
, etc, and the respective keys would be the types, thus avoiding the if/else block. YouThe function getBuilderFor() would just do a map lookup and on the value returned from the map, call BuilderImpl() and return the result.
This approach would alsoallow to avoid the if/else block. Additionally, it would make it easier and more elegant to add more types in the future.
Why not have a map of types that are instantiated upon Factory initialization?
For example, the values of the map could be instances of BImpl
and DImpl
and the respective keys would be the types, thus avoiding the if/else block. You would just do a map lookup and on the value returned from the map, call BuilderImpl and return the result.
This would also make it easier and more elegant to add more types in the future.
Why not use a map of types (CImpl concrete instances) that are instantiated upon Factory initialization? The values of the map would be instances of BImpl
, DImpl
, etc, and the respective keys would be the types. The function getBuilderFor() would just do a map lookup and on the value returned from the map, call BuilderImpl() and return the result.
This approach would allow to avoid the if/else block. Additionally, it would make it easier and more elegant to add more types in the future.
Why not have a map of types that are instantiated upon Factory initialization?
For example, the values of the map could be instances of BImpl
and DImpl
and the respective keys would be the types, thus avoiding the if/else block. You would just do a map lookup and on the value returned from the map, call BuilderImpl and return the result.
This would also make it easier and more elegant to add more types in the future.
Why not have a map of types that are instantiated upon Factory initialization?
For example, the values of the map could be instances of BImpl
and DImpl
and the respective keys would be the types, thus avoiding the if/else block. This would also make it easier and more elegant to add more types in the future.
Why not have a map of types that are instantiated upon Factory initialization?
For example, the values of the map could be instances of BImpl
and DImpl
and the respective keys would be the types, thus avoiding the if/else block. You would just do a map lookup and on the value returned from the map, call BuilderImpl and return the result.
This would also make it easier and more elegant to add more types in the future.