SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
Talk	at	„Write	the	Docs“	
Prague,	20th	September	2016	
Jan	ChrisAan	Krause	
	
Using Meaningful
Names to Improve
API-Documentation
©iteratec	
Wri$ng	useful	API-Documenta$on	is	difficult	...	
How	to	migitate	obstacles?	
› Include	good	examples	
› Be	complete	
› Support	many	complex	usage	scenarios	
› Be	conveniently	organized	
› Include	relevant	design	elements	
MarAn	P.	Robillard:	What	Makes	APIs	Hard	to	Learn?	Answers	from	Developers;	In:	IEEE	SoRware,	Vol.	26,	No.	6;	2009	
2016-09-20	|	„Write	the	Docs“	
2
©iteratec	©iteratec	©iteratec	
		
Improving	Completeness	of	API-Documenta$on	
An	Example	from	the	Java	8	Mail	API	
public	abstract	class	Transport	extends	Service	{	
		
	
	
	
					
					
				public	void	send(Message	msg)	throws	MessagingExcepAon	{	
						//	... 		
				}	
}	
	/**	
					*		
					*	@param	msg	
					*	@throws	MessagingExcepAon	
					*	
					*/	
Addressee(s)?	
Message-
Format?	
Via	which	
Server?	
Excep$onal	
States?	
							Sends	a	message.	
2016-09-20	|	„Write	the	Docs“	
3
©iteratec	
Names	allow	Verifica$on	
Are	these	Objects	Volkswagen	Type	2	T3-Busses?	
==	
Matches	
Paaern?	
Object	A	
Object	B	
2016-09-20	|	„Write	the	Docs“	
4
©iteratec	
Match	the	API-DocumentaAon			
against	the	chosen	paaern	
3	
Applying	Documenta$on	PaWerns	
SubmiXng	Opera$on	
Verbs:	 to	send,	to	submit,	to	noAfy	
@DESTINATION	 Where	the	MESSAGE	is	recieved	
@MESSAGE	 What	is	transferred	
@FORMAT	 The	structure	of	the	transferred	MESSAGE	
@INSTRUMENT	 The	infrastructure	used	to	transfer	the	
MESSAGE	
›  public	void	send(Message	msg)	
›  public	void	submit(Message	msg)	
›  public	void	noAfy(Message	msg)	
›  [...]	
Choose	the	Verb		
for	the	operaAon	
1	
Find	the	best	matching	
documentaAon	
paaern	
2	
2016-09-20	|	„Write	the	Docs“	
5
©iteratec	
Using	Names	to	Detect	Gaps	in	API-Documenta$on	
Applying	Documenta$on	PaWerns	(I)	
	/**	
			*	Sends	a	message.	
			*	
			*	@des$na$on	The	message	will	be	sent	to	all	recipient	addresses	specified	in	the	message	(as	
			*	returned	from	the	Message	method	getAllRecipients),	using	message	transports	appropriate		
			*	to	each	address.	The	send	method	calls	the	saveChanges	method	on	the	message	before	sending	it.	
			*	
			*	@instrument	Note	that	send	is	a	staAc	method	that	creates	and	manages	its	own	connecAon.	
			*	Any	connecAon	associated	with	any	Transport	instance	used	to	invoke	this	method	is	ignored	and	
			*	not	used.		This	method	should	only	be	invoked	using	the	form	Transport.send(msg),	and		should	never	
			*	be	invoked	using	an	instance	variable.	
			*	@param	msg	[MESSAGE]	
			*	@throws	MessagingExcepAon	
			*	[...]	
2016-09-20	|	„Write	the	Docs“	
6
©iteratec	
Using	Names	to	Detect	Gaps	in	API-Documenta$on	
Applying	Documenta$on	PaWerns	(II)	
			*	@des$na$on	[ERROR]	In	typical	usage,	a	SendFailedExcepAon	reflects	an	error	detected	by	the	server.			
			*	The	details	of	the	SendFailedExcepAon	will	usually	contain	the	error	message	from	the	server	(such	as	an		
			*	SMTP	error	message).		An	address	may	be	detected	as	invalid	for	a	variety	of	reasons	-	the	address	may		
			*	not	exist,	the	address	may	have	invalid	syntax,	the	address	may	have	exceeded	its	quota,	etc.	If	any	of		
			*	the	recipient	addresses	is	detected	to	be	invalid	by	the	Transport	during	message	submission,	a		
			*	SendFailedExcepAon	is	thrown.		Clients	can	get	more	detail	about	the	failure	by	examining	the	excepAon.			
			*	Whether	or	not	the	message	is	sAll	sent	successfully	to	any	valid	addresses	depends	on	the	Transport		
			*	implementaAon.	See	SendFailedExcepAon	for	more	details.		
			*		
			*	@instrument	[ERROR]	Note	also	that	success	does	not	imply	that	the	message	was	delivered	to	the		
			*	ulAmate	recipient,	as	failures	may	occur	in	later	stages	of	delivery.		Once	a	Transport	accepts	a	message		
			*	for	delivery	to	a	recipient,	failures	that	occur	later	should	be	reported	to	the	user	via	another		
			*	mechanism,	such	as	returning	the	undeliverable	message.		
			**/	
2016-09-20	|	„Write	the	Docs“	
7
©iteratec	
The	Documenta$on	PaWerns	I	found	so	far	...	
2016-09-20	|	„Write	the	Docs“	
8	
Types	of	Opera$ons:	
Checking	 Deriving	 Merging	 Parsing	 DeposiAng	
Reading	 DeleAng	
ConverAng	 Searching		
Submitng	
IniiaAng	 Replacing	
Traversing	 ….	
Describing	
Resetng	
CompuAng	
ConnecAng	
CreaAng	
DuplicaAng	
Logging
©iteratec	
I share them here:
github.com/jankrause/wtd-2016
©iteratec	
Advantages	of	this	Approach:	
›  IdenAfy	characterisAcs	of	an	operaAon,	which	are	invisible	on	its	signature		
(e.g.	resources,	algorithms	or	formulas)	
›  Derive	excepAonal	cases	
›  Improve	understandability	of	the	API	through	usage	of	meaningful	verbs
www.iteratec.de	
Dr. Jan Christian Krause
Mail: jan-christian.krause@iteratec.de
Twitter: @idocit
Github: github.com/jankrause

Contenu connexe

Similaire à Using Meaningful Names to Improve API Documentation

Big Data on EC2: Mashing Technology in the Cloud
Big Data on EC2: Mashing Technology in the CloudBig Data on EC2: Mashing Technology in the Cloud
Big Data on EC2: Mashing Technology in the Cloud
George Ang
 
Jax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 PlatformJax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 Platform
WSO2
 
Xml web services
Xml web servicesXml web services
Xml web services
Raghu nath
 

Similaire à Using Meaningful Names to Improve API Documentation (20)

Mashups
MashupsMashups
Mashups
 
Microservices: Lessons Learned
Microservices: Lessons LearnedMicroservices: Lessons Learned
Microservices: Lessons Learned
 
OSCON 2013: Using Cascalog to build an app with City of Palo Alto Open Data
OSCON 2013: Using Cascalog to build an app with City of Palo Alto Open DataOSCON 2013: Using Cascalog to build an app with City of Palo Alto Open Data
OSCON 2013: Using Cascalog to build an app with City of Palo Alto Open Data
 
Using Cascalog to build an app with City of Palo Alto Open Data
Using Cascalog to build an app with City of Palo Alto Open DataUsing Cascalog to build an app with City of Palo Alto Open Data
Using Cascalog to build an app with City of Palo Alto Open Data
 
Wikipedia’s Event Data Platform, Or: JSON Is Okay Too With Andrew Otto | Curr...
Wikipedia’s Event Data Platform, Or: JSON Is Okay Too With Andrew Otto | Curr...Wikipedia’s Event Data Platform, Or: JSON Is Okay Too With Andrew Otto | Curr...
Wikipedia’s Event Data Platform, Or: JSON Is Okay Too With Andrew Otto | Curr...
 
Teched India Vijay Interop Track
Teched India Vijay Interop TrackTeched India Vijay Interop Track
Teched India Vijay Interop Track
 
WP Solutions- Adi.pdf
WP Solutions- Adi.pdfWP Solutions- Adi.pdf
WP Solutions- Adi.pdf
 
Implement Web API with Swagger
Implement Web API with SwaggerImplement Web API with Swagger
Implement Web API with Swagger
 
Decompose That WAR! Architecting for Adaptability, Scalability, and Deployabi...
Decompose That WAR! Architecting for Adaptability, Scalability, and Deployabi...Decompose That WAR! Architecting for Adaptability, Scalability, and Deployabi...
Decompose That WAR! Architecting for Adaptability, Scalability, and Deployabi...
 
Big Data on EC2: Mashing Technology in the Cloud
Big Data on EC2: Mashing Technology in the CloudBig Data on EC2: Mashing Technology in the Cloud
Big Data on EC2: Mashing Technology in the Cloud
 
Migrating Apps To Azure
Migrating Apps To AzureMigrating Apps To Azure
Migrating Apps To Azure
 
Jax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 PlatformJax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 Platform
 
Resume
ResumeResume
Resume
 
Documentum Spring Data
Documentum Spring DataDocumentum Spring Data
Documentum Spring Data
 
Vijay Mix Presentation
Vijay Mix PresentationVijay Mix Presentation
Vijay Mix Presentation
 
SAP integration sample payloads for Azure Logic Apps
SAP integration sample payloads for Azure Logic AppsSAP integration sample payloads for Azure Logic Apps
SAP integration sample payloads for Azure Logic Apps
 
The Glory of Rest
The Glory of RestThe Glory of Rest
The Glory of Rest
 
Arc Ready Cloud Computing
Arc Ready Cloud ComputingArc Ready Cloud Computing
Arc Ready Cloud Computing
 
Xml web services
Xml web servicesXml web services
Xml web services
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
 

Plus de Jan Christian Krause (6)

iDocIt - Ein Assistent zur API-Dokumentation
iDocIt - Ein Assistent zur API-DokumentationiDocIt - Ein Assistent zur API-Dokumentation
iDocIt - Ein Assistent zur API-Dokumentation
 
Vermeidung von Stille und Rauschen in API-Dokumentatio
Vermeidung von Stille und Rauschen in API-DokumentatioVermeidung von Stille und Rauschen in API-Dokumentatio
Vermeidung von Stille und Rauschen in API-Dokumentatio
 
Gut dokumentiert ist halb gesichert
Gut dokumentiert ist halb gesichertGut dokumentiert ist halb gesichert
Gut dokumentiert ist halb gesichert
 
Systematische Konstruktion von API-Verträgen
Systematische Konstruktion von API-VerträgenSystematische Konstruktion von API-Verträgen
Systematische Konstruktion von API-Verträgen
 
Mut zur Lücke - Werkzeuge zur alltagstauglichen Dokumentation
Mut zur Lücke - Werkzeuge zur alltagstauglichen DokumentationMut zur Lücke - Werkzeuge zur alltagstauglichen Dokumentation
Mut zur Lücke - Werkzeuge zur alltagstauglichen Dokumentation
 
Leichtgewichtige API Dokumentation
Leichtgewichtige API DokumentationLeichtgewichtige API Dokumentation
Leichtgewichtige API Dokumentation
 

Dernier

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Dernier (20)

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 

Using Meaningful Names to Improve API Documentation