The PEAK Developers' Center   Diff for "WritingInterfaces" UserPreferences
 
HelpContents Search Diffs Info Edit Subscribe XML Print View
Ignore changes in the amount of whitespace

Differences between version dated 2004-09-22 12:02:16 and 2007-03-26 18:24:26 (spanning 3 versions)

Deletions are marked like this.
Additions are marked like this.

''The following were taken from a thread where Phillip was addressing component design concepts for a beginner. Some editing was applied. For the full context, please see the links given below.''
 
From http://www.eby-sarna.com/pipermail/peak/2004-September/001780.html :
 
Interfaces are behavior-oriented, and you should question any interface whose name is a noun that doesn't imply behavior (e.g., IAttachable, IConfigurable, IResolver, IObject``Factory).
 
An interface usually is about a single, clear responsibility. Generally speaking, you don't want to lump multiple responsibilities into an interface, because you might want to perform them using different objects at some point, and at that point you would already have a bunch of code expecting those responsibilities in one object.
 
Interface inheritance usually comes into play when some clients of the interface need additional capabilities, but not all suppliers of the interface will be able to provide those additional capabilities. Or, sometimes there's a component that for convenience reasons will aggregate a variety of features, and you use inheritance to assemble an interface from the various sub-interfaces.
 
To some extent, this view of interfaces is influenced by PyProtocols/PEP 246. Without object adaptation, interfaces aren't quite as useful. But with adaptation, the best way to design a collaboration of objects is to focus on the essential and desired behaviors. Then, you determine how to adapt the behavior of existing objects to perform your desired behavior.
''Regarding behavior and interfaces, with interfaces being a vital part of code as opposed a docstring container:''
 
From http://www.eby-sarna.com/pipermail/peak/2004-September/001783.html :
 
To some extent, this view of interfaces is influenced by PyProtocols/PEP 246. Without object adaptation, interfaces aren't quite as useful. But with adaptation, the best way to design a collaboration of objects is to focus on the essential and desired behaviors. Then, you determine how to adapt the behavior of existing objects to perform your desired behavior.
{{{

PythonPowered
ShowText of this page
EditText of this page
FindPage by browsing, title search , text search or an index
Or try one of these actions: AttachFile, DeletePage, LikePages, LocalSiteMap, SpellCheck