By bloid
via designdecisions.blogspot.com
Published: Jan 03 2008 / 15:04
LineNumberReader extends BufferedReader so LineNumberReader "is a" BufferedReader. This "is a" distinction is important in this discussion, because I spend a bit of time talking about BufferedReader. But because of the "is a" relationship (a.k.a inheritance), anything said about BufferedReader is also true of LineNumberReader.
Comments
dzonelurker replied ago:
Reason Number One: void
Reason Number Two: partly wrong, partly poorly explained.
rasman replied ago:
I could use a subclass of BufferedReader that counted the frequency of every character in the alphabet, but if I wasn't going to USE that information in my program, wouldn't I be better off and more efficient using the version of BufferedReader that didn't do all that extra work?
What kind of an argument is "you should always use the tool that does the most extra stuff"? If I ever cared about line numbers, I might use LineNumberReader instead of counting them myself, but if not, why?
Voters For This Link (12)
Voters Against This Link (2)