Difference between revisions of "Documentation/DevGuide/AppendixA/Interfaces"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Changing Category:Documentation/Developers Guide/Appendix)
m (Naming)
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
|NextPage=Documentation/DevGuide/AppendixA/Properties
 
|NextPage=Documentation/DevGuide/AppendixA/Properties
 
}}
 
}}
{{DISPLAYTITLE:Interfaces}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/AppendixA/{{SUBPAGENAME}}}}
 +
{{DISPLAYTITLE:Interfaces}}
 
Interfaces are collections of methods belonging to a single aspect of behavior. Methods do not have data or implementation.
 
Interfaces are collections of methods belonging to a single aspect of behavior. Methods do not have data or implementation.
  
Line 14: Line 15:
 
==== Naming ====
 
==== Naming ====
  
Identifiers of interfaces begin with the prefix 'X' followed by the name itself in initial caps, capitalizing the first letter after the 'X', for example, XFrameListener. Avoid abbreviations.
+
Identifiers of interfaces begin with the prefix 'X' followed by the name itself in initial caps, capitalizing the first letter after the 'X', for example, <code>XFrameListener</code>. Avoid abbreviations.
  
 
We apply the prefix 'X', because interfaces have to be treated differently than pointers in C/C++ and also in normal interfaces in Java. It is also likely that the main interface of a service should get the same name as the service that can cause confusion or ambiguity in documentation.
 
We apply the prefix 'X', because interfaces have to be treated differently than pointers in C/C++ and also in normal interfaces in Java. It is also likely that the main interface of a service should get the same name as the service that can cause confusion or ambiguity in documentation.
  
It is a bad design if the name or abbreviation of a specific component appears within the name of an interface, for example, XSfxFrame or XVclComponent.  
+
It is a bad design if the name or abbreviation of a specific component appears within the name of an interface, for example, <code>XSfxFrame</code> or <code>XVclComponent</code>.
  
 
==== Usage ====
 
==== Usage ====

Latest revision as of 02:37, 13 January 2013



Interfaces are collections of methods belonging to a single aspect of behavior. Methods do not have data or implementation.

Once an interface gets into an official release of the API, it may no longer be changed. This means that no methods or attributes can be added, removed or modified, not even arguments of methods. This rule covers syntax, as well as semantics.

Interfaces are identified by their name.

Naming

Identifiers of interfaces begin with the prefix 'X' followed by the name itself in initial caps, capitalizing the first letter after the 'X', for example, XFrameListener. Avoid abbreviations.

We apply the prefix 'X', because interfaces have to be treated differently than pointers in C/C++ and also in normal interfaces in Java. It is also likely that the main interface of a service should get the same name as the service that can cause confusion or ambiguity in documentation.

It is a bad design if the name or abbreviation of a specific component appears within the name of an interface, for example, XSfxFrame or XVclComponent.

Usage

Interfaces represent stable aspects of design objects. A single interface only contains methods that belong to one aspect of object behavior, never collections of arbitrary methods. Both aspects of usage, client and server, should be considered in design. Keep the role of the object in mind. If some methods of your new interface are only used in one role and others in another role, your design is probably flawed.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages