samedi 27 juin 2015

Are global functions considered good practice in OOP?

Some OOP code I've seen, uses global functions to obtain data or return an object. For example, in Laravel we have functions like app(), config(), view() etc.

Is it considered a good practice to create global functions in addition to/instead of injecting dependencies? What are the benefits and what are the drawbacks?

Aucun commentaire:

Enregistrer un commentaire