[scribus-dev] 0012245: Grouped lines appear thicker
Craig Bradney
cbradney at scribus.info
Tue Nov 17 22:06:40 UTC 2015
> On 17 Nov 2015, at 23:02, ale rimoldi <ale.comp_06 at xox.ch> wrote:
>
> hey craig,
>
>
>> if you want to make functions all 10 lines long, there would be
>> hundreds of thousands of functions. Good luck with the function
>> calling slowdown and the horrible mess you introduce.
>>
>> Refactoring is more useful when you find common code that has been
>> repeated in some way, especially across classes. Refactoring just to
>> break up functions will often just make debugging and code paths very
>> complex.
>
> you did not really convince me, but i take it as is.
>
> btw, i did not say that all function should be 10 lines long. i only
> said that in my experience it's the ideal length.
> and i was thinking about the ideal length for making code
> understandable and so avoid bugs.
>
> in the case of DrawObj_Item() i think i would extract 3 or 4
> method from it, that means 30 to 40 lines per function.
> but i did not try to really understand what the semantic parts of
> that function are, so i cannot really tell.
>
> on the other side, if you think that the function should not be
> refactored, i'd like to know how you would like to change that function
> to make it understandable to the reader.
>
> doxygen comments before before the signature? comments in the function
> itself?
>
> or it is your opinion that it's clear what DrawObj_Item() does?
All of the code in the function is configuring the painter for the drawing of the object so its hard to break it up and not just lose speed.
There are distinct groups of code in the function… I would add a 1 line comment prior to each section within the function and perhaps one for the signature if still required.
Craig
More information about the scribus-dev
mailing list