Re: [Cppunit-devel] CppUnit 1.8.0 features...
Brought to you by:
blep
From: Baptiste L. <gai...@fr...> - 2001-09-25 12:19:30
|
Quoting Volker Boerchers <boe...@we...>: > On Tue, 25 Sep 2001, Baptiste Lepilleur wrote: > > > Quoting Baptiste Lepilleur <bl...@cl...>: > > > > 7) remove consteness on ASSERT_EQUAL. > > I would actually call that one a bug fix. While const is usefull > when > > manipulating value object, it is a strong constraint. Personnaly, I > have taken > > Michael Feather's advice on XP and C++ and don't use const on > reference object > > (object who don't have public copy constructor). This make refactoring > a lot > > easier, but writing assertion_traits black magic :-(. > > Hi Baptiste, > > could you give me a reference on this subject, some online docs or so > - > This advice is new to me. This is part the extreme programming challenges: http://c2.com/cgi/wiki?ExtremeProgrammingChallenge and the more specifically the C++ challenge (the page you're interested in): http://c2.com/cgi/wiki?ExtremeProgrammingChallengeSeven The comment is very short, but my current working rules are: 1) avoid pass-by-value or non const reference, prefer pointer => allow polymorphism 2) prefer pass-by-value to const reference => don't need to had "const" method to object. 3) avoid to return const reference, prefer return by value => the former make it difficult to change the implementation 4) never use const method. => const is often more an hinderance that help when refactoring. I still don't realy know what to do about non const reference. I usually avoid them (so reference are only use as optimisation to pass-by-value), but it sometimes lead to clumsy code (pointer on std::vector)... I still haven't got around using the make everything virtual, but adding the virtuality when needed is not a problem. Part of those rules where inferred from Michael Feather's CppUnit. And we still haven't our refactoring catalog (we have multiple inheritance and template)... Baptiste. > > Thanks and > Thanks for your work on cppunit! > Volker > -- > Volker Boerchers, boe...@we... > > --- Baptiste Lepilleur <gai...@fr...> http://gaiacrtn.free.fr/index.html Language: English, French |