SlideShare uma empresa Scribd logo
1 de 36
Baixar para ler offline
Test Failed, Then...

Optimizing communication between people	
Toru Furukawa"
@torufurukawa"
Agenda	
•  Introduction

Web app syncing with live TV show"
•  Loose coupling"
•  Testable components"
•  Efficient communication"
Agile App Development 

on Concrete Backend Services	
HTML App"
App Server	
Backend Service(s)"
Project	
  dependent	
Common
Because...	
•  Requirements keep changing"
•  Not only Web, but also TV"
•  Not only TV, but also Web"
•  Spiky access traffic"
•  Common fundamental features"
▼"
•  Easy to change application"
•  Well tested platform"
Ended up with…	
HTML App"
App Server	
Counter" Messenger"
High Communication Cost	
"Communication overheads increase as the
number of people increases." F. Brooks"
Minimal and Effective Communication
Optimize Communication	
•  Between Components"
•  Between People
How to Simplify Dependency?	
HTML App"
App Server	
 Counter" Messenger"
PHP	
•  IMPORTANT: PHP is fine"
•  Cannot be combined with Python
component in language layer easily
Loose Coupling	
"Write small services that speak HTTP and
bridge them together with another
application.""
Armin Ronacher (@mitsuhiko)"
http://lucumr.pocoo.org/2010/12/24/common-mistakes-as-web-developer/
Loose Coupling	
HTML App"
(JavaScript)	
App Server"
(whatever)	
Counter"
(Python)	
Messenger"
(Node.js)	
HTTP
Assign Engineer for Component	
HTML App"
(JavaScript)	
App Server"
(whatever)	
Counter"
(Python)	
Messenger"
(Node.js)	
HTTP
Communication Paths
2 Projects Running
Wrap Engineers' Communication	
•  New layers to simplify inter-component
communication"
•  Assign new roles to simplify inter-people
communication
HTML App"
(JavaScript)	
App Server"
(whatever)	
Counter"
(Python)	
Messenger"
(Node.js)	
Server/Server Communication"
(Python)	
Client/Server Communication
If a servicewise feature does not
work, how to identify the cause?"
•  Ask developer to check logs?"
•  Ask developer to check DB?"
▼"
Make component diagnosable"
Instrument Components
Log with fluentd	
App Server"
(whatever)	
Counter"
(Python)	
Messenger"
(Node.js)	
fluentd	
Mongo	
  DB	
 Web App
Define CRUD APIs	
•  Make DB accessible from test and admin	
•  REST /objects/:id"
•  /get_objects

/get_object, /set_object, /delete_object"
▼"
•  Diagnose 1-layer deeper from outside"
"requests" package 

for Web API Access	
>>>	
  r	
  =	
  requests.get(url,	
  auth=(...),	
  ...)	
  
>>>	
  r	
  =	
  requests.post(url,	
  data={...},	
  ...)	
  
>>>	
  r.status_code	
  
200	
  
>>>	
  r.content	
  
u'{"foo":"bar","x":true}'	
  
>>>	
  r.json()	
  
{u'foo':	
  u'bar',	
  'x':	
  True}	
  
Library for Productivity	
•  Use testing libraries to increase
productivity 

i.e. how many test you write per hour"
•  setup and teardown"
– unittest"
– nose"
– py.test"
– testfixtures"
– etc.
Translate Test Report	
Traceback	
  (most	
  recent	
  call	
  last):	
  
	
  	
  File	
  "mytest.py",	
  line	
  7,	
  in	
  test	
  
	
  	
  	
  	
  assert	
  result	
  ==	
  expected	
  
AssertionError	
  
▼"
•  How do YOU determine what is wrong?"
•  How do you tell OTHERS what is wrong?"
▼"
•  Need better way to communicate
Library for Readability	
class	
  MyTest(unittest.TestCase):	
  
	
  	
  	
  	
  def	
  test(self):	
  
	
  	
  	
  	
  	
  	
  	
  	
  expected	
  =	
  {...}	
  
	
  	
  	
  	
  	
  	
  	
  	
  result	
  =	
  {...}	
  
	
  	
  	
  	
  	
  	
  	
  	
  self.assertEqual(x,	
  y)	
  
"
"
Traceback	
  (most	
  recent	
  call	
  last):	
  
	
  	
  File	
  "mytest.py",	
  line	
  7,	
  in	
  test	
  
	
  	
  	
  	
  self.assertEqual(x,	
  y)	
  
AssertionError:	
  {'items':	
  ['spam',	
  'spam'],	
  
'foo':	
  'bar'}	
  !=	
  {'items':	
  ['spam',	
  'ham'],	
  
'foo':	
  'bar'}	
  
-­‐	
  {'foo':	
  'bar',	
  'items':	
  ['spam',	
  'spam']}	
  
?	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ^^	
  
	
  
+	
  {'foo':	
  'bar',	
  'items':	
  ['spam',	
  'ham']}	
  
?	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ^
Python vs HTTP	
Python	
HTTP	
Test Fast	
Loosely
Couple	
Develop
Fast
If I stick to Python too much,

my communication is

tightly coupled
Convert requests function to curl	
>>>	
  import	
  curledrequests	
  as	
  requests	
  
>>>	
  requests.debug	
  =	
  True	
  
>>>	
  r	
  =	
  requests.get(	
  
...	
  	
  	
  'http://www.google.com/',	
  
...	
  	
  	
  params={'q':'python'})	
  
...	
  
$	
  curl	
  “http://www.google.com/?q=python”	
  -­‐w	
  
'n%{http_code}n'	
  
<!doctype	
  html><html	
  itemscope=""	
  
itemtype="http://schema.org/WebPage"><head><me	
  
...	
  
200	
  
h5p://goo.gl/hO579O	
  
Loosely Couple

Components and Engineers
Share Your Practice	
@torufurukawa or grab me"

Mais conteúdo relacionado

Mais procurados

2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
Puppet
 
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜 AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
崇之 清水
 

Mais procurados (20)

Background processing with Resque
Background processing with ResqueBackground processing with Resque
Background processing with Resque
 
Deploying on the cutting edge
Deploying on the cutting edgeDeploying on the cutting edge
Deploying on the cutting edge
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
 
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.
 
Performance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-MechanizePerformance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-Mechanize
 
Using Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelinesUsing Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelines
 
Introdution to Node.js
Introdution to Node.jsIntrodution to Node.js
Introdution to Node.js
 
Stress Testing at Twitter: a tale of New Year Eves
Stress Testing at Twitter: a tale of New Year EvesStress Testing at Twitter: a tale of New Year Eves
Stress Testing at Twitter: a tale of New Year Eves
 
So you think JSON is cool?
So you think JSON is cool?So you think JSON is cool?
So you think JSON is cool?
 
Faster PHP apps using Queues and Workers
Faster PHP apps using Queues and WorkersFaster PHP apps using Queues and Workers
Faster PHP apps using Queues and Workers
 
Mad scalability: Scaling when you are not Google
Mad scalability: Scaling when you are not GoogleMad scalability: Scaling when you are not Google
Mad scalability: Scaling when you are not Google
 
Chef conf-2014
Chef conf-2014Chef conf-2014
Chef conf-2014
 
Automated interactive testing for i os
Automated interactive testing for i osAutomated interactive testing for i os
Automated interactive testing for i os
 
Getting testy with Perl
Getting testy with PerlGetting testy with Perl
Getting testy with Perl
 
Introduction to Celery
Introduction to CeleryIntroduction to Celery
Introduction to Celery
 
API Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationAPI Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API Documentation
 
Queue your work
Queue your workQueue your work
Queue your work
 
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜 AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
 
DevOps with Serverless
DevOps with ServerlessDevOps with Serverless
DevOps with Serverless
 
Wrangling WP_Cron - WordCamp Grand Rapids 2014
Wrangling WP_Cron - WordCamp Grand Rapids 2014Wrangling WP_Cron - WordCamp Grand Rapids 2014
Wrangling WP_Cron - WordCamp Grand Rapids 2014
 

Destaque

John De Jong: Optimizing Test & Courseware Development
John De Jong: Optimizing Test & Courseware DevelopmentJohn De Jong: Optimizing Test & Courseware Development
John De Jong: Optimizing Test & Courseware Development
eaquals
 

Destaque (14)

John De Jong: Optimizing Test & Courseware Development
John De Jong: Optimizing Test & Courseware DevelopmentJohn De Jong: Optimizing Test & Courseware Development
John De Jong: Optimizing Test & Courseware Development
 
Accenture testingchallenge casestudy Cgs test estimates
Accenture testingchallenge casestudy Cgs test estimatesAccenture testingchallenge casestudy Cgs test estimates
Accenture testingchallenge casestudy Cgs test estimates
 
Estimator Metrics - Test Time Assessment
Estimator Metrics - Test Time AssessmentEstimator Metrics - Test Time Assessment
Estimator Metrics - Test Time Assessment
 
Test Process Maturity Measurement and Related Measurements
Test Process Maturity Measurement and Related MeasurementsTest Process Maturity Measurement and Related Measurements
Test Process Maturity Measurement and Related Measurements
 
2017 | E-Brochure | Professional Project Management - PPM (3 Days) | Project ...
2017 | E-Brochure | Professional Project Management - PPM (3 Days) | Project ...2017 | E-Brochure | Professional Project Management - PPM (3 Days) | Project ...
2017 | E-Brochure | Professional Project Management - PPM (3 Days) | Project ...
 
Software Testing Metrics with qTest Insights - QASymphony Webinar
Software Testing Metrics with qTest Insights  - QASymphony WebinarSoftware Testing Metrics with qTest Insights  - QASymphony Webinar
Software Testing Metrics with qTest Insights - QASymphony Webinar
 
Software Test Metrics and Measurements
Software Test Metrics and MeasurementsSoftware Test Metrics and Measurements
Software Test Metrics and Measurements
 
2017 | E-Brochure | PMP® Fast Track (4 Days) | Project Management Training - ...
2017 | E-Brochure | PMP® Fast Track (4 Days) | Project Management Training - ...2017 | E-Brochure | PMP® Fast Track (4 Days) | Project Management Training - ...
2017 | E-Brochure | PMP® Fast Track (4 Days) | Project Management Training - ...
 
Agile Testing
Agile Testing  Agile Testing
Agile Testing
 
ISTQB REX BLACK book
ISTQB REX BLACK bookISTQB REX BLACK book
ISTQB REX BLACK book
 
Careers in software testing
Careers in software testingCareers in software testing
Careers in software testing
 
The Gartner IAM Program Maturity Model
The Gartner IAM Program Maturity ModelThe Gartner IAM Program Maturity Model
The Gartner IAM Program Maturity Model
 
PMBOK-5th ed: PMP- Flashcards Part1/5
PMBOK-5th ed: PMP- Flashcards Part1/5PMBOK-5th ed: PMP- Flashcards Part1/5
PMBOK-5th ed: PMP- Flashcards Part1/5
 
Learning pmp formulas the easy way
Learning pmp formulas the easy wayLearning pmp formulas the easy way
Learning pmp formulas the easy way
 

Semelhante a Test Failed, Then...

Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb Highlights
Romain Guy
 

Semelhante a Test Failed, Then... (20)

Message Passing vs. Data Synchronization
Message Passing vs. Data SynchronizationMessage Passing vs. Data Synchronization
Message Passing vs. Data Synchronization
 
Tests in Javascript using Jasmine and Testacular
Tests in Javascript using Jasmine and TestacularTests in Javascript using Jasmine and Testacular
Tests in Javascript using Jasmine and Testacular
 
OpenAI API crash course
OpenAI API crash courseOpenAI API crash course
OpenAI API crash course
 
Announcing AWS Step Functions - December 2016 Monthly Webinar Series
Announcing AWS Step Functions - December 2016 Monthly Webinar SeriesAnnouncing AWS Step Functions - December 2016 Monthly Webinar Series
Announcing AWS Step Functions - December 2016 Monthly Webinar Series
 
CDC Tests - Integration Tests cant be made simpler than this!
CDC Tests - Integration Tests cant be made simpler than this!CDC Tests - Integration Tests cant be made simpler than this!
CDC Tests - Integration Tests cant be made simpler than this!
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTP
 
MongoDB World 2018: Tutorial - Free the DBA: Building Chat Bots to Triage, Mo...
MongoDB World 2018: Tutorial - Free the DBA: Building Chat Bots to Triage, Mo...MongoDB World 2018: Tutorial - Free the DBA: Building Chat Bots to Triage, Mo...
MongoDB World 2018: Tutorial - Free the DBA: Building Chat Bots to Triage, Mo...
 
Mountebank and you
Mountebank and youMountebank and you
Mountebank and you
 
Swift meetup22june2015
Swift meetup22june2015Swift meetup22june2015
Swift meetup22june2015
 
Introduction to AWS Step Functions:
Introduction to AWS Step Functions: Introduction to AWS Step Functions:
Introduction to AWS Step Functions:
 
When GenAI meets with Java with Quarkus and langchain4j
When GenAI meets with Java with Quarkus and langchain4jWhen GenAI meets with Java with Quarkus and langchain4j
When GenAI meets with Java with Quarkus and langchain4j
 
AWS Step Functions을 활용한 서버리스 앱 오케스트레이션
AWS Step Functions을 활용한 서버리스 앱 오케스트레이션AWS Step Functions을 활용한 서버리스 앱 오케스트레이션
AWS Step Functions을 활용한 서버리스 앱 오케스트레이션
 
User Expectations in Mobile App Security
User Expectations in Mobile App SecurityUser Expectations in Mobile App Security
User Expectations in Mobile App Security
 
Пирамида Тестирования через призму ROI калькулятора и прочая геометрия
Пирамида Тестирования через призму ROI калькулятора и прочая геометрияПирамида Тестирования через призму ROI калькулятора и прочая геометрия
Пирамида Тестирования через призму ROI калькулятора и прочая геометрия
 
Test Pyramid vs Roi
Test Pyramid vs Roi Test Pyramid vs Roi
Test Pyramid vs Roi
 
Transferring Software Testing Tools to Practice
Transferring Software Testing Tools to PracticeTransferring Software Testing Tools to Practice
Transferring Software Testing Tools to Practice
 
Idea2app
Idea2appIdea2app
Idea2app
 
Modern Python Testing
Modern Python TestingModern Python Testing
Modern Python Testing
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb Highlights
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 

Mais de Toru Furukawa (10)

Twitter 広告と API を組み合わせたインタラクティブなキャンペーン
 Twitter 広告と API を組み合わせたインタラクティブなキャンペーン Twitter 広告と API を組み合わせたインタラクティブなキャンペーン
Twitter 広告と API を組み合わせたインタラクティブなキャンペーン
 
My client wanted their apps synced, and I made it with Go
My client wanted their apps synced, and I made it with GoMy client wanted their apps synced, and I made it with Go
My client wanted their apps synced, and I made it with Go
 
Introduction to Python 3.4 as of beta 1
Introduction to Python 3.4 as of beta 1Introduction to Python 3.4 as of beta 1
Introduction to Python 3.4 as of beta 1
 
おまえらこのライブラリ使ってないの? m9 (2013-07)
おまえらこのライブラリ使ってないの? m9	(2013-07)おまえらこのライブラリ使ってないの? m9	(2013-07)
おまえらこのライブラリ使ってないの? m9 (2013-07)
 
Mock and patch
Mock and patchMock and patch
Mock and patch
 
Python 3.3 チラ見
Python 3.3 チラ見Python 3.3 チラ見
Python 3.3 チラ見
 
Python32 pyhackathon-201011
Python32 pyhackathon-201011Python32 pyhackathon-201011
Python32 pyhackathon-201011
 
Django
Django Django
Django
 
Python 2.7
Python 2.7Python 2.7
Python 2.7
 
BPStudy#34 導入
BPStudy#34 導入BPStudy#34 導入
BPStudy#34 導入
 

Último

Último (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Test Failed, Then...

  • 1. Test Failed, Then...
 Optimizing communication between people Toru Furukawa" @torufurukawa"
  • 2. Agenda •  Introduction
 Web app syncing with live TV show" •  Loose coupling" •  Testable components" •  Efficient communication"
  • 3.
  • 4. Agile App Development 
 on Concrete Backend Services HTML App" App Server Backend Service(s)" Project  dependent Common
  • 5. Because... •  Requirements keep changing" •  Not only Web, but also TV" •  Not only TV, but also Web" •  Spiky access traffic" •  Common fundamental features" ▼" •  Easy to change application" •  Well tested platform"
  • 6. Ended up with… HTML App" App Server Counter" Messenger"
  • 7. High Communication Cost "Communication overheads increase as the number of people increases." F. Brooks"
  • 8. Minimal and Effective Communication
  • 9. Optimize Communication •  Between Components" •  Between People
  • 10.
  • 11. How to Simplify Dependency? HTML App" App Server Counter" Messenger"
  • 12. PHP •  IMPORTANT: PHP is fine" •  Cannot be combined with Python component in language layer easily
  • 13. Loose Coupling "Write small services that speak HTTP and bridge them together with another application."" Armin Ronacher (@mitsuhiko)" http://lucumr.pocoo.org/2010/12/24/common-mistakes-as-web-developer/
  • 14. Loose Coupling HTML App" (JavaScript) App Server" (whatever) Counter" (Python) Messenger" (Node.js) HTTP
  • 15. Assign Engineer for Component HTML App" (JavaScript) App Server" (whatever) Counter" (Python) Messenger" (Node.js) HTTP
  • 18. Wrap Engineers' Communication •  New layers to simplify inter-component communication" •  Assign new roles to simplify inter-people communication
  • 20.
  • 21.
  • 22. If a servicewise feature does not work, how to identify the cause?" •  Ask developer to check logs?" •  Ask developer to check DB?" ▼" Make component diagnosable" Instrument Components
  • 23. Log with fluentd App Server" (whatever) Counter" (Python) Messenger" (Node.js) fluentd Mongo  DB Web App
  • 24. Define CRUD APIs •  Make DB accessible from test and admin •  REST /objects/:id" •  /get_objects
 /get_object, /set_object, /delete_object" ▼" •  Diagnose 1-layer deeper from outside"
  • 25. "requests" package 
 for Web API Access >>>  r  =  requests.get(url,  auth=(...),  ...)   >>>  r  =  requests.post(url,  data={...},  ...)   >>>  r.status_code   200   >>>  r.content   u'{"foo":"bar","x":true}'   >>>  r.json()   {u'foo':  u'bar',  'x':  True}  
  • 26. Library for Productivity •  Use testing libraries to increase productivity 
 i.e. how many test you write per hour" •  setup and teardown" – unittest" – nose" – py.test" – testfixtures" – etc.
  • 27.
  • 28. Translate Test Report Traceback  (most  recent  call  last):      File  "mytest.py",  line  7,  in  test          assert  result  ==  expected   AssertionError   ▼" •  How do YOU determine what is wrong?" •  How do you tell OTHERS what is wrong?" ▼" •  Need better way to communicate
  • 29. Library for Readability class  MyTest(unittest.TestCase):          def  test(self):                  expected  =  {...}                  result  =  {...}                  self.assertEqual(x,  y)   " "
  • 30. Traceback  (most  recent  call  last):      File  "mytest.py",  line  7,  in  test          self.assertEqual(x,  y)   AssertionError:  {'items':  ['spam',  'spam'],   'foo':  'bar'}  !=  {'items':  ['spam',  'ham'],   'foo':  'bar'}   -­‐  {'foo':  'bar',  'items':  ['spam',  'spam']}   ?                                                                      ^^     +  {'foo':  'bar',  'items':  ['spam',  'ham']}   ?                                                                      ^
  • 31. Python vs HTTP Python HTTP Test Fast Loosely Couple Develop Fast
  • 32. If I stick to Python too much,
 my communication is
 tightly coupled
  • 33. Convert requests function to curl >>>  import  curledrequests  as  requests   >>>  requests.debug  =  True   >>>  r  =  requests.get(   ...      'http://www.google.com/',   ...      params={'q':'python'})   ...   $  curl  “http://www.google.com/?q=python”  -­‐w   'n%{http_code}n'   <!doctype  html><html  itemscope=""   itemtype="http://schema.org/WebPage"><head><me   ...   200   h5p://goo.gl/hO579O  
  • 34.