Be Aware
Date weirdnesses
public class DateDemo{
public static java.sql.Date demoDate;
public static void main( String args[] ){
demoDate
= new java.sql.Date ( 99, 1, 31 );
System.out.println
( demoDate.toString() );
}
}
Data types: Java vs SQL vs PowerBuilder vs ...
Object Obsession Syndrome
Notes:
The java.sql.Date() constructor call instantiates a Date object using 99 for the year, 1 for the month and 31 for the day. The toString() call displays the date in a human-readable format yyyy-mm-dd; what value appears? (answer on the next slide). Conversion among SQL, Java and other language datatypes can cause confusion. Java often uses offsets 0, 1, 2 instead of counts 1, 2, 3 when referring to sequences of things. Beware obsession with object orientation; keep in mind that simplicity and maintainability are important goals.