Design and analysis of numerical methods for free- and moving-boundary problems