CodeSOD: Self Improvement in Stages

This post was originally published on this site

The Daily WTF

Jake has a co-worker named “Eddie”. Eddie is the kind of person who is always hoping to change and get better. They’re gonna start eating healthier… after the holidays. They’re gonna start doing test driven development… on the next project. They’ll stop just copying and pasting code… someday.

At least, that’s what we can get from this blob of code.

//TODO make this recursive, copy paste works for now though if (website_description != null) { if (website_description.length() > 25) { int i = website_description.indexOf(” “, 20); if (i != -1) { String firstsplit = website_description.substring(0, i); String secondsplit = website_description.substring(i); websiteWrapped = firstsplit + “<br/>” + secondsplit; if (secondsplit.length() > 25){ int split_two = secondsplit.indexOf(” “, 20); String part1 = secondsplit.substring(0, split_two); String part2 = secondsplit.substring(split_two); websiteWrapped = firstsplit + “<br/>” + part1 + “<br/>” + part2; if (part2.length() > 25){ int split_three = part2.indexOf(” “, 20); String part3 =

To read the full article click on the 'post' link at the top.