Refactoring away from Feature envy in QueryHits::readPayload? ;-)

Dear all

        QueryHits::readPayload seems to be more interested in struct private..

Instead of pulling out the innards of private and filling them, we can push the stream to private…

void QueryHits::readPayload (QDataStream &stream)

{

          stream >> p; // p knows its members

          readQueryHitsData (stream);
          p.readServentId( stream ); // if Id could be arranged to come before, stream >> p would take care of this…
}

  The  default ctor, QueryHits::QueryHits (), also suffers from being Feature Envy

Why not give a default ctor to private?

I think private begs to be a full blown class ;-) rather than a POD ;-)
 

Would you like to post a relpy?


This post starts a thread.
Follow-ups:
Re: Refactoring away from Feature envy in QueryHits::readPayload? ;-)
Well, I would say that QueryHitsPrivate is a POD by design. Although it is a class, it is used like a struct and maybe should better be declared as one! (more...)