Path: EDN Asia >> News Centre >> IC/Board/Systems Design >> 5 simple tips for designing an interface
IC/Board/Systems Design Share print

5 simple tips for designing an interface

08 Oct 2015  | Jacob Beningo

Share this page with your friends

One of the most important and often ignored parts of embedded software design is the creation of consistent and proper interfaces for reusable software modules. Very little consideration is given to the development of interfaces.

Here are five guidelines every developer should remember in order to guarantee that software can easily be used from one application to the next.

Tip #1 – Start with a list of required operations

Before ever beginning to write an interface for a software module, a developer should take a few moments to write out a simple list of operations that the interface needs to perform. The list acts as a scratch pad for a developer to think through what exactly the interface needs to be doing. What are the module's operations? What are the inputs it needs? What are the outputs it will produce? All three of these questions need to be answered. The list and the questions will serve as the starting point for designing the interface.

Tip #2 – Use a UML class diagram

A UML class diagram is used to represent a class, but it can also be used to represent a module and, more importantly, the module interface. The basic component of a class diagram is a box consisting of three sections. The first section (the top) contains the module's name. The second section (the middle) contains the module's attributes. The third and final section is used to define the operations and methods that the interface publicly exposes.

The module's attributes can be thought of as both the private and public variables that the operation of the interface will manipulate. A plus sign in front of the attribute indicates that it is public and exposed directly as part of the interface. A minus sign indicates that the attribute is private and only manipulated behind the scenes through the use of operations that the interface exposes. Think of these operations as the same ones that were listed as part of Tip #1. Figure 1 shows an example of a generic module definition on the left and a streamlined interface for an EEPROM module.

Example class

Figure 1: Example class / Module diagram

Tip #3 – Separate the interface from the implementation

When beginning to develop an interface to a module, a developer should do everything that they can to separate the interface from the module's implementation. The details of the interface's public facing portions should all be contained in the header file, which in this case defines the module's interface. The implementation details should be kept in the source file. Keeping the details of implementation separate from the interface begins to provide a developer with the ability to hide the implementation. This hiding results in an abstraction of the module's class and provides the capability to later redefine the implementation without affecting the interface.

1 • 2 Next Page Last Page

Want to more of this to be delivered to you for FREE?

Subscribe to EDN Asia alerts and receive the latest design ideas and product news in your inbox.

Got to make sure you're not a robot. Please enter the code displayed on the right.

Time to activate your subscription - it's easy!

We have sent an activate request to your registerd e-email. Simply click on the link to activate your subscription.

We're doing this to protect your privacy and ensure you successfully receive your e-mail alerts.

Add New Comment
Visitor (To avoid code verification, simply login or register with us. It is fast and free!)
*Verify code:
Tech Impact

Regional Roundup
Control this smart glass with the blink of an eye
K-Glass 2 detects users' eye movements to point the cursor to recognise computer icons or objects in the Internet, and uses winks for commands. The researchers call this interface the "i-Mouse."

GlobalFoundries extends grants to Singapore students
ARM, Tencent Games team up to improve mobile gaming

News | Products | Design Features | Regional Roundup | Tech Impact