Daily Archives: April 17, 2017


Java Design Philosophy

Writing a Library Exception Always throw exception as early as possible. // DO class Animal{ static final String name; static { name = LoadNameFromDisk() if (name == null) { throw IllegalStateException(“Can not read name from disk”); // Throw exception here } } public Animal(){} } // DON’T class Animal{ static […]