@kfirondev Scala from the Trenches @kfirondev Introduction to TDD and clean code Kfir Bloch Head of Backend Engineering
@kfirondev KFIR BLOCH ● Head of backend engineering @ Wix ● Hands-on developer above 17 years ● Joined Wix 5 years ago linkedin/in/blochkfir github.com/kfiron@kfirondevkfirb@wix.com
@kfirondev BASICS
@kfirondev@kfirondev THE ESSENCE OF TDD REFACTOR MAKE THE TEST PASS WRITE A FAILING TEST
@kfirondev@kfirondev Great software is something to marvel at: powerful, elegant, functional, a pleasure to work with as both a developer and as a user. Great software isn’t written by machines. It is written by professionals with an unshakable commitment to craftsmanship. “ “
@kfirondev@kfirondev TDD is based on a simple idea: Write tests for your code before you write the code itself. However, this "simple" idea takes skill and judgment to do well. Now there's a practical guide to TDD that takes you beyond the basic concepts. “ “
@kfirondev@kfirondev Unit Test FakesCollaborators Stubs Matchers Integration Tests Mocks Contract tests www.maplecityrubber.com TDD & CLEAN CODE “BUZZWORDS” Refactoring
@kfirondev USE CASE
@kfirondev@kfirondev Get - prize Get - prize OK OK Get - prize Get - prize Already wonAlready played Get - prize Get - prize Get - prize Get - prize Get - prize Get - prize Get - prize Get - prize Get - prize Get - prize Already won Already won Already won Already won Already won Already won Already won Already won Already won Already won USER QUIZ PRIZE SERVER DATABASE
@kfirondev@kfirondev Get - prize Get - prize OK OK Get - prize Already played Get - prize Get - prize Get - prize Get - prize Get - prize Already won Already won Already won Already won Already won USER QUIZ PRIZE SERVER DATABASE FAIL FAST PATTERN T H R O T T L E R ROLLING WINDOW KEY (user-id) THROTTLER
@kfirondev LET’S CODE
@kfirondev • TDD & Clean code definitions • DOS attack use case • Developed rolling window throttler • Wire the throttler to pre-baked service Summary of what we did
@kfirondev • ~120 backend developers • Zero QA engineers • ~100 deployments per day It works for us projectlifemastery.com
@kfirondev • Throttler code -> https://github.com/kfiron/tdd-clean-code-workshop-result • Demo app code -> https://github.com/kfiron/java-one-demo-app Resources github.com/kfiron
@kfirondev linkedin/in/blochkfir github.com/kfiron@kfirondevkfirb@wix.com Kfir Bloch Head of Backend Engineering Q&A
@kfirondev Thank YouWix Engineering Blog http://engineering.wix.com/ We are hiring http://jobs.wix.com email jobs@wix.com @kfirondev Kfir Bloch Head of Backend Engineering

Scala from the Trenches - Java One 2016

Editor's Notes

  • #4 The first case is degradation of service
  • #6 Inspire me and drive how I do TDD
  • #8 Many people thinks that code before tests, it is just unit tests I will try to show you some of it in the live coding
  • #9 The first case is degradation of service
  • #10 Already won
  • #11 It not about correctness , it is about resources