gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMenuView patch


From: Quentin Mathé
Subject: Re: NSMenuView patch
Date: Mon, 21 Feb 2011 16:13:35 +0100

Hi Christopher,

Le 20 févr. 2011 à 01:39, Christopher Armstrong a écrit :

> I agree this method is very fragile and has a ridiculously high cyclomatic 
> complexity, but I'm struggling to work out how to simplify it.
> 
> If you split it up so that we have an implementation for each menu style, we 
> won't get much code reduction. Each menu style uses most of the code in that 
> method, so that there will be little difference between them. We'd also get 
> alot of duplicated code which will be even more complicated to maintain 
> (three divergent implementations of the same method).
> 
> We could also consider splitting each of the if..then sections into separate 
> methods, but I think that might end up hiding some of the complexity of the 
> method, especially where it re-enters itself through other menu views. There 
> is also alot of variables to pass along for the calculations.

I think it's worth to try splitting into several small methods, even if some 
methods have to be merged back in the end. Just to figure out more easily how 
the code should be restructured/rewritten.

On another hand, if every minor changes to this event handling code can easily 
break the behavior (for a precise interface style and backend but not the 
others), it could be easier to rewrite this code almost from scratch to get it 
as simple as possible, then test it extensively. That's what I thought the last 
time I looked at this code to correct various subtle horizontal menu usability 
issues.

Cheers,
Quentin.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]