jeudi 21 mai 2015

emberjs mixin vs extend

I am thinking of using dockyard validations in my project

I have options as to how to use the Validations-Mixin from dockyard

  • Approach 1 to have a BaseController which will mixin this Validations-Mixin and get the functionality in all controllers

  • Approach 2 use the Mixin directly.

Pros of 1 no need to import ember-validations in every file and mixin manually , and I get the functionality of validations in all the controllers.

Cons of 1 Validations might not be required in all the controllers , may be it's required only in 50% of the cases, also might reorder the way existing controllers add the mixins.

Pros of 2 Simple, only who need the functionality will import and use it.

Cons of 2 importing in each file where required and adding the mixin.




Aucun commentaire:

Enregistrer un commentaire