Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing table-of-contents in code?
    text
    copied!<p>Do you use table-of-contents for listing all the functions (and maybe variables) of a class in the beginning of big source code file? I know that alternative to that kind of listing would be to split up big files into smaller classes/files, so that their class declaration would be self-explanatory enough.. but some complex tasks require a lot of code. I'm not sure is it really worth it spending your time subdividing implementation into multiple of files? Or is it ok to create an index-listing additionally to the class/interface declaration?</p> <p><strong><em>EDIT:</em></strong></p> <p>To better illustrate how I use table-of-contents this is an example from my hobby project. It's actually not listing functions, but code blocks inside a function.. but you can probably get the idea anyway..</p> <pre><code>/* CONTENTS Order_mouse_from_to_points Lines_intersecting_with_upper_point Lines_intersecting_with_both_points Lines_not_intersecting Lines_intersecting_bottom_points Update_intersection_range_indices Rough_method Normal_method First_selected_item Last_selected_item Other_selected_item */ void SelectionManager::FindSelection() { // Order_mouse_from_to_points ... // Lines_intersecting_with_upper_point ... // Lines_intersecting_with_both_points ... // Lines_not_intersecting ... // Lines_intersecting_bottom_points ... // Update_intersection_range_indices for(...) { // Rough_method .... // Normal_method if(...) { // First_selected_item ... // Last_selected_item ... // Other_selected_item ... } } } </code></pre> <p>Notice that index-items don't have spaces. Because of this I can click on one them and press F4 to jump to the item-usage, and F2 to jump back (simple visual studio find-next/prevous-shortcuts).</p> <p><strong><em>EDIT:</em></strong></p> <p>Another alternative solution to this indexing is using collapsed c# regions. You can configure visual studio to show only region names and hide all the code. Of course keyboard support for that source code navigation is pretty cumbersome...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload