mardi 25 avril 2017

Is it better to add variables to capture state or create a new file for that specific state?

I have a piece of code that runs pretty much the same except in certain situations/contexts it has some minor modifications when it's called in that situation/context.

Is it better to capture the states of the context in state variables? Pros: less code/more reusability Cons: will make the code less readable and more complex as more state modifications are added.

OR

Is it better to create a new file for that specific context?

pros: easy readability because no state variables, one file per state .
cons: less dry.

Aucun commentaire:

Enregistrer un commentaire