Take the 2-minute tour ×
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It's 100% free, no registration required.

How would you call the process of expanding/collapsing in one word?

I need to name a Method (in programming) which will make a group collapse or expand based on it's current state (collapsed or expanded).

share|improve this question

closed as off topic by FumbleFingers, kiamlaluno, waiwai933 Jun 19 '12 at 17:27

Questions on English Language & Usage Stack Exchange are expected to relate to English language and usage within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
void swapCollapsedState(){ collapsed = !collapsed }; ? –  James Webster Jun 19 '12 at 13:08
    
the problem is that you say swapCollapsed but you might as well say swapExpanded, probably will go for toggleCollapse –  Omu Jun 19 '12 at 13:22
    
With no inherent advantage or disadvantage. Here, the swap is the important part of the name. Write both methods! –  James Webster Jun 19 '12 at 13:23
    
I think this is Too Localised, but FWIW I suggest that expand is the more "central" concept, so OP's function should probably be called ToggleExpandedState. Personally I prefer toggle where a single variable (or state) is being switched between two possible values. To me, swap is more suitable where the values of two variables are transposed. –  FumbleFingers Jun 19 '12 at 13:56
    
The question is off-topic, as the faq says not to ask questions where the topic is, "Naming, including naming programming variables/classes." –  kiamlaluno Jun 19 '12 at 15:35

1 Answer 1

up vote 2 down vote accepted

I would go for toggle(), or better still toggleState().

share|improve this answer
1  
toggle_tree_state() or toggle_node_state() to give context. Also, I thoroughly detest camelcase. –  shinyspoongod Jun 19 '12 at 14:35
    
+1 for a more descriptive naming convention. As for camelcase... why? It makes paragraphs easier to read (compare my_first_variable=my_second_variable-my_third_variable; with: myFirstVariable=mySecondVariable-myThirdVariable; ) and most importantly it's faster to type. –  Nieszka Jun 19 '12 at 15:00
    
I'll agree that typing is much easier than with a boatload of underscores, but legibility is poorer than if underscores are used. It's really too laterally condensed. Besides, most decent editors have code completion, if that's such an issue. –  shinyspoongod Jun 19 '12 at 15:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.