User Interface Principles in API Design Elliotte Rusty Harold

Slides:



Advertisements
Similar presentations
Lecture 5: Interfaces.
Advertisements

User Interface Principles in API Design Elliotte Rusty Harold
Mutability SWE 332 Fall 2011 Paul Ammann. SWE 3322 Data Abstraction Operation Categories Creators Create objects of a data abstraction Producers Create.
Georgia Institute of Technology Workshop for CS-AP Teachers Chapter 3 Advanced Object-Oriented Concepts.
1 Frameworks. 2 Framework Set of cooperating classes/interfaces –Structure essential mechanisms of a problem domain –Programmer can extend framework classes,
Liang,Introduction to Java Programming,revised by Dai-kaiyu 1 Chapter 10 Object-Oriented Modeling.
1 CS1001 Lecture Overview Homework 3 Homework 3 Project/Paper Project/Paper Object Oriented Design Object Oriented Design.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
Java 1.5 & Effective Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Feb. 23, 2004CS WPI1 CS 509 Design of Software Systems Lecture #5 Monday, Feb. 23, 2004.
Chapter 1 Principles of Programming and Software Engineering.
Chapter 10 Classes Continued
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
IT PUTS THE ++ IN C++ Object Oriented Programming.
Computer Science 340 Software Design & Testing Design By Contract.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented Design.
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
Object Oriented Concepts
CISC6795: Spring Object-Oriented Programming: Polymorphism.
An Object-Oriented Approach to Programming Logic and Design
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
07 Coding Conventions. 2 Demonstrate Developing Local Variables Describe Separating Public and Private Members during Declaration Explore Using System.exit.
1 Assertions. 2 assertions communicate assumptions about the state of the program, and stop processing if they turn out to be false very often comments.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION MIDTERM REVIEW Autumn 2011.
Low-Level Detailed Design SAD (Soft Arch Design) Mid-level Detailed Design Low-Level Detailed Design Design Finalization Design Document.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Systems Analysis and Design in a Changing World, 3rd Edition
Best Practices. Contents Bad Practices Good Practices.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns IX Interpreter, Mediator, Template Method recap.
Object Based Programming Chapter 8. 2 In This Chapter We will learn about classes Garbage Collection Data Abstraction and encapsulation.
Object-Oriented Design CSC 212. Announcements This course is speeding up and we are starting new material. Please see me if you feel this is going too.
Frameworks CompSci 230 S Software Construction.
Refactoring 2. Admin Blackboard Quiz Acknowledgements Material in this presentation was drawn from Martin Fowler, Refactoring: Improving the Design of.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
CSCI 1100/1202 April 1-3, Program Development The creation of software involves four basic activities: –establishing the requirements –creating.
Inheritance and Access Control CS 162 (Summer 2009)
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 11 Object-Oriented.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Lecture Videos will no longer be posted. Assignment 3 is due Sunday, the 8 th, 7pm. Today: –System Design,
SEG 4110 – Advanced Software Design and Reengineering Topic T Introduction to Refactoring.
SWE 4743 Abstract Data Types Richard Gesick. SWE Abstract Data Types Object-oriented design is based on the theory of abstract data types Domain.
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Object-Oriented Design Concepts University of Sunderland.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 3rd Edition Copyright © 2009 John Wiley & Sons, Inc. All rights.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
619 Final Review Last updated Fall 2011 Paul Ammann.
CSE 2341 Object Oriented Programming with C++ Note Set #4
Lecture 6:Interfaces and Abstract Classes Michael Hsu CSULA.
Object-Oriented Design
Chapter 11 Object-Oriented Design
About the Presentations
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Software Testing and Maintenance Modifying Code
CSE 1030: Data Structure Mark Shtern.
More Object-Oriented Programming
Object Oriented Practices
619 Final Review Last updated Spring 2010 © : Paul Ammann.
CS 112 Programming 2 Lecture 02 Abstract Classes & Interfaces (2)
Inheritance Lakshmish Ramaswamy.
Presentation transcript:

User Interface Principles in API Design Elliotte Rusty Harold

Programmers Are People Too Eat Like Humans Sleep Like Humans Mate Like Humans Think Like Humans

User Interface Design is a Science Based on hypothesis, observation and experiment Well-proven, well-tested theories

Fundamental Principles Consistency is next to godliness Simpler is better Visible complexity is bad Smaller equals easier to use

Libraries vs. Applications Applications are monolithic Only other programmers on the same team use an application’s API Libraries can make very limited assumptions about how, when, where, and why API will be invoked Boundary is fuzzy

Remember the People Why you need an API Who uses the API Who designs the API

Be User Focused Ask what the user wants to do with your API Do not ask what the internal data structures and algorithms look like High level API is better than lower level--Reduce the number of method calls needed to accomplish the task Design from the outside in

What to put in an API Write sample programs first 80/20 rule Maximal vs. Minimal APIs YAGNI When in doubt, leave it out! Why I’m a conservative

Dependencies Platform version Library dependencies Built-in vs. 3rd party libraries

Data Encapsulation Public vs. Published Fields are private Methods are mostly private Methods are atomic Constructors and destructors Communicating with the user

Constraints APIs must enforce domain validity Preconditions Postconditions Class invariants System invariants

Error Handling Specify what happens on bad input as well as good Important for security No undefined behavior Don’t silently swallow exceptions Error messages should be verbose but clear Don’t warn the user

Naming Conventions Review naming conventions Use standard terminology Do not abbreviate Use domain specific vocabulary Consistent terminology: always use the same word for the same idea –e.g. add vs. append Do not use two words for one idea

Avoid Complexity Prefer classes to interfaces Prefer constructors to factory methods Avoid excessive abstraction You usually don’t need multiple implementations Refactor to patterns; don’t start with them. Avoid pattern overload!

Inheritance Prefer finality –(at least on methods) Factories and interfaces The proper use of protected

Plays well with others (Java): Serializable Cloneable(*) Comparable equals() hashCode() toString() Exception handling Thread safety

Plays well with others (.NET): Equals() / GetHashCode() ToString() IEquatable / IComparable “Collection” suffix for IEnumerable classes Icloneable* Override ==, etc. for value types (only) No pointer arguments to public methods Don’t throw exceptions from overloaded operators and implicit casts

Testability The API itself Client code that uses the API This is a secondary concern

Documentation Specification Quick Start Tutorials Example code API Documentation Per method checklist

Conformance Testing Specifications Test Suites Implementation dependent behavior Implementation dependent extensions

Maintenance Planning for the future Forwards compatibility Backwards compatibility Unexpected limits Deprecation Breaking compatibility Interfaces vs. classes

The Last Concern (Performance) Speed Size Energy

Case Study: JMidi vs. JFugue

Case Study: DOM vs. JDOM

Case Study: BoxLayout vs. GridBagLayout

Further Reading Effective Java: Joshua Bloch Effective C#: Bill Wagner Framework Design Guidelines: Krzysztof Cwalina, Brad Abrams Tog on Interface: Bruce Tognazzini GUI Bloopers: Jeff Johnson