title: When to use assert in client & common GWT code
body: <p>There are several questions on StackOverflow discussing the question of when one should use an assert statement versus throwing some exception.  (Examples <a href="https://stackoverflow.com/questions/4333371/when-to-use-assert-and-when-to-use-try-catch">here</a>, <a href="https://stackoverflow.com/questions/4537609/is-it-a-good-practice-to-use-assert-in-java">here</a>, <a href="https://stackoverflow.com/questions/368750/some-anti-patterns-on-using-assert-java-and-others">here</a>, <a href="https://stackoverflow.com/questions/3018683/what-does-assert-do">here</a>, and <a href="https://stackoverflow.com/questions/2759199/is-java-assert-broken">here</a>.</p>
  
  <p>However, I have come to suspect that the conventional wisdom of assert-versus-throw is based upon the assumption that you are running within a JVM.   In the GWT universe, where your Java gets transliterated to JavaScript and runs in the context of a browser, the set of tradeoffs feels different:   asserts are always compiled-away when running in a browser, and anything that keeps the size of your JavaScript smaller is a win, especially if you web application must run on a mobile handset.   Asserts do get run in DevMode, however, so they have utility there during development.</p>
  
  <p>So my questions are:  has anybody given any thought as to a set of best-practice rules that govern how to use the assert statement in GWT?   I have had members of my team ask me "since the assert gets compiled out, does it make sense to have them?", and I'd like to have a good answer  for them.</p>
  
  <p>Also, does anybody have any insight into the philosophy that the developers of GWT at Google have on this subject?   Looking at the GWT source code, they appear to use it frequently.</p>