Skip to content
Sebastian Schlicht edited this page Aug 26, 2013 · 1 revision

This design guide is a summary of a Google Tech Talk from Joshua Bloch (2007)

http://www.youtube.com/watch?v=heh4OeB9A-c

Design process

  1. collect requirements
  2. create short specification (~1 page)
  • gain feedback from as many stakeholders as possible
  • improve your page until it matches the requirements
  1. select a short name explaining the functionality
  2. create an early draft (e.g. Java interface)
  3. create example code
  4. create production code

Keep in mind:

  • use consitent names that are self-explanatory
  • you can add parameters whenever you want but you can not remove one ("When in doubt, leaave it out")
  • document everything (classes, interfaces, methods, fields)
  • reuse your interfaces
  • only constants are allowed to be public fields

Methods

  • name must match the most important functionality
  • favor interfaces and the most specific types possible as arguments
  • use consistent argument ordering
  • 1-3 arguments ideally (otherwise split/use a builder)
Clone this wiki locally