• Increase font size
  • Default font size
  • Decrease font size

API Usability Testing at AT&T

  Wednesday, April 4th, 2012

Pamela Fox wrote about some great process that AT&T implemented to test the usability of their APIs. They invited several developers to come in and test out their APIs and give feedback on ways they can improve their developer experience. This is a great idea and fantastic way to improve an API based upon actual customer experience:


How API Testing Can Help

  Wednesday, December 7th, 2011

Bj Rollison wrote an article on API testing in which he talks about the differences between unit, API, and GUI testing. He goes on to describe some of the key benefits of API testing, including: reduced testing costs, improved productivity, and higher functional quality. Bj concludes by talking about the relationship between developers and testers.


Writing a C Library

  Wednesday, July 6th, 2011

David Zeuthen has written a long and detailed article on many of the design issues that are faced when trying to write a plain C API. He deals with aspects such as library initialization, multithreading, error handling, versioning, and testing. It’s well worth a read if you are interested in writing a library in plain C (rather than C++). David’s collection of best practices is split into 5 parts, as follows:


Class & API Design

  Friday, April 29th, 2011

Michael DeHann wrote a blog article relating some of the things he’s learned about good API design. This includes advice such as programming with a view to the outsider, naming classes appropriately, figuring out how to make your code better through experiencing bad code, provide documentation that obviates the need for users to ask you how your code works, avoid redundant code, avoid extraneous conversions where possible, keep logic with the class that owns it, avoid adding complexity to your code through many options, and finally test your code but focus on functional end-to-end tests.

Many of these design tips are not new, but Michael provides a fresh perspective on them that I think is worth reading. Check out his post at:


Introducing API Design Principles

  Monday, April 11th, 2011

Dr. Jaime Niño of the University of New Orleans has produced teaching materials to support his class on API development. This 6-page document covers a lot of the important API topics, from specification, documentation, design, implementation, and testing. These principles are illustrated with reference to the task of creating an API for data containers. Some of the words of advice include:

  • Make the specification of the data type for the container as generic as possible
  • Specify data containers via interfaces
  • The data container interface must provide a cohesive abstraction
  • Be consistent
  • Be minimal
  • Methods names matter
  • Favor queries
  • Minimize the number of commands
  • Favor parameters’ type specified via interface types
  • Use appropriate parameters and return types
  • Avoid long parameter lists

You can view a PDF of the document here: API Design Principles in CS2.

 

 


API Design as if Unit Testing Mattered

  Wednesday, January 12th, 2011

Michael Feathers, author of the book “Working Effectively with Legacy Code”, gave a presentation at SD West in 2007 about designing an API with consideration for how it will be unit tested. He presents recommendations such as avoiding static methods and avoiding final/non-virtual methods (although I disagree with the latter recommendation in my book, where I argue that being minimally complete is more important). He also presents a golden rule of API Design: “It’s not enough to write tests for an API you develop, you have to write unit tests for code that uses your API.” He also states that you should supply your tests to your users. I could not agree with those statements more!


Jenkov’s API Design Tutorial

  Sunday, November 21st, 2010

Jakob Jenkov has compiled an extensive collection of tutorials on how to design good APIs. Jenkov summarizes the qualities of a sound API with the statement: “Solve my problem, with minimal effort from me, and don’t get in my way.” His tutorial is broken down into several sections, including: Lots of Upfront Design, Keep it Small and Focused, Don’t Expose More than Necessary, Sensible Defaults, Optional Abstractions, Central Point of Access, among others. His tutorial covers a lot of ground and offers a lot of valuable tips, including several code examples in Java to illustrate his points.


Wenham’s API Design Tips

  Sunday, November 21st, 2010

C. Lawrence Wenham compiled a great list of API design tips, including concepts such as naming, consistency, reducing complexity, avoiding side effects, and avoiding boolean arguments. He also advocates for designing an API from the point of view of the client, rather than choosing the solution that’s easier to implement (which is perhaps an obvious statement but still all too commonly violated). This is a concise yet thorough collection of important concepts to bear in mind when you’re designing an API. Well worth a read.


Non-functional Testing

  Thursday, September 9th, 2010

Most testing efforts are targeted toward testing the actual functionality of an API, i.e., what it is supposed to do. However, there is another class of testing called non-functional testing. This involves testing the quality of the software from the user’s perspective. It can involve things like performance testing, scalability testing, and security testing. The following article gives a comparison between functional and non-functional testing.


Unit Testing Frameworks

  Thursday, September 9th, 2010

A unit test is a white-box testing technique that a developer performs. White-box means that you write the tests with knowledge of the implementation of the API. There are many frameworks out there that help you write, maintain, and run unit tests for your code. Most of these are based upon the J-Unit style of unit testing. Wikipedia offers a good categorization of unit test frameworks that are available for C and C++. See:


API Testing

  Thursday, September 9th, 2010

This article provides a QA engineer’s perspective on API testing. It pulls out some of different types of testing approaches, such as unit testing and black-box testing, and provides some guidance on writing API tests.

Note that the term “API Testing” is commonly used in the QA domain to mean programmatic black-box tests that a QA engineer writes.  However, I view the topic of “testing an API” as being wider than this, encompassing unit testing, integration testing, and non-functional testing, and performed by either developers or QA engineers.


ABOUT THIS SITE

An Application Programming Interface (API) provides a logical interface to a piece of software and hides its internal details. This website is dedicated to a book on designing APIs for C++ and includes articles and links on API development.
 

SOURCE CODE

The book is accompanied by a source code package that contains many of the examples in the text. Download it for free.
 

OTHER BOOKS

Dr. Reddy has also published a computer graphics book called Level of Detail for 3D Graphics. Check it out too!.
 
Copyright (c) 2014 Martin Reddy. All rights reserved. Login