Software EngineeringLow Level Design
Aug 20, 20261 min readKISS Principle
They are guidelines that help software developers create system that are easy to understand, maintain, and extend. They are applied both at high-level and low-level design stages.
KISS: Keep It Simple Stupid
It states that a design should be kept as simple as possible. Complexity should only be introduced when absolutely necessary.
Importance
- Easier Debugging
- Improved Readability
- Better Maintainability
- Faster Development
Example
Bad Code
java.terminal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import java.util.*;public class NumberUtils { public static boolean isEven(int number){ // Using unncessary logic boolean isEven = false; if(number % 2 == 0){ isEven = true; } else { isEven = false; } return isEven; }}➜~java
UTF-815 lines● ready
In the above code, we have a lot of extra variables, unnecessary if-else logic and hence makes it longer and hard to follow
Refactored Good Code
java.terminal
1
2
3
4
5
6
7
8
import java.util.*;public class NumberUtils { public static boolean isEven(int number){ return number %2 === 0; }}➜~java
UTF-88 lines● ready
In refactored code, we gave a one liner solution, easy to understand and follows KISS principle by avoiding overengineering.