[Geany-devel] Short function factoring

Lex Trotman elextr at xxxxx
Tue Nov 8 21:21:00 UTC 2011

On Wed, Nov 9, 2011 at 3:40 AM, Nick Treleaven
<nick.treleaven at btinternet.com> wrote:
> On 04/11/2011 00:21, Lex Trotman wrote:
>> Geany has many places where a short function then calls
>> another short function which calls another short function, none of
>> which are re-used.  Personally I find this way of writing code less
>> efficient and very hard to follow and understand as a whole, but
>> others find it easier to think only in terms of each little piece.
> Here may be somewhere where we disagree fundamentally, because:

Probably :)

> * long functions cause bugs

Rubbish, wrong functions cause bugs no matter how long, and being
unable to see the whole logic leads to wrong design.

> * too many variables in one place cause bugs

Thats what declarations in inner blocks are for :)

> I'm sure there are statisics to back this up, it's well known in code
> analysis/reliability circles.

And there are also statistics that say the opposite, that breaking it
up too far over complicates things and causes unreliability.

> Breaking up logical tasks into functions is crucial to writing maintainable
> code, functions *are not just about code reuse*.

Yes, the key word here is *logical*, too big is bad and too small is
bad, but what is too big and what is too small depends on the person
and what the code is doing.  It isn't a one size fits all.

I just noted that for me parts of Geany err on the too small side.

I guess we won't ever all agree on this, so we all have to be tolerant.


> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

More information about the Devel mailing list