본문 바로가기

프로그래밍

KISS

반응형

KISS 은(는) Keep It Short and Simple 의 축약어로,

불필요한 복잡성을 추가하지 않을 것을 권장하는 개발의 기본 원칙이에요.

Bad

final class Program
{
	public static void main(String[] args)
	{
		var A = true;
		var B = false;

		if (!!A)
		{
			System.out.println("A is true");
		}
		if ((!A && B)) // De Morgan's laws
		{
			System.out.println("either A or B is true");
		}
	}
}

Good

final class Program
{
	public static void main(String[] args)
	{
		var A = true;
		var B = false;

		if (A)
		{
			System.out.println("A is true");
		}
		if (A || B)
		{
			System.out.println("either A or B is true");
		}
	}
}
반응형

'프로그래밍' 카테고리의 다른 글

Naming Convension  (0) 2024.04.14
Code Style  (0) 2024.04.13
SOLID  (0) 2024.04.12
YAGNI  (0) 2024.04.11
DRY  (3) 2024.04.09