|
|
|
|
|
by davej
4429 days ago
|
|
Thanks for the feedback. I would argue that the Classy example is more expressive and crucially it is DRY. Edit: > One of the brilliant things about angular is that it provides a proper structure that anyone that needs to write angular needs to adhere to Angular doesn't provide structure for controllers, they are just javascript functions. If you want to add structure it is up to the individual developer to decide how to do it. Classy is just the way that I like to do it, Classy is opinionated so it won't be for everyone. By the way, you can do inheritance but I haven't documented and fully tested it yet. |
|
Still, besides that: DRY is IMO not about these 2 lines that you've refactored away here. It's about whole functions/classes that have similar functionality where you're repeating yourself.
Therefore, this would be a micro-optimisation with negative results on impact on performance most likely (since there's more overhead)