I'm learning Java, and am on course of Software design, very simple such, mostly basics of UML and the design principles.
There was discussion on interfaces, and the teacher something puzzling. There are reasons why I didn't ask clarification from him, and I'd suppose multiple views are good anyways, so I'm asking you: He said that interfaces most usually define the getters and setters of class. When I look native interfaces, they make only small portion of the methods.
Furthermore, isn't it bad to define them in interface, since then you're also saying what attributes there should be in the implementing class? And isn't that dangerous on the principle that you have access only to the services of objects, not to their variables (unless necessary).
He also said that objects should communicate mostly or purely by getters and setters. This seems odd to me too. Shouldn't it be methods offered by other objects?
There was discussion on interfaces, and the teacher something puzzling. There are reasons why I didn't ask clarification from him, and I'd suppose multiple views are good anyways, so I'm asking you: He said that interfaces most usually define the getters and setters of class. When I look native interfaces, they make only small portion of the methods.
Furthermore, isn't it bad to define them in interface, since then you're also saying what attributes there should be in the implementing class? And isn't that dangerous on the principle that you have access only to the services of objects, not to their variables (unless necessary).
He also said that objects should communicate mostly or purely by getters and setters. This seems odd to me too. Shouldn't it be methods offered by other objects?