Link Details

Link 59619 thumbnail
User 111696 avatar

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.
  • 12
  • 2
  • 1195
  • 610

Comments

Add your comment
User 236137 avatar

dzonelurker replied ago:

0 votes Vote down Vote up Reply

Reason Number One: void
Reason Number Two: partly wrong, partly poorly explained.

User 211189 avatar

rasman replied ago:

0 votes Vote down Vote up Reply

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?

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (12)



Voters Against This Link (2)