Started my first developer job a year ago and I’m trying to get a feel for best practices, particularly around method design. I find the company I work at uses “god” objects. Each system has one or two objects that are the main parameter to many methods. They contain hundreds if not thousands of nested fields, and many of the methods that get passed them only use/update a field or a closely nested subset of fields in the god object. In my opinion this seems dangerous, as you are indirectly giving methods references to objects they have no business seeing or modifying. I recognize that Java (the language we use) is, for practical purposes, pass by reference, so their is no inefficiency in passing references to large objects, but am I correct in saying that this use of god objects is dangerous and should be avoided? If people could share their thoughts and any readings they have, I would greatly appreciate it.
Aucun commentaire:
Enregistrer un commentaire