Skip to main content

Posts

Showing posts from February, 2015

DCEVM - A JRebel free alternative

Dynamic Code Evolution VM http://ssw.jku.at/dcevm/binaries/ source: http://javainformed.blogspot.ca/2014/01/jrebel-free-alternative.html DCEVM - A JRebel free alternative Those of you who work with web application development on a daily basis know very well that reloading is annoying. With Tomcat and Eclipse for example, when you make just a small change in your Java class, it still takes at least a few seconds for the change to be reflected because the whole web app will need to be reloaded. This is because class hot-swapping in the JVM is severely limited. Only method body changes can be hot-replaced. All other changes (method signature, class members, etc) will require reloading the whole application. If you work for a company that buys you a commercial hot-swap solution, like JRebel, you're lucky because usually they work out of the box and offer more functionalities. But if not, don't worry, there are free alternatives out there ( DCEVM ,  FakeReplace ,  Spri

When to use an assertion and when to use an exception

use exceptions when checking parameters passed to public or protected methods and constructors use exceptions when interacting with the user or when you expect the client code to recover from an exceptional situation use exceptions to address problems that might occur use assertions when checking pre-conditions, post-conditions and invariants of private/internal code use assertions to provide feedback to yourself or your developer team use assertions when checking for things that are very unlikely to happen otherwise it means that there is a serious flaw in your application use assertions to state things that you (supposedly) know to be true In other words, exceptions address the robustness of your application while assertions address its correctness. Assertions are designed to be cheap to write, you can use them almost everywhere and I'm using this rule of thumb: the more an assertion statement looks stupid, the more valuable it is and the more information it embeds. Wh