SlideShare a Scribd company logo
Empathic API
Design
CORNEIL DU PLESSIS
About Me
● Programmer since 1985
● Smallest to very large systems.
● Cobol, Pascal, Algol, C/C++, Java, Scala, Groovy and other JVM
languages.
● Scientific instrumentation, Sports event management, Mining, Banking,
Treasury and Insurance.
● Software Architect (coding included)
Quote
The Opposite of Empathy is Contempt.
Anonymous
Introduction
● What is an API?
● Considerations in API Design
● Why Empathy in API Design?
● Documenting your API
What is an API?
Definition:
Application Programming Interface
Examples:
– C stdlib.h
– Java Standard Library
– Spring Framework
– Google Maps API
– Facebook Graph API
Considerations in API Design
Quote:
Everything should be made as simple as possible, but no simpler
Albert Einstein
Considerations in API Design
Joshua Bloch
Principal Software Engineer at Google
How to Design a Good API and Why it Matters
– Easy to learn
– Easy to use, even without documentation
– Hard to misuse
– Easy to read and maintain code that uses it
– Sufficiently powerful to satisfy requirements
– Easy to extend
– Appropriate to audience
Considerations in API Design
● Simple
● Unambiguous
● Usage oriented
● Asset
● Discipline
Why Empathy in API Design?
● When your audience doesn’t have an alternative.
● When your audience is human.
● Because they depend on it.
● Because they gave you money.
Documenting your API
● Code is the document
● Tools
– Javadoc
– Doxygen
– Asciidoc
● Rest API
– RAML
– Swagger
– Spring Rest Docs
RAML
● RESTful API Modeling Language
● RAML 0.8
– YAML
– Like RFC
● RAML 1.0
– YAML 1.2
– Template URI
– Data types
– Annotations
– Security Schemes
RAML
#%RAML 1.0
title: Spring Data Rest Demo API
version: v1
protocols: [ HTTP ]
baseUri: http://localhost/api
mediaType: application/json
types:
RAML - Types
types:
User:
type: object
properties:
userId: string
emailAddress: string
fullName: string
dateOfBirth: date-only
hasImage: boolean
Group:
type: object
properties:
description: string
groupName: string
groupOwner: User
RAML – Operations
/users:
post:
body:
type: User
description: Create a User
responses:
200:
body:
type: User
RAML - Operations
/users/{id}:
get:
description: Get a User
responses:
200:
body:
type: User
404:
description: User doesn't exist
/users/search:
get:
queryParameters:
input:
description: Sub string to match
type: string
responses:
200:
body:
type: User[]
Swagger
● Swagger 2.0
● JSON / YAML
● JSON Schema
Swagger – Springfox
● Swagger from Annotations
● Spring MVC - Rest
● Swagger UI
Springfox - Configuration
@EnableSwagger2
@Configuration
public class SwaggerConfiguration {
@Bean
public Docket swaggerSpringMvcPlugin() {
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfo("Spring Data Rest Demo",
"Demonstrate Spring Data RestController",
"2",
"/",
new Contact("Corneil du Plessis", "",
"corneil.duplessis@gmail.com"),
"",
"");
}
}
Springfox - Configuration
@EnableWebMvc
@Configuration
public class WebApplicationConfiguration
extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry)
{
registry.addResourceHandler("/swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations(
"classpath:/META-INF/resources/webjars/");
}
}
Swagger - Springfox
@RequestMapping(path = "/users/{id}", method = RequestMethod.GET)
@ApiOperation(value = "Get User")
@ApiResponses({
@ApiResponse(code = 200, message = "Success", response =
User.class),
@ApiResponse(code = 404, message = "Entity Not Found")
})
public ResponseEntity<User> getUser(@PathVariable("id") Long id)
throws EntityNotFound {
User user = userRepository.findOne(id);
if (user == null) {
throw new EntityNotFound();
}
return ResponseEntity.ok(user);
}
Springfox - UI
Demo
Spring Rest Docs
● Documentation driven by Unit Tests
– Asciidoc
– Snippets
– Conventions
– Test Methods
– Feedback on completeness
Spring Rest Docs
Demo
Conclusion
Questions?
Resources
– https://github.com/corneil/spring-data-rest-angular-demo
– http://raml.org
– http://swagger.io
– http://springfox.github.io/springfox
– https://projects.spring.io/spring-restdocs

More Related Content

What's hot

C# language
C# languageC# language
C# language
Akanksha Shukla
 
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays
 
Kotlin multiplataforma
Kotlin multiplataformaKotlin multiplataforma
Kotlin multiplataforma
Geison Goes
 
Why companies like Google, Alibaba and UOL choose Flutter
Why companies like Google, Alibaba and UOL choose FlutterWhy companies like Google, Alibaba and UOL choose Flutter
Why companies like Google, Alibaba and UOL choose Flutter
Geison Goes
 
Level 3 REST Makes Your API Browsable
Level 3 REST Makes Your API BrowsableLevel 3 REST Makes Your API Browsable
Level 3 REST Makes Your API Browsable
Matt Bishop
 
Ashok_Vardhan_Cheemakurthy
Ashok_Vardhan_CheemakurthyAshok_Vardhan_Cheemakurthy
Ashok_Vardhan_Cheemakurthy
ASHOK VARDHAN CH
 
Go Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang wayGo Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang way
IndicThreads
 
API Documentation Meetup 2016, London
API Documentation Meetup 2016, LondonAPI Documentation Meetup 2016, London
API Documentation Meetup 2016, London
Christian Heidenreich
 
Entity Framework Today (May 2012)
Entity Framework Today (May 2012)Entity Framework Today (May 2012)
Entity Framework Today (May 2012)
Julie Lerman
 
YutianLi_resume
YutianLi_resumeYutianLi_resume
YutianLi_resume
Yutian Li
 
RAML - APIs By Design
RAML - APIs By DesignRAML - APIs By Design
RAML - APIs By Design
Uri Sarid
 
To SDK or not to SDK?
To SDK or not to SDK?To SDK or not to SDK?
To SDK or not to SDK?
Lukas Leander Rosenstock
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description Languages
Akana
 
排隊 Paiduei App, | React Native | iOS | Android
排隊 Paiduei App, | React Native | iOS | Android排隊 Paiduei App, | React Native | iOS | Android
排隊 Paiduei App, | React Native | iOS | Android
Liyang Zhang
 
apidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflix
apidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflixapidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflix
apidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflix
apidays
 
What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How? What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How?
Shady Selim
 
.Net language support
.Net language support.Net language support
.Net language support
Then Murugeshwari
 
API Description Languages: Which Is The Right One For Me?
 API Description Languages: Which Is The Right One For Me?  API Description Languages: Which Is The Right One For Me?
API Description Languages: Which Is The Right One For Me?
ProgrammableWeb
 
Inna Manni newest resume
Inna Manni newest resumeInna Manni newest resume
Inna Manni newest resume
Inna Manni
 
API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards   25-6-2014API Athens Meetup - API standards   25-6-2014
API Athens Meetup - API standards 25-6-2014
Michael Petychakis
 

What's hot (20)

C# language
C# languageC# language
C# language
 
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
 
Kotlin multiplataforma
Kotlin multiplataformaKotlin multiplataforma
Kotlin multiplataforma
 
Why companies like Google, Alibaba and UOL choose Flutter
Why companies like Google, Alibaba and UOL choose FlutterWhy companies like Google, Alibaba and UOL choose Flutter
Why companies like Google, Alibaba and UOL choose Flutter
 
Level 3 REST Makes Your API Browsable
Level 3 REST Makes Your API BrowsableLevel 3 REST Makes Your API Browsable
Level 3 REST Makes Your API Browsable
 
Ashok_Vardhan_Cheemakurthy
Ashok_Vardhan_CheemakurthyAshok_Vardhan_Cheemakurthy
Ashok_Vardhan_Cheemakurthy
 
Go Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang wayGo Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang way
 
API Documentation Meetup 2016, London
API Documentation Meetup 2016, LondonAPI Documentation Meetup 2016, London
API Documentation Meetup 2016, London
 
Entity Framework Today (May 2012)
Entity Framework Today (May 2012)Entity Framework Today (May 2012)
Entity Framework Today (May 2012)
 
YutianLi_resume
YutianLi_resumeYutianLi_resume
YutianLi_resume
 
RAML - APIs By Design
RAML - APIs By DesignRAML - APIs By Design
RAML - APIs By Design
 
To SDK or not to SDK?
To SDK or not to SDK?To SDK or not to SDK?
To SDK or not to SDK?
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description Languages
 
排隊 Paiduei App, | React Native | iOS | Android
排隊 Paiduei App, | React Native | iOS | Android排隊 Paiduei App, | React Native | iOS | Android
排隊 Paiduei App, | React Native | iOS | Android
 
apidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflix
apidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflixapidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflix
apidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflix
 
What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How? What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How?
 
.Net language support
.Net language support.Net language support
.Net language support
 
API Description Languages: Which Is The Right One For Me?
 API Description Languages: Which Is The Right One For Me?  API Description Languages: Which Is The Right One For Me?
API Description Languages: Which Is The Right One For Me?
 
Inna Manni newest resume
Inna Manni newest resumeInna Manni newest resume
Inna Manni newest resume
 
API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards   25-6-2014API Athens Meetup - API standards   25-6-2014
API Athens Meetup - API standards 25-6-2014
 

Similar to Empathic API-Design

mulesoft birmingham meetup_api_designing_with_raml
mulesoft birmingham meetup_api_designing_with_ramlmulesoft birmingham meetup_api_designing_with_raml
mulesoft birmingham meetup_api_designing_with_raml
mohammadsakifuddin
 
Mule soft meetup_4_mty_online_oct_2020
Mule soft meetup_4_mty_online_oct_2020Mule soft meetup_4_mty_online_oct_2020
Mule soft meetup_4_mty_online_oct_2020
Veyra Celina
 
Design & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hoursDesign & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hours
Restlet
 
API design concepts [Intro]
API design concepts [Intro]API design concepts [Intro]
API design concepts [Intro]
Anas Jamil
 
API Description Languages: Which is the Right One for Me?
API Description Languages: Which is the Right One for Me?API Description Languages: Which is the Right One for Me?
API Description Languages: Which is the Right One for Me?
Akana
 
API Description Languages: Which is the Right One for Me?
API Description Languages: Which is the Right One for Me?API Description Languages: Which is the Right One for Me?
API Description Languages: Which is the Right One for Me?
Akana
 
Practices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPractices and Tools for Building Better APIs
Practices and Tools for Building Better APIs
Peter Hendriks
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code Generation
Tim Burks
 
APIdays 2015 - The State of Web API Languages
APIdays 2015 - The State of Web API LanguagesAPIdays 2015 - The State of Web API Languages
APIdays 2015 - The State of Web API Languages
Jerome Louvel
 
APIdays 2015 - The State of Web API Languages
APIdays 2015 - The State of Web API LanguagesAPIdays 2015 - The State of Web API Languages
APIdays 2015 - The State of Web API Languages
Restlet
 
Api design part 1
Api design part 1Api design part 1
Api design part 1
Ibrahim Elsawaf
 
How to define an api
How to define an apiHow to define an api
How to define an api
Alexandru Chica
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description Languages
Akana
 
Practices and tools for building better APIs
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIs
NLJUG
 
Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)
Peter Hendriks
 
Api presentation
Api presentationApi presentation
Api presentation
Tiago Cardoso
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
Tatiana Al-Chueyr
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)
Tom Johnson
 
2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards
APIsecure_ Official
 
Serverless Functions and Machine Learning: Putting the AI in APIs
Serverless Functions and Machine Learning: Putting the AI in APIsServerless Functions and Machine Learning: Putting the AI in APIs
Serverless Functions and Machine Learning: Putting the AI in APIs
Nordic APIs
 

Similar to Empathic API-Design (20)

mulesoft birmingham meetup_api_designing_with_raml
mulesoft birmingham meetup_api_designing_with_ramlmulesoft birmingham meetup_api_designing_with_raml
mulesoft birmingham meetup_api_designing_with_raml
 
Mule soft meetup_4_mty_online_oct_2020
Mule soft meetup_4_mty_online_oct_2020Mule soft meetup_4_mty_online_oct_2020
Mule soft meetup_4_mty_online_oct_2020
 
Design & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hoursDesign & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hours
 
API design concepts [Intro]
API design concepts [Intro]API design concepts [Intro]
API design concepts [Intro]
 
API Description Languages: Which is the Right One for Me?
API Description Languages: Which is the Right One for Me?API Description Languages: Which is the Right One for Me?
API Description Languages: Which is the Right One for Me?
 
API Description Languages: Which is the Right One for Me?
API Description Languages: Which is the Right One for Me?API Description Languages: Which is the Right One for Me?
API Description Languages: Which is the Right One for Me?
 
Practices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPractices and Tools for Building Better APIs
Practices and Tools for Building Better APIs
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code Generation
 
APIdays 2015 - The State of Web API Languages
APIdays 2015 - The State of Web API LanguagesAPIdays 2015 - The State of Web API Languages
APIdays 2015 - The State of Web API Languages
 
APIdays 2015 - The State of Web API Languages
APIdays 2015 - The State of Web API LanguagesAPIdays 2015 - The State of Web API Languages
APIdays 2015 - The State of Web API Languages
 
Api design part 1
Api design part 1Api design part 1
Api design part 1
 
How to define an api
How to define an apiHow to define an api
How to define an api
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description Languages
 
Practices and tools for building better APIs
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIs
 
Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)
 
Api presentation
Api presentationApi presentation
Api presentation
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)
 
2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards
 
Serverless Functions and Machine Learning: Putting the AI in APIs
Serverless Functions and Machine Learning: Putting the AI in APIsServerless Functions and Machine Learning: Putting the AI in APIs
Serverless Functions and Machine Learning: Putting the AI in APIs
 

More from Corneil du Plessis

Sweet Streams (Are made of this)
Sweet Streams (Are made of this)Sweet Streams (Are made of this)
Sweet Streams (Are made of this)
Corneil du Plessis
 
Cloud Native Applications for Cloud Foundry using Spring Cloud : A Workshop
Cloud Native Applications for Cloud Foundry using Spring Cloud : A WorkshopCloud Native Applications for Cloud Foundry using Spring Cloud : A Workshop
Cloud Native Applications for Cloud Foundry using Spring Cloud : A Workshop
Corneil du Plessis
 
QueryDSL - Lightning Talk
QueryDSL - Lightning TalkQueryDSL - Lightning Talk
QueryDSL - Lightning Talk
Corneil du Plessis
 
Enhancements in Java 9 Streams
Enhancements in Java 9 StreamsEnhancements in Java 9 Streams
Enhancements in Java 9 Streams
Corneil du Plessis
 
Reactive Spring 5
Reactive Spring 5Reactive Spring 5
Reactive Spring 5
Corneil du Plessis
 
Performance Comparison JVM Languages
Performance Comparison JVM LanguagesPerformance Comparison JVM Languages
Performance Comparison JVM Languages
Corneil du Plessis
 
Microservices Patterns and Anti-Patterns
Microservices Patterns and Anti-PatternsMicroservices Patterns and Anti-Patterns
Microservices Patterns and Anti-Patterns
Corneil du Plessis
 
Consume Spring Data Rest with Angularjs
Consume Spring Data Rest with AngularjsConsume Spring Data Rest with Angularjs
Consume Spring Data Rest with Angularjs
Corneil du Plessis
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
Corneil du Plessis
 
Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!
Corneil du Plessis
 
Polyglot persistence with Spring Data
Polyglot persistence with Spring DataPolyglot persistence with Spring Data
Polyglot persistence with Spring Data
Corneil du Plessis
 
Data repositories
Data repositoriesData repositories
Data repositories
Corneil du Plessis
 
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting for
Corneil du Plessis
 
Dependency Injection in Spring in 10min
Dependency Injection in Spring in 10minDependency Injection in Spring in 10min
Dependency Injection in Spring in 10min
Corneil du Plessis
 
Spring Data in 10 minutes
Spring Data in 10 minutesSpring Data in 10 minutes
Spring Data in 10 minutes
Corneil du Plessis
 

More from Corneil du Plessis (15)

Sweet Streams (Are made of this)
Sweet Streams (Are made of this)Sweet Streams (Are made of this)
Sweet Streams (Are made of this)
 
Cloud Native Applications for Cloud Foundry using Spring Cloud : A Workshop
Cloud Native Applications for Cloud Foundry using Spring Cloud : A WorkshopCloud Native Applications for Cloud Foundry using Spring Cloud : A Workshop
Cloud Native Applications for Cloud Foundry using Spring Cloud : A Workshop
 
QueryDSL - Lightning Talk
QueryDSL - Lightning TalkQueryDSL - Lightning Talk
QueryDSL - Lightning Talk
 
Enhancements in Java 9 Streams
Enhancements in Java 9 StreamsEnhancements in Java 9 Streams
Enhancements in Java 9 Streams
 
Reactive Spring 5
Reactive Spring 5Reactive Spring 5
Reactive Spring 5
 
Performance Comparison JVM Languages
Performance Comparison JVM LanguagesPerformance Comparison JVM Languages
Performance Comparison JVM Languages
 
Microservices Patterns and Anti-Patterns
Microservices Patterns and Anti-PatternsMicroservices Patterns and Anti-Patterns
Microservices Patterns and Anti-Patterns
 
Consume Spring Data Rest with Angularjs
Consume Spring Data Rest with AngularjsConsume Spring Data Rest with Angularjs
Consume Spring Data Rest with Angularjs
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
 
Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!
 
Polyglot persistence with Spring Data
Polyglot persistence with Spring DataPolyglot persistence with Spring Data
Polyglot persistence with Spring Data
 
Data repositories
Data repositoriesData repositories
Data repositories
 
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting for
 
Dependency Injection in Spring in 10min
Dependency Injection in Spring in 10minDependency Injection in Spring in 10min
Dependency Injection in Spring in 10min
 
Spring Data in 10 minutes
Spring Data in 10 minutesSpring Data in 10 minutes
Spring Data in 10 minutes
 

Recently uploaded

Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
aymanquadri279
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 

Recently uploaded (20)

Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 

Empathic API-Design

  • 2. About Me ● Programmer since 1985 ● Smallest to very large systems. ● Cobol, Pascal, Algol, C/C++, Java, Scala, Groovy and other JVM languages. ● Scientific instrumentation, Sports event management, Mining, Banking, Treasury and Insurance. ● Software Architect (coding included)
  • 3. Quote The Opposite of Empathy is Contempt. Anonymous
  • 4. Introduction ● What is an API? ● Considerations in API Design ● Why Empathy in API Design? ● Documenting your API
  • 5. What is an API? Definition: Application Programming Interface Examples: – C stdlib.h – Java Standard Library – Spring Framework – Google Maps API – Facebook Graph API
  • 6. Considerations in API Design Quote: Everything should be made as simple as possible, but no simpler Albert Einstein
  • 7. Considerations in API Design Joshua Bloch Principal Software Engineer at Google How to Design a Good API and Why it Matters – Easy to learn – Easy to use, even without documentation – Hard to misuse – Easy to read and maintain code that uses it – Sufficiently powerful to satisfy requirements – Easy to extend – Appropriate to audience
  • 8. Considerations in API Design ● Simple ● Unambiguous ● Usage oriented ● Asset ● Discipline
  • 9. Why Empathy in API Design? ● When your audience doesn’t have an alternative. ● When your audience is human. ● Because they depend on it. ● Because they gave you money.
  • 10. Documenting your API ● Code is the document ● Tools – Javadoc – Doxygen – Asciidoc ● Rest API – RAML – Swagger – Spring Rest Docs
  • 11. RAML ● RESTful API Modeling Language ● RAML 0.8 – YAML – Like RFC ● RAML 1.0 – YAML 1.2 – Template URI – Data types – Annotations – Security Schemes
  • 12. RAML #%RAML 1.0 title: Spring Data Rest Demo API version: v1 protocols: [ HTTP ] baseUri: http://localhost/api mediaType: application/json types:
  • 13. RAML - Types types: User: type: object properties: userId: string emailAddress: string fullName: string dateOfBirth: date-only hasImage: boolean Group: type: object properties: description: string groupName: string groupOwner: User
  • 14. RAML – Operations /users: post: body: type: User description: Create a User responses: 200: body: type: User
  • 15. RAML - Operations /users/{id}: get: description: Get a User responses: 200: body: type: User 404: description: User doesn't exist /users/search: get: queryParameters: input: description: Sub string to match type: string responses: 200: body: type: User[]
  • 16. Swagger ● Swagger 2.0 ● JSON / YAML ● JSON Schema
  • 17. Swagger – Springfox ● Swagger from Annotations ● Spring MVC - Rest ● Swagger UI
  • 18. Springfox - Configuration @EnableSwagger2 @Configuration public class SwaggerConfiguration { @Bean public Docket swaggerSpringMvcPlugin() { return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()); } private ApiInfo apiInfo() { return new ApiInfo("Spring Data Rest Demo", "Demonstrate Spring Data RestController", "2", "/", new Contact("Corneil du Plessis", "", "corneil.duplessis@gmail.com"), "", ""); } }
  • 19. Springfox - Configuration @EnableWebMvc @Configuration public class WebApplicationConfiguration extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/swagger-ui.html") .addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**") .addResourceLocations( "classpath:/META-INF/resources/webjars/"); } }
  • 20. Swagger - Springfox @RequestMapping(path = "/users/{id}", method = RequestMethod.GET) @ApiOperation(value = "Get User") @ApiResponses({ @ApiResponse(code = 200, message = "Success", response = User.class), @ApiResponse(code = 404, message = "Entity Not Found") }) public ResponseEntity<User> getUser(@PathVariable("id") Long id) throws EntityNotFound { User user = userRepository.findOne(id); if (user == null) { throw new EntityNotFound(); } return ResponseEntity.ok(user); }
  • 22. Spring Rest Docs ● Documentation driven by Unit Tests – Asciidoc – Snippets – Conventions – Test Methods – Feedback on completeness
  • 24. Conclusion Questions? Resources – https://github.com/corneil/spring-data-rest-angular-demo – http://raml.org – http://swagger.io – http://springfox.github.io/springfox – https://projects.spring.io/spring-restdocs

Editor's Notes

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24