Skip to main content
7 events
when toggle format what by license comment
Aug 23, 2014 at 15:04 comment added Michaël Le Barbier @JoshuaTaylor I was maybe not clear about this: I mean, the person implementing the class has to be careful about not accessing undefined state, not the class user. (Keeping the class user away from such errors is the whole story of that question!)
Aug 23, 2014 at 13:24 comment added Joshua Taylor @MichaelGrünewald If you only interact with the object through the particular interface that's specified at a given point, there shouldn't be any way (without casting, etc.) to access that state.
Aug 23, 2014 at 13:20 comment added Michaël Le Barbier @JoshuaTaylor Sharing data among instances of the interface is twofold: while it might be easier to implement, we have to be careful not accessing “undefined state” (like accessing the client address of a non-connected server). As the OP set emphasis on interface usability, we can judge the two approaches equal. Thnak you for quoting the “step builder pattern” BTW.
Aug 23, 2014 at 12:38 comment added Joshua Taylor This is essentially the step builder pattern.
Aug 23, 2014 at 12:38 comment added Joshua Taylor @MichaelGrünewald It's not necessary to implement all the interfaces with one class, but for a configuration-type object, it may be the simplest implementation technique to share the data between instances of the interfaces (i.e., because it's shared by virtue of being the same object).
Aug 22, 2014 at 13:37 comment added Michaël Le Barbier What is the advantage of having just one underlying class instead of several? As this is the only difference with the solution I proposed, I would be interested in this particular point.
Aug 22, 2014 at 13:04 history answered Falco CC BY-SA 3.0