Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TDD for SF User Group

Avatar for Sai Lavu Sai Lavu
October 24, 2013

TDD for SF User Group

Avatar for Sai Lavu

Sai Lavu

October 24, 2013
Tweet

Other Decks in Programming

Transcript

  1. Founder @ System Partners (Salesforce Consultancy) Like to create (code,

    startups) & automate things (or get Harry to do it?) 2002 Comp Sci Honours > Started working as Delphi dev > Dropped a UAT db on day 2 > Ran sub sec queries on GBs data in 2 yrs > Hacked Salesforce back when SControls existed & Apex didn’t > SP in 2008 > First 501 in APAC (I think) > 2010 helped build DataSan (queries 12+ million addresses with sub-sec search as you type response over HTTPS and offered as RESTful service) > lots of gigs in between ~ whoami
  2. Sai’s Rules • Less is more. Less lines is less

    to read & fewer things that break. • Should have no extraneous useless info. E.g., Edited by John Doe to implement 1+1=2 on 11/11/2011; or unused code. • Write code assuming the person reading it is a homicidal maniac and knows where you live. Good way to validate that is to do peer reviews early and often. • People who push commented code to prod should join the Nightwatch and man the wall.
  3. Goals for Today? • Lot of us can write great

    tests/test suites that are not brittle. • But a lot of us do not “think” tests & test data first. Ramblings in your head should be something like... ◦ Rather have a beer but need to build this, so let’s figure out how to test it and what’s my test data going to look like. • Your proficiency reaches another level when you can think in a language rather than just speaking it. Thinking tests first does that to your code. • Goal is not to teach you semantics of BDD or TDD. But motivate you to think firstly how to test something before building it.
  4. El Problema! • You provide counselling to kids; • Kids

    are allocated to come and see you each month on a given date; • You cannot provide counselling to a kid more than once a month; • If that date happens to be a public holiday or a weekend then you bump it to the next working day; • If applying the above adjustment pushes it to next month then just pick the last working day in the current month - otherwise two appointments occur in the same month. Pair up; grab a pencil and paper and lets work together to write some tests.