We show that questions concerning the topological B-model on a Calabi-Yau manifold in the Landau-Ginzburg phase can be rephrased in the language of commutative algebra. This yields interesting and very practical methods for analyzing the model. We demonstrate how the relevant "Ext" groups and superpotentials can be computed efficiently by computer algebra packages such as Macaulay. This picture leads us to conjecture a general description of D-branes in linear sigma models in terms of triangulated categories. Each phase of the linear sigma model is associated with a different presentation of the category of D-branes.