Computer scientists have always been jealous of mathematicians. Much of the strife in this ancient conflict is derived from the fact that math guys take large numbers for granted. Silicon can't handle arbitrarily large numbers as elegantly as paper and many computer languages realize that only really bad programmers would ever need numbers that need more than 32-bits.

But computer science is not about judgement. Thus, good programmers condescend to help out by writing BigInt[eger] packages, usually as part of an undergraduate "Intro[duction] to Data Structures" course. To show our gratitude for their hard work, the rest of us should make every effort to use their code whenever we can.

However, there are people that spit in the face BigInt and by doing so aid the paper-pushers in their needless War of Tensor. One of these traitors, Eric, recently mutilated otherwise excellent code for coloring alternate rows in HTML.

The victim:

  public String rowClass( int index )
  {
      String evenRow =
          (BigInteger.valueOf(index).mod(new BigInteger("2"))).toString();
      return ( (evenRow.equals("0")) ? "odd" : "even" );
  }

 

This innocent function became return ( ( index%2 == 0) ? "even" : "odd" ); We must ask ourselves: when will the needless slaughter of BigInteger end? We must stand firm.

On a happier note, at least they're not using JavaScript or XSLT to do the presentation. As far as I'm concerned, there is hope for any company that buries display logic deep in business logic.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!