Code at Wrong Level of Abstraction

Higher level concepts should be separated from lower level concepts. This applies to classes, source files, modules, etc.

public interface Stack {
    Object pop() throws EmptyException;
    void push(Object o) throws FullException;
    double percentFull();
    class EmptyException extends Exception{}
    class FullException extends Exception{}

percentFull() is a higher level concept than the push-pop implementation of a regular stack, which may not have a concept of 'full' (a regular stack has a dynamic size).

bj 2019-09-22