This post originated from an RSS feed registered with Agile Buzz
by Keith Ray.
Original Post: Minimal versus "Humane" Class API Design
Feed Title: MemoRanda
Feed URL: http://homepage.mac.com/1/homepage404ErrorPage.html
Feed Description: Keith Ray's notes to be remembered on agile software development, project management, oo programming, and other topics.
You just know that because Java's List class doesn't have a "last" method, that everyone who needs to access the last element is going to have to write "alist.get( alist.size() - 1 ) WHICH IS DUPLICATED CODE. (And buggy as well, failing if the list is empty.)
Duplicated code is a sign of bad design, and leads to bugs. There's probably been a million bugs where someone coded alist.get( alist.size() ) attempting to get the last element (which will instead throw an exception), and no doubt less that 80% of those bugs have been fixed.
It wouldn't be so bad if Java programmers could extend existing classes (Like Cocoa programmers and Smalltalk programmers).