mardi 24 novembre 2015

If getOrCreate is an antipattern, how can I avoid it?

According to http://ift.tt/q0MLpA I believe getOrCreate function is an antipattern.

function getOrCreateObj(something) {
  let f = find(something, db); 
  return f || createObj(something);  
}

What should I do to avoid it?

Aucun commentaire:

Enregistrer un commentaire