Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are many approaches here and it depends on how exactly you interact with your code.</p> <p>Some things to keep in mind:</p> <p><strong>1) If the code is unwieldy, a refactoring is probably overdue.</strong></p> <p>Consider breaking your class into smaller classes each dealing with different aspects of what the big class does. Split functionality in multiple namespaces if you use static functions rather than classes.</p> <p>Consider splitting functionality over multiple files (one-class-per-file for example) and having a build process that combines and minifies your output.</p> <p><strong>2) Tools can help.</strong></p> <p>If you deal with large codebases it's probably a good idea to find an editor (or learn to use its functions better) that can help you deal with it. Your IDE will probably have some functionality to help you navigate the file structure better, like a file structure overview, or code regions, or objects view</p> <p><strong>3) Organize functions by what makes sense.</strong></p> <p>An alphabetic solution could make sense in some situations, but grouping by functionality is probably better. Putting exported methods all in one place is probably a good idea as well:</p> <pre><code>Namespace = function() { var f1 = function() { }; var f2 = function() { }; // this is internal // Exported methods return { f1 : f1 } }(); </code></pre> <p><strong>4) Document your code.</strong></p> <p>While reading the code is invaluable in giving someone an in-depth understanding, code ducmentation is essential in having a first-glance understanding. It can also be useful to you during development because you don't have to remember all the quirks of your code.</p> <p><strong>5) Enforce a coding style that can help you.</strong></p> <p>Your coding style can help you find things in the code easier. If you always use the same spacing, put braces the same way, etc, finding a function definition can be as easy as <code>Ctrl-f: myFunc:</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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