Vertical Separation

Functions/variables spread far away from where they are used makes the code confusing and cumbersome to read.

void myFunc() {
    func1();
    func2();

    statementA;
    statementB;
}
void otherFunc() {
    statementC;
    statementD;
    ...
}
void yetAnotherFunc() {
    statementE;
    statementF;
    ...
}
void func1() {
    ...
    ...
}
void func2() {
    ...
    ...
}

Should reorder func1 and func2 closer to myfunc

void myFunc() {
    func1();
    func2();

    statementA;
    statementB;
}
void func1() {
    ...
    ...
}
void func2() {
    ...
    ...
}
void otherFunc() {
    statementC;
    statementD;
    ...
}
void yetAnotherFunc() {
    statementE;
    statementF;
    ...
}



bj 2019-09-22