Last active
October 9, 2016 13:00
-
-
Save yonatanm/6287167 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Challenge { | |
private static final Logger log = LoggerFactory.getLogger(Challenge.class); | |
private void doSomething(Collection<String> words) { | |
log.debug("doing work on " + Joiner.on(";").join(words)); | |
doWork(words); | |
} | |
// | |
private void doSomething_naiveSolution(Collection<String> words) { | |
if (log.isDebugEnabled()) { | |
log.debug("doing work on " + Joiner.on(";").join(words)); | |
} | |
doWork(words); | |
} | |
private void doWork(Collection<String> words) { | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can you tweak the code so joiner will be invoked only when needed (as most of the time logger level is Info) ?
I'm looking for something like the doSomething_naiveSolution, but a cleaner one.
Do you find this position http://thoughtstostring.wordpress.com/2013/06/02/looking-for-an-outstanding-software-engineer/ interesting ? Can you solve this challenge ? contact me via twitter https://twitter.com/yonatanm or drop your CV via mail - yonatan [at] outbrain [dot] com.
Good luck