Are you suggesting the database be hardcoded into the objects, or passed to the constructor?
Storage is not a concern of the business object "MyObject".
Sorry maybe I'm missing something the purpose of this and your original comment, can you elaborate?
I didn't think there was really any model type classes in this post; save the undefined MyObject. I'm not saying that classes with behavior are bad, I meant more as if it's implementing an interface, then the consumers can work with the interface, rather than the concrete. This, at least in my opinion, is a better high level design, and makes it easier on consumers/callers to understand a system, rather than getting bogged down in the details of implementation.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
the moment when classes with behavior are considered the "least good abstraction"...after all Java is an objected oriented language.
I suggest to read martinfowler.com/bliki/AnemicDomai... .
Are you suggesting the database be hardcoded into the objects, or passed to the constructor?
Storage is not a concern of the business object "MyObject".
no. it's a statement against shallow data classes without behavior.
I don't see why you'd assume
MyObject
doesn't have rich methods and doesn't protect its invariants.Sorry maybe I'm missing something the purpose of this and your original comment, can you elaborate?
I didn't think there was really any model type classes in this post; save the undefined
MyObject
. I'm not saying that classes with behavior are bad, I meant more as if it's implementing an interface, then the consumers can work with the interface, rather than the concrete. This, at least in my opinion, is a better high level design, and makes it easier on consumers/callers to understand a system, rather than getting bogged down in the details of implementation.