A modularity concept for structuring and developing large logic programs and logical knowledge bases is presented. The concept is motivated from work in the field of algebraic specification, and enforces an extreme modularity discipline that goes beyond the one found in imperative or logic programming languages. As concrete programming languages (respectively knowledge representation formalisms), we consider Horn logic and equational logic programming. We give formal semantics for single modules and discuss correctness and verification issues. Large systems are constructed as interconnections of single modules. We introduce the so-called module operations of composition, actualization, and union, and give results concerning compositionality of semantics and correctness preservation.