Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Fail Fast. Into User's Face.

1,365 views

Published on

GeeCON 2016; Krakow, Poland; 13 May 2016

Published in: Software
  • Be the first to comment

  • Be the first to like this

Fail Fast. Into User's Face.

  1. 1. /10@yegor256 1 Fail Fast.
 Into User’s Face. Yegor Bugayenko
  2. 2. /10@yegor256 2 be arrogant
  3. 3. /10@yegor256 3 int len(File f) { if (f == null) { return -1; } } int len(File f) { if (f == null) { throw new Exception( “file can’t be NULL” ); } }
  4. 4. /10@yegor256 4 try { stream.read(); } catch (IOException ex) { ex.printStackTrace(); } try { stream.read(); } catch (IOException ex) { throw new RuntimeException( “failed to read stream”, ex ); }
  5. 5. /10@yegor256 5 void push(int x) { if (pos < array.length) { array[pos++] = x; } } void push(int x) { if (pos >= array.length) { throw new Exception( “array is full” ); } array[pos++] = x; }
  6. 6. /10@yegor256 6 @Override void save() { // not implemented yet } @Override void save() { throw new Exception( “not implemented yet” ); }
  7. 7. /10@yegor256 7 file.delete(); if (!file.delete()) { throw new Exception( “failed to delete file” ); }
  8. 8. /10@yegor256 8 User find(int id) { if (/* not found */) { return null; } // continue... } User find(int id) { if (/* not found */) { throw new Exception( “user not found” ); } // continue... }
  9. 9. /10@yegor256 9 fix report use deploy
  10. 10. /10@yegor256 10 www.yegor256.com

×