i parsed an xml document some days ago into a java model. the java class model was according to the xml model. so i got a reference to the root object and made chained calls to the relevant object. dont see any smell here
No, of course that's just accessing some specific external data on the boundaries of your program. I was talking more about general modeling. For example, if you had modeled the object that is represented by that XML, you probably wouldn't be acessing that element directly but rather deserializing it into a real world object that interacts with the rest of your model in some other way.
3
u/HwanZike Apr 14 '23
I don't see how the field data types are important here. It's a matter of encapsulation and coupling. See:
https://en.wikipedia.org/wiki/Law_of_Demeter
https://oowisdom.csse.canterbury.ac.nz/index.php/Message_chain_smell