Stupid programming II

I came across a segment of Java code like this during a code review:

String str = "" + 10;

Sometimes I really don’t know what’s in people head. Isn’t it a lot more simpler/clearer/better/faster to do it as:

String str = "10";

If it is up to me, we should banish people writing code like this to write single line of code again.

Advertisements

One thought on “Stupid programming II

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s