Skip to main content

Posts

Showing posts with the label Monolothic Architecture

Software Engineering Principles: DRY, KISS, and YAGNI

Software Engineering Principles: DRY, KISS, and YAGNI Software Engineering Principles: DRY, KISS, and YAGNI DRY (Don't Repeat Yourself) Principle: The DRY principle emphasizes the importance of reducing repetition within code. Repetition can lead to more errors, higher maintenance costs, and inconsistency. When the same piece of code or logic appears in multiple places, it should be abstracted out into a single location that can be reused. Example: Without DRY: public class Calculator { public int add(int a, int b) { return a + b; } public int subtract(int a, int b) { return a - b; } public int multiply(int a, int b) { return a * b; } public double divide(int a, int b) { return a / b; } public int addAndSubtract(int a, int b, int c) { return a + b - c; // repeated addition and subtraction logic } } With DRY: public class Ca...