[Development] when to Extract Method (was Re: commas in ctor-init-lists)

Thiago Macieira thiago.macieira at intel.com
Fri Jun 3 14:57:49 CEST 2016


On sexta-feira, 3 de junho de 2016 12:50:08 BRT Edward Welbourne wrote:
> > To be perfectly blunt: such expressions shouldn't be
> > allowed. Period. Neither with nor without line breaks. Such monsters
> > should be subjected to Extract Method with extreme prejudice.
> 
> I'm fascinated - and we're now on a whole new topic - you mean this,
> even when the relevant combination of expressions is meaningless outside
> the one context in which it is used: an expression that combines three
> computed values with a binary operator is so complex it should be turned
> into a method ?  Even if the three conditions are unrelated ?

Another thing to be very, VERY careful is about nested function call chains, 
as in:

	if (foo(bar(), baz(quux()), variable, xyz()) == variable)

Can you tell me if bar, baz, quux, or xyz modify variable? If so, what is the 
call order?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list