Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > inheriting from std::vector bad practice?

Reply
Thread Tools

inheriting from std::vector bad practice?

 
 
Alf P. Steinbach
Guest
Posts: n/a
 
      04-08-2010
* Leigh Johnston:
>
>
> "Alf P. Steinbach" <(E-Mail Removed)> wrote in message
> news:hpkeg5$7r5$(E-Mail Removed)-september.org...
>
>>> perhaps you you could explain *why* it is bad.

>>
>> It has been explained in detail by several posters in this thread
>> (including contributions from me).
>>

>
> Deriving from a container might be bad for *certain* cases but not for
> *all* cases. Derivation is a tool which comes with caveats like most
> tools. Interface augmentation is not bad and I have given two perfectly
> valid examples of it.


True.

I was talking about the OP's actual case and his explanation of it, not the
misleading title that he put on the thread (what he imagined could be bad).


Cheers,

- Alf
 
Reply With Quote
 
 
 
 
Nick Keighley
Guest
Posts: n/a
 
      04-08-2010
On 8 Apr, 12:24, "Alf P. Steinbach" <(E-Mail Removed)> wrote:
> * Nick Keighley:
> > On 8 Apr, 11:11, "Alf P. Steinbach" <(E-Mail Removed)> wrote:
> >> * Nick Keighley:
> >>> On 3 Apr, 17:16, "Alf P. Steinbach" <(E-Mail Removed)> wrote:
> >>>> * Leigh Johnston:
> >>>>> "Alf P. Steinbach" <(E-Mail Removed)> wrote in message
> >>>>>news:hp7p5m$6rb$(E-Mail Removed)-september.org...
> >>>>>> * Leigh Johnston:
> >>>>>>> * Alf P. Steinbach:
> >>>>>>>> * Leigh Johnston:



> >>>>>>>>> The only time it is unwise to use public inheritance is if your
> >>>>>>>>> class invariant consists of more than just vector's invariant in
> >>>>>>>>> which case it might be possible to break your class's invariant by
> >>>>>>>>> calling the vector's member functions, but I don't believe this is
> >>>>>>>>> the case in your example (i.e. you are simply performing interface
> >>>>>>>>> augmentation).

>
> >>>>>>>> Sorry, that's bullshit. Proper design involves much more.

>
> >>> didn't you start being rude first?

>
> >> Depends on your definition of "rude", but who cares. I was precise.

>
> > must be a cultural thing. Where I'm from its rude. I'm not saying I
> > wouldn't use it but I'd use it knowing I was being rude. It seems odd
> > to me to tell someone they are bullshitting and then complain of
> > rudeness when they say you are full of ****!

>
> I said a statement was bullshit, and it was.
>
> You're saying I said someone is bullshitting.


it seems an overly fine distinction to me. It was a person that made
the statement.


> That is at best misleading, since
> it is a statement about a person. But considering what you're writing below,
> which is a pure personal attack, I think you intended also the above as such.
>
> In other words, you're trolling.


as I said there seems to be some sort of culture thing here. Rudeness
only seems to be allowed in one direction.

<snip>

> >>>>>>>> It's
> >>>>>>>> possible to disagree over what constitutes a good design and whether
> >>>>>>>> something constitutes good design, but in this case it's about the
> >>>>>>>> opposite, a technique that's almost universally recognized as
> >>>>>>>> Bad(TM), so, no discussion.

>
> >>> could you expand on that for the benefit of those of use who are not
> >>> quite so wise in C++ design principles?

>
> >> Huh. Benefits of a bad technique?

>
> > no benefits of explanation (are we speaking the same language?)

>
> > perhaps you you could explain *why* it is bad.

>
> It has been explained in detail by several posters in this thread (including
> contributions from me).
>
> If that's not good enough for you, then pick up any good book on design.
>
> > Or are we just supposed to accept your god-like authority?

>
> OK, "we" => you're schizoid or have grand delusions of being royal,


or I think other people in a similar position to me might have a
similar opinion. So people who don't agree with you are bullshitters,
trolls, schizoid and have delusions. Gosh I'd hate to come across you
when you being intentionally rude!


> "your
> god-like authority" => you're a troll, and a pretty stupid one to try to make
> that argument in this group.


you just came across as "this is bad design because I say so". I
(politely asked for a longer explanation (isn't this news group for
discussions about C++/OOD?)) and got my head bitten off. I'm guessing
you and the other guy have some sort of history which I stepped into
the cross-fire of.

HAND
 
Reply With Quote
 
 
 
 
Alf P. Steinbach
Guest
Posts: n/a
 
      04-08-2010
* Nick Keighley:
> trolling


plink

- Alf
 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      04-08-2010
On Apr 8, 12:08 pm, Nick Keighley <(E-Mail Removed)>
wrote:
> On 8 Apr, 11:11, "Alf P. Steinbach" <(E-Mail Removed)> wrote:


[...]
> > Depends on your definition of "rude", but who cares. I was precise.


> must be a cultural thing. Where I'm from its rude. I'm not
> saying I wouldn't use it but I'd use it knowing I was being
> rude. It seems odd to me to tell someone they are bullshitting
> and then complain of rudeness when they say you are full of
> ****!


Even within a given culture, rude is relative. There's a
differnce, for example, between saying that a given statement is
bullshit (attacking the statement) and saying that a given
person is full of **** (attacking the person). As for the word
"bullshit" itself, whether it's rude probably depends on the
environment where it is used: words that are perfectly
acceptable between the boys down at the pub might be considered
rude when used in an employee evaluation, for example.

FWIW: the tone in newgroups is a lot closer to that of the pub
than it is to a formal reunion. I'll use words and expressions
here that I won't necessarily use in other contexts.

--
James Kanze
 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      04-08-2010
On Apr 7, 4:56 pm, Stuart Golodetz <(E-Mail Removed)> wrote:
> On 06/04/2010 22:55, James Kanze wrote:


[...]
> > Just for the record, in Java, you can declare a function
> > final, and it can't be overridden. In well written Java,
> > most functions are declared final.


> I guess it depends on your definition of "well written Java",


Certainly. When you get down to it, I'd guess that well written
Java is even rarer than well written C++. (And of course, the
real question is: how well written is well written?. For my
statement to be true, you do have to set the standards very,
very high.)

> but --
> really? A cursory glance I just did through the docs for a number of
> classes in the Java standard libraries (which I'm assuming can at least
> to some extent be considered well written Java) didn't turn up any final
> methods at all. From what I remember from when I was using Java more
> frequently (roughly 3 years ago now), it was quite rare to want to make
> methods or classes final. Have I been missing out on received wisdom
> somewhere along the line?


In the Java libraries, you'll find classes final more often than
methods. I suspect that this is partially due to Java's broken
access qualifiers, but in practice, I can remember more than a
few times having problems with classes that should have had
final methods, or have been final, but didn't or won't.
(java.awt.Dimension comes immediately to mind---in general, any
class which represents a concrete value should probably be
final and immutable.)

--
James Kanze
 
Reply With Quote
 
Nick Keighley
Guest
Posts: n/a
 
      04-13-2010
On 8 Apr, 11:52, "Alf P. Steinbach" <(E-Mail Removed)> wrote:
> * Kai-Uwe Bux:
>
>
>
>
>
> > Alf P. Steinbach wrote:

>
> >> * NickKeighley:
> >>> On 3 Apr, 17:16, "Alf P. Steinbach" <(E-Mail Removed)> wrote:
> >>>> * Leigh Johnston:
> >>>>> "Alf P. Steinbach" <(E-Mail Removed)> wrote in message
> >>>>>news:hp7p5m$6rb$(E-Mail Removed)-september.org...
> >>>>>> * Leigh Johnston:
> >>>>>>> * Alf P. Steinbach:
> >>>>>>>> * Leigh Johnston:

> > [...]
> >>>>> and Bjarne Stroustrup agrees.
> >>>> This is just an appeal to authority.
> >>> I've never quite understood why it is wrong to quote people that might
> >>> know something about a subject
> >> See <url:
> >>http://www.nizkor.org/features/fallacies/appeal-to-authority.html>.



> > I love the irony of citing an authority on the appeal to authority fallacy.
> > That's just a great display of wit.





> Sorry, it was unintentional humor. It's just a reference with the requested
> information.


I wasn't requesting information, I was doubting it was a fallacy in
this case.


> > BTW: from the top of that page:

>
> > * Description of Appeal to Authority

>
> > * An Appeal to Authority is a fallacy with the following form:

>
> > * *1. Person A is (claimed to be) an authority on subject S.
> > * *2. Person A makes claim C about subject S.
> > * *3. Therefore, C is true.

>
> > * This fallacy is committed when the person in question is not a legitimate *
> > * authority on the subject. More formally, if person A is not qualified to
> > * make reliable claims in subject S, then the argument will be fallacious.

>
> > So, according to that, calling an appeal to authority fallacious is to
> > question whether the person is a legitimate authority on the subject.

>
> No, you have to read on, or see the Wikipedia article.
>
> However I think you're right that the argument wasn't the fallacy that's known
> as "appeal to authority" (as I wrote that it was), although it was literally
> appealing to authority.
>
> It was more like a combination of stating that situation A is an unrelated but
> in some respects similar situation B, and that a generalized and misleading
> paraphrase of authority X's comments about a situation C similar to B, applies
> to A *-- *anyone who cares who to identify all the fallacies involved has my
> respect as fallacy-hunter.
>
> Cheers & hth.,
>
> - Alf (evidently not an authority on fallacies, names of)-





 
Reply With Quote
 
Nick Keighley
Guest
Posts: n/a
 
      04-13-2010
On 8 Apr, 12:49, "Alf P. Steinbach" <(E-Mail Removed)> wrote:
> * NickKeighley:
>
> > trolling

>
> plink


can't recall the last time this happened
and I thought clc was rough...

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
integer >= 1 == True and integer.0 == False is bad, bad, bad!!! rantingrick Python 44 07-13-2010 06:33 PM
Bad media, bad files or bad Nero? John Computer Information 23 01-08-2008 09:17 PM
ActiveX apologetic Larry Seltzer... "Sun paid for malicious ActiveX code, and Firefox is bad, bad bad baad. please use ActiveX, it's secure and nice!" (ok, the last part is irony on my part) fernando.cassia@gmail.com Java 0 04-16-2005 10:05 PM
24 Season 3 Bad Bad Bad (Spoiler) nospam@nospam.com DVD Video 12 02-23-2005 03:28 AM
24 Season 3 Bad Bad Bad (Spoiler) nospam@nospam.com DVD Video 0 02-19-2005 01:10 AM



Advertisments