A great variety of algebraic problems can be solved using Groebner bases, and computational commutative algebra is the branch of mathematics that focuses mainly on such problems. In this thesis we employ Buchberger's algorithm for finding Groebner bases by tailoring specialized instances of Buchberger's algorithm via code generation. We introduce a framework for meta programming and code generation in the F# programming language that removes the abstraction overhead of generic programs and produces type-safe and syntactically valid specialized instances of generic programs. Then, we discuss the concept of modularizing and decomposing the architecture of software products through a multistage design process and define what specialization of software means in the context of producing special instances. We provide a domain-specific language for the design of flexible, customizable, multistage programs. Finally, we utilize the aforementioned techniques and framework to produce a highly parametrized, abstract and generative program that finds Groebner bases based on Buchberger's original algorithm, which, given all the proper definitions and features of a specific problem in computational algebra, produces a specialized instance of a solver for this problem that can be shown to be correct and perform within the desired time complexity.