Interface (API) Design

Similar documents
Additional reading for this lecture: Heuristic Evaluation by Jakob Nielsen. Read the first four bulleted articles, starting with How to conduct a

User Interface Evaluation

CS 307: Software Engineering. Lecture 10: Software Design and Architecture

PROCESS DEVELOPMENT METHODOLOGY The development process of an API fits the most fundamental iterative code development

HCI and Design SPRING 2016

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

Lecture 14: Heuristic Evaluation. Fall UI Design and Implementation 1

Lecture 22: Heuristic Evaluation. UI Hall of Fame or Shame? Spring User Interface Design and Implementation 1

User Interface Design. Slide Set to accompany. Software Engineering: A Practitioner s Approach, 7/e by Roger S. Pressman

Writing usable APIs in practice. ACCU 2012 Conference, Oxford, UK Giovanni

SWEN 444 Human Centered Requirements and Design Project Breakdown

SWEN 444 Human Centered Requirements and Design Project Breakdown

The Software Design Process. CSCE 315 Programming Studio, Fall 2017 Tanzir Ahmed

IPM 10/11 T1.6 Discount Evaluation Methods

User-Centered Design. Jeff Bos, Design Insights BlackBerry

Topic : Object Oriented Design Principles

Lecture 10 Usability

Human-Computer Interaction: An Overview. CS2190 Spring 2010

Analytical evaluation

HEURISTIC EVALUATION WHY AND HOW

User Interface Design. Slides copyright 1996, 2001, 2005, 2009, 2014 by Roger S. Pressman. For non-profit educational use only

A Heuristic Evaluation of Ohiosci.org

Interface Design Week 7

SOFTWARE ENGINEERING DECEMBER. Q2a. What are the key challenges being faced by software engineering?

Foundation Level Syllabus Usability Tester Sample Exam

Patterns Architectural Styles Archetypes

Assignment 5 is posted! Heuristic evaluation and AB testing. Heuristic Evaluation. Thursday: AB Testing

cs465 principles of user interface design, implementation and evaluation

evaluation techniques goals of evaluation evaluation by experts cisc3650 human-computer interaction spring 2012 lecture # II.1

USER INTERFACE DESIGN + PROTOTYPING + EVALUATION. Heuristic Evaluation. Prof. James A. Landay University of Washington CSE 440

Heuristic Evaluation. Heuristic evaluation evaluates the interface to identify usability problems against recognized usability design heuristics.

Use-Case Analysis. Architecture Oriented Analysis. R. Kuehl/J. Scott Hawker p. 1 R I T. Software Engineering

Overview of Today s Lecture. Analytical Evaluation / Usability Testing. ex: find a book at Amazon.ca via search

Software Architecture

Chapter 15: Analytical evaluation

NOTES ON OBJECT-ORIENTED MODELING AND DESIGN

Design Heuristics and Evaluation

CSE 440: Introduction to HCI User Interface Design, Prototyping, and Evaluation

Chapter 8: Class and Method Design

CS415 Human Computer Interaction

Interfaces 3. Reynold Xin Aug 22, Databricks Retreat. Repurposed Jan 27, 2015 for Spark community

Javadoc. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 7

Implementing Architectures

What is Software Architecture

Heuristic evaluation is a usability inspection technique developed by Jakob Nielsen. The original set of heuristics was derived empirically from an

GUI Design Principles

Usability Inspection Methods. Overview. Usability Measures. SMD157 Human-Computer Interaction Fall 2003

Analytical Evaluation

Usability I: Principles and Guidelines

15/16 CSY2041 Quality and User-Centred Systems

Heuristic Evaluation. Hall of Fame or Shame? Hall of Fame or Shame? Hall of Fame! Heuristic Evaluation

Software Design and Analysis for Engineers

Ch 1: The Architecture Business Cycle

HUMAN COMPUTER INTERACTION

CSE 440: Introduction to HCI User Interface Design, Prototyping, and Evaluation

Usability. HCI - Human Computer Interaction

Getting Started with the Aloha Community Template for Salesforce Identity

SYMFONY2 WEB FRAMEWORK

Heuristic Evaluation! Hall of Fame or Shame?! Hall of Fame or Shame?! Hall of Fame or Shame?! Hall of Fame!!

Objectives. Object-Oriented Analysis and Design with the Unified Process 2

RESTful API Design APIs your consumers will love

Develop Mobile Front Ends Using Mobile Application Framework A - 2

Steps for project success. git status. Milestones. Deliverables. Homework 1 submitted Homework 2 will be posted October 26.

Software Design COSC 4353/6353 DR. RAJ SINGH

Etanova Enterprise Solutions

Design and Information Hiding

Northeastern University - Seattle. Computer and Information Sciences

EECS168 Exam 3 Review

Motivation. ! Stop reinventing the wheel, try to reuse code! ! How do you organize code reuse? History: " Copy & Paste. " Collect useful files

Object Oriented Analysis and Design - Part2(Design)

Marking Guidelines for MVK Projects. MVK12. Version 6.2 (PPD, URD, RURD, ADD and software demo)

Expert Reviews (1) Lecture 5-2: Usability Methods II. Usability Inspection Methods. Expert Reviews (2)

Monitoring Standards for the Producers of Web Services Alexander Quang Truong

Site Design. SWE 432, Fall 2017 Design and Implementation of Software for the Web

CS415 Human Computer Interaction

CPSC 427: Object-Oriented Programming

This quiz is closed book, closed notes. You have 80 minutes to complete it. Your name:

Interaction Design. Heuristic Evaluation & Cognitive Walkthrough

Product Quality Engineering. RIT Software Engineering

Requirements Validation and Negotiation

POAD Book: Chapter 4: Design Patterns as Components Chapter 5: Visual Design Models

System and Software Architecture Description (SSAD)

Architecture and Design Evolution

Exceptions and assertions

Interaction Design. Human-Computer. COGS120/CSE170 - Intro. HCI. Instructor: Philip Guo. Week 3 - Heuristic Evaluation ( )

3 Evaluating Interactive Systems

Nick Rozanski Andy Longshaw Eoin Woods. Sold! How to Describe, Explain and Justify your Architecture

Interaction Techniques. SWE 432, Fall 2017 Design and Implementation of Software for the Web

CAS 703 Software Design

Design Principles. Overview. User-Center Design. SMD157 Human-Computer Interaction Fall User-center design Guidelines

Lecture Notes UML UNIT-II. Subject: OOAD Semester: 8TH Course No: CSE-802

Giving instructions, conversing, manipulating and navigating (direct manipulation), exploring and browsing, proactive computing

Introduction to Web Services & SOA

Design Principles. Overview. User-Center Design. SMD157 Human-Computer Interaction Fall User-center design Guidelines

Lethbridge/Laganière 2005 Chapter 9: Architecting and designing software 6

IBM Software Group. Mastering Requirements Management with Use Cases Module 8: Refine the System Definition

EVALUATION OF PROTOTYPES USABILITY TESTING

Hyper Mesh Code analyzer

Designing Usable Apps

Existing Model Metrics and Relations to Model Quality

Transcription:

Interface (API) Design Architect s Perspective R. Kuehl/J. Scott Hawker p. 1

What is an API? Exposes the public facing functionality of a software component Operations, inputs, and outputs Exposes functionality independent of implementation Local libraries or public frameworks of routines or classes (e.g., vendor or program language libraries) Proxy for remote call invocation protocols (e.g., Java RMI, SOAP or REST) XML, JSON message encoding R. Kuehl/J. Scott Hawker p. 2

Why is API Design Important? Internal APIs enable successful development and support Successful public APIs capture customers Poor API s can become a liability Customers invest heavily: developing, learning, using Cost to stop using an API can be prohibitive Public APIs are forever - one chance to get it right The first version of an API is always easy R. Kuehl/J. Scott Hawker p. 3

Conway s Law Programmer Melvin Conway in 1968 organizations which design systems... are constrained to produce designs which are copies of the communication structures of these organizations For two software modules to interface properly, developers of each module must communicate Therefore a system s interface (architecture) structure will reflect its social organization R. Kuehl/J. Scott Hawker p. 4

The Cost of Poor APIs Longer development times Harder to understand during design Difficult to program, may require extra code Program size and efficiency Complex code implies more testing with greater bug risk Hierarchies of layered APIs compound the costs Defects in lower layers propagate upward with greater impact E.g., security holes in low level c library string manipulation APIs Adding wrappers hide but don t fix a bad API R. Kuehl/J. Scott Hawker p. 5

Why is API Design Important to an Architect? APIs are one of an architecture s most tangible and useful outcomes Every architecturally significant module will have an associated interface Good interface design helps realize architecture objectives during construction The architect should oversee (do) interface design The architect should dictate API style and policy e.g., naming Useful modules tend to get reused Good reusable modules are business assets frameworks R. Kuehl/J. Scott Hawker p. 6

API Quality Attributes Usability ( DevX ) Satisfies requirements (of course) Learnability Productivity - easy to use, even without documentation Understandability Hard to misuse Easy to read and maintain code that uses it Simple, consistent R. Kuehl/J. Scott Hawker p. 7

API Quality Attributes (cont) Expressiveness abstraction matches developer s mental model Extensibility - stable but easy to extend as necessary Evolvability create new versions Performance speed and resource consumption Robustness and security R. Kuehl/J. Scott Hawker p. 8

The Process Of API Design Preamble - system requirements and software architecture identify modules of interest For an API instance - write a short specification, prototype, evaluate, refine Write to the API early and often Expect defects and changes to evolve the API The client code artifacts live on as examples and unit tests R. Kuehl/J. Scott Hawker p. 9

API Evaluation Analogous to HCI Evaluation Experts using heuristics Users do cognitive walkthroughs User testing given tasks programmers write against the API s R. Kuehl/J. Scott Hawker p. 10

API Heuristic Evaluation Heuristic Visibility of status Match to real world User control and freedom Consistency Error prevention Recognition over recall Flexibility and efficiency of use Aesthetic and minimalist design Error recognition and recovery Help and documentation Measurement Check system state Meaningful naming Abort or reset operations E.g., Parameter order E.g., default parameters do the right thing Naming again Programmability Good naming Helpful error returns/exceptions Available and accurate R. Kuehl/J. Scott Hawker p. 11

Commercial API Examples Pick one of the following API s based on your project platform: Web App Mailchimp: http://developer.mailchimp.com/ Mobile App Android: https://developer.android.com/guide/index.html Browse to form learnability first impressions Evaluate the details of a few specific API s from a coder s perspective Understandable? Simple to use? Limitations or other concerns? Cohesion/coupling? R. Kuehl/J. Scott Hawker p. 12

A Few API Design Guidelines - 1 API should do one thing only and do it well - cohesion Should follow from good architecture module definition Abstraction the API should not expose or be impacted by the implementation Maximize information hiding e.g., make class attributes and methods as private as possible Names matter API is a little language Names should be self explanatory, consistent, metaphoric Consider performance implications carefully Bad decisions can impact performance excessive memory allocation, unnecessary computation Don t manipulate the API design to fix performance problems R. Kuehl/J. Scott Hawker p. 13

A Few API Design Guidelines - 2 Interface signature surface area minimalism fewer types, functions, parameters; If in doubt, leave it out; you can always add but hard to remove E.g., adding a rarely used convenience function, or adding too many configuration parameters Maintaining backward compatibility accumulates crud ; it s a tradeoff problem Good ergonomics (the API feel ) consistent style for naming, parameter typing and order, error handling, calling order, etc. Follow platform conventions, establish a guide API Should Be As Small As Possible But No Smaller Ockham s Razor R. Kuehl/J. Scott Hawker p. 14

A Few API Design Guidelines - 3 General purpose APIs should be policy free ; special purpose APIs policy rich ; another API design tradeoff Policy - architect s anticipated use cases for the API APIs dictate policy the semantics and style of programming imposed on the caller The less known about usage context, the more flexibility desired The more known about usage context, the more policy should be imposed based on use cases Examples: A table lookup fails throw exception, return null, or zero? Java collections versus application collections R. Kuehl/J. Scott Hawker p. 15

A Few API Design Guidelines - 4 Design APIs from the client s perspective Provide sufficient functionality for the caller to complete their task (traceable to a use case) Keep testability in mind; E.g., provide a testing API extension to expose internal details Involve the users in design and review of the signature Don t surprise the caller with API behavior violate the principle of least astonishment R. Kuehl/J. Scott Hawker p. 16

A Few API Design Guidelines - 5 APIs should be documented document everything If done exclusively by the developer possible implementation bias So involve the user ideally before implementation Don t ignore exception handling, possible side effects Test drive the API and the documentation with new users; is the API self documenting? Unit tests help refine the API and documentation R. Kuehl/J. Scott Hawker p. 17

Documenting Interfaces: Interface Specification Template 1. Interface identity (name, version) 2. Responsibilities (services, functions) provided (*IDL option) Signature syntax (arguments, types, etc.) Semantics usage scenarios Pre/post conditions, return values Cross function coordination Usage restrictions (initialization, timing of use, ownership, etc.) 3. Data type definitions application specific 4. Exception definitions and handling *IDL Interface Description Language self descriptive, language independent, human and machine readable R. Kuehl/J. Scott Hawker p. 18

Documenting Interfaces: Interface Specification Template (cont) 5. Variability provided by the interface such as configuration, performance ranges, data capacity ranges 6. Quality attributes of the interface, e.g., performance considerations 7. Resource requirements (resources required, dependencies) 8. Rationale / design issues and resolution R. Kuehl/J. Scott Hawker p. 19

API Contracts Classes of a system communicate with one another on the basis of precisely defined benefits and obligations [Bertrand Meyer, CACM, Vol 36, No 9, 1993] Correctness - formal, precise and verifiable interface specifications the contract Pre-condition always True before an interface is invoked; client responsibility Post-condition always True once a component successfully completes it's assigned task; supplier responsibility Invariant - conditions held True following each successful completion (or exception contract not fulfilled); e.g., range of valid variable values Performance fast, usually fast, variable but predictable, variable and unpredictable The API Performance Contract, Sproull, Waldo, CACM, 3/14 R. Kuehl/J. Scott Hawker p. 20

Class Activity Individually, specify an API for one of the components in your project. It may be for a significant internal interface or an external interface at the system boundary. Use the interface specification template from the lecture (parts 1-4) Review the specification within your team for developer experience feedback Submit the specification to the Class Activity > API Design dropbox R. Kuehl/J. Scott Hawker p. 21

Example Interface Identity usercreate Responsibility usercreate(firstname, lastname, type, email, password) {...} Data Type Definitions String firstname; String lastname; String type; // default = member, other = leader, admin String email; String password; int id = uniqid(); // a unique identification number Exception Definitions and Handling UserAlreadyExistsException - thrown when the system attempts to create a user that already has the specified firstname & lastname or email. When thrown, the user is redirected to the Create User page. UserNotAuthorizedException - thrown when an unauthorized user tries to create a new user. When thrown, the user is redirected to the Create User page and an administrator is notified of this action. R. Kuehl/J. Scott Hawker p. 22

Example Interface Identity Responsibility Data Type Definitions Exception Definitions and Handling Shopping Cart Add Item to cart URL /account/additemtocart POST Input Item: JSON ItemObject Output The server adds the item to the user s cart A status message and code is returned back In JSON format: Name - Name of the object Rating - Rating of the object Description - Description of the object Array of {Vendor, Price, Link} - Vendor - A vendor selling the object; Price - The price for the vendor; Link - A link to the vendors store with the object The server will return back JSON output with an error code as well as a message describing what the issue was R. Kuehl/J. Scott Hawker p. 23

References How to Design a Good API and Why it Matters, Joshua Bloch, Google API Design Matters Michi Henning, CACM May 2009 Practical API Design: Confessions of a Java Framework Architect, Jaroslav Tulach, Books 24x7 Improving API Usability, Myers Stylos, CACM May 2016 R. Kuehl/J. Scott Hawker p. 24