Follow treslines by email clicking Here!

Friday, December 9, 2011

Whats your code style? isBigger contest!

Whats your code style? isBigger(...) contest!


Hi there! In this blog i want to see and learn from you. Post a), b), c) and so to show us how you code and why. Share your expirience with us. You may type/post your own solution if it isn't here. The goal of this post is to figure out the best code snippet to solve a specific, concrete problem as clean as you can and to share it with the world. 

The Task

Tell us how you would resolve spontaneously following current task:
how would you write a method that checks if one value is greater than the other? 

Solution A)

boolean isBigger( int a, int b){  boolean result=false;  if(a>b){   result=true; } return result; }

Solution B)

boolean isBigger( int a, int b){ 
  return true;
return false;

Solution C)

boolean isBigger( int a, int b){ 
 return a>b? true: false;

Solution D)

boolean isBigger( int a, int b){ 
 return a>b;

Solution E)

boolean isBigger( int a, int b){ 
 return Integer.valueOf(a).compareTo(Integer.valueOf(b)) <0;

Solution F)

interface compare<T>{
 boolean isBigger(T a, T b);

Solution G)

<T> boolean isBigger( T a, T b){ 
 return a > b;

Solution H)

boolean isLeftValueBiggerThanRightValue ( int leftValue, int rightValue){ 
  return leftValue > rightValue && leftValue != rightValue;

Solution I)

<T> boolean isBigger( T value1, T value2){ 
 final int equal = 0;
 return T.valueOf(value1).compareTo(T.valueOf(value2)) > equal;

Solution J)

you may post your own solution... Post you comment at the end of this blog!

How can i motivate other developers ?

Well i do that by talking about, i wear my t-shirt, i wear my bracelets with the CCD (Clean Code Developer Initials and colors) and i use my brand new treslines bag. It feels fantastic and even on the train people start talking to me asking about it. It is also a great idea to motivate agile teams and to share your expirience. You may want a great gift to show your appreciation to your team. Surprise them with a gadget from I love it.

Other interesting blogs

How could we improve the quality of this article ?

If the content of this article does not help you, so please tell us how to improve the quality of it by giving your contructive feedbacks at the end of this blog. If it was useful to you giving and resuming to you the most important aspects of the subject treated, saving you a lot of time, then help us to maintain this blog with a little appreciation. With a small amount of your choice you help us to cover the prime costs like:
Hosting, autors’s research work, editorial work, blog quality, motivation to make things better than others resulting in a very useful information pool for you and a lot of other developers. Important : If you do not have the possibility to donate a little amount, than recommend this page to your friends. Thanks !

Source code convention tools

Literature, good books and references

How can i subscribe/feed this blog ?

Subscribe : click on the link at the end of this blog

Want to stay up to date ?

How can i rate this blog ?

Press google+1 once !

Where do i find more clean code knowledge and gadgets?



  1. spontanneously solution A)

  2. public static final < T extends Comparable< T > > boolean isLeftBiggerRight( T left , T right ) {
    final int equal = 0;
    return left.compareTo( right ) > equal;

  3. spontanneously solution D