SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Downloaden Sie, um offline zu lesen
Input versioning
Dynamische idempotentie
Idempotentie
● Wiskundige idempotentie
f(f(x)) = f(x)
● Idempotentie in computerwetenschappen
Het resultaat van een operatie is hetzelfde ongeacht
het aantal keer ze opgeroepen wordt
Idempotentie in CW
● Functionele programmeertalen
● Netwerktoepassingen
○ Verloren berichten
“Idempotent Means It’s OK to Arrive Multiple Times”, Pat Helland
● HTTP
○ Idempotent: GET, PUT, DELETE
○ Niet idempotent: POST
● Scope (vb. logging)
Eenvoudige oplossing
● Enkel eerste keer uitvoeren
○ Message / task-id
○ Testen of al eerder uitgevoerd.
● Wat in het geval van fouten?
○ Gedeeltelijke uitvoering?
Idempotentie
Een programma is idempotent als het zijn input niet overschrijft.
Start
Write
Start
Write
Read
Start
Read
Write
Idempotent
Idempotent
NOT Idempotent
Dynamische idempotentie
● Eerste idee
Wanneer een input overschreven wordt, hou dan de originele waarde bij.
○ Probleem: detecteren inputs
● Vereenvoudiging
Wanneer een waarde overschreven wordt, die niet afkomstig is van de
actieve taak, hou dan de originele waarde bij.
Input versioning - Concept
● Hou bij tijdens welke taak de laatste write gebeurde
● Buiten task: normale uitvoering
● In task T:
○ Write: Als huidige inhoud niet geschreven is door T,
neem een input snapshot als er nog geen bestaat.
○ Read: Als de huidige inhoud geschreven is door een
vorige uitvoering van T, gebruik het input snapshot.
Input versioning - Example
Timeline
Variables
Snapshots
A
Task 1 Inputs
A
Task 1
1st run
B
1
2 3
3’
4 5
A
Task 1 Inputs
A
Task 1
2nd run
B
6
7
6’
8 9
1 task, 2 data fields (A, B)
1. Write initial input
2. Read stored A
3. Write stored A
3’. Snapshot original A
4. Read stored A
5. Read stored B
6. Read input A
6’. Read A from snapshot
7. Write stored A
8. Read stored A
9. Read stored B
Implementatie
● Postsharp
○ AOP framework
○ Compile-time weaving
● LocationInterceptionAspect
○ Intercepts get & set for fields and properties
○ IInstanceScopedAspect
Implementatie
● IdempotentValue
○ Bevat de input snapshots.
● IdempotentArray<T>
○ Vervangt C# arrays
○ Maakt gebruik van IdempotentValue
Unit test example
Code uit de simple particle simulation test.
Particles hebben een positie, snelheid en constante versnelling
Problemen
● Slechts één idempotente task (voorlopig!)
● Interception werkt niet voor structs
● Handmatig gebruik van IdempotentArray
Next
● Meerdere en geneste idempotente taken.
● Testen met algoritmen voor cobra.
Referenties
● http://en.wikipedia.org/wiki/Idempotence
● http://prasadnibhanipudi-thoughts.blogspot.be/2011/08/designing-
idempotent-services-and.html
● http://devhawk.net/2007/11/09/the-importance-of-idempotence/
● http://josephkirwin.com/2012/08/13/idempotency-is-a-goal-in-all-software-
design/
● http://journalofasoftwaredev.wordpress.com/2013/02/24/the-importance-of-
idempotent-services/

Weitere ähnliche Inhalte

Empfohlen

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Empfohlen (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Presentatie 13 10-21 simple input versioning (1)

  • 2. Idempotentie ● Wiskundige idempotentie f(f(x)) = f(x) ● Idempotentie in computerwetenschappen Het resultaat van een operatie is hetzelfde ongeacht het aantal keer ze opgeroepen wordt
  • 3. Idempotentie in CW ● Functionele programmeertalen ● Netwerktoepassingen ○ Verloren berichten “Idempotent Means It’s OK to Arrive Multiple Times”, Pat Helland ● HTTP ○ Idempotent: GET, PUT, DELETE ○ Niet idempotent: POST ● Scope (vb. logging)
  • 4. Eenvoudige oplossing ● Enkel eerste keer uitvoeren ○ Message / task-id ○ Testen of al eerder uitgevoerd. ● Wat in het geval van fouten? ○ Gedeeltelijke uitvoering?
  • 5. Idempotentie Een programma is idempotent als het zijn input niet overschrijft. Start Write Start Write Read Start Read Write Idempotent Idempotent NOT Idempotent
  • 6. Dynamische idempotentie ● Eerste idee Wanneer een input overschreven wordt, hou dan de originele waarde bij. ○ Probleem: detecteren inputs ● Vereenvoudiging Wanneer een waarde overschreven wordt, die niet afkomstig is van de actieve taak, hou dan de originele waarde bij.
  • 7. Input versioning - Concept ● Hou bij tijdens welke taak de laatste write gebeurde ● Buiten task: normale uitvoering ● In task T: ○ Write: Als huidige inhoud niet geschreven is door T, neem een input snapshot als er nog geen bestaat. ○ Read: Als de huidige inhoud geschreven is door een vorige uitvoering van T, gebruik het input snapshot.
  • 8. Input versioning - Example Timeline Variables Snapshots A Task 1 Inputs A Task 1 1st run B 1 2 3 3’ 4 5 A Task 1 Inputs A Task 1 2nd run B 6 7 6’ 8 9 1 task, 2 data fields (A, B) 1. Write initial input 2. Read stored A 3. Write stored A 3’. Snapshot original A 4. Read stored A 5. Read stored B 6. Read input A 6’. Read A from snapshot 7. Write stored A 8. Read stored A 9. Read stored B
  • 9. Implementatie ● Postsharp ○ AOP framework ○ Compile-time weaving ● LocationInterceptionAspect ○ Intercepts get & set for fields and properties ○ IInstanceScopedAspect
  • 10. Implementatie ● IdempotentValue ○ Bevat de input snapshots. ● IdempotentArray<T> ○ Vervangt C# arrays ○ Maakt gebruik van IdempotentValue
  • 11. Unit test example Code uit de simple particle simulation test. Particles hebben een positie, snelheid en constante versnelling
  • 12. Problemen ● Slechts één idempotente task (voorlopig!) ● Interception werkt niet voor structs ● Handmatig gebruik van IdempotentArray
  • 13. Next ● Meerdere en geneste idempotente taken. ● Testen met algoritmen voor cobra.
  • 14. Referenties ● http://en.wikipedia.org/wiki/Idempotence ● http://prasadnibhanipudi-thoughts.blogspot.be/2011/08/designing- idempotent-services-and.html ● http://devhawk.net/2007/11/09/the-importance-of-idempotence/ ● http://josephkirwin.com/2012/08/13/idempotency-is-a-goal-in-all-software- design/ ● http://journalofasoftwaredev.wordpress.com/2013/02/24/the-importance-of- idempotent-services/