본문 바로가기

Basic9

디자인 패턴 사이트 모음 하나하나씩 공부해보자. https://refactoring.guru/design-patterns/what-is-pattern What’s a design pattern? What’s a design pattern? Design patterns are typical solutions to commonly occurring problems in software design. They are like pre-made blueprints that you can customize to solve a recurring design problem in your code. You can’t just find a pattern a refactoring.guru https://sourcemaking.com/design_p.. 2021. 8. 4.
다트 게임 알고리즘도 풀어보자. https://programmers.co.kr/learn/courses/30/lessons/17682?language=javascript 코딩테스트 연습 - [1차] 다트 게임 programmers.co.kr const bonusType = { S: (x)=>x, D: (x)=>Math.pow(x, 2), T: (x)=>Math.pow(x, 3), } const pointType = { '*': 2, '#': -1 } function solution(dartResult) { const scores = dartResult.split(/\D/).filter((score) => score !== ""); const bonus = dartResult.split(/\d/).filter((x).. 2021. 8. 4.
Single Source of Truth 정보의 중복, 비정합성 등의 문제를 해결하고자 나온 이론. 아래 예시를 보자. 홈페이지를 만든다. About 페이지에서 네비게이션 기능이 필요해서 만들었다. Category 페이지에 네비게이션 기능이 없어서 About 페이지에 있는 네비게이션 소스를 복사 붙여넣기 했다. 위의 예시는 Single Source of Truth를 위배된다. 네비게이션 소스 코드의 중복이 발생 했기 때문이다. 만약, 네비게이션에 기능이 추가가 된다고하면, About과 Category 페이지에 있는 네비게이션 소스를 모두 수정해야한다. 홈페이지를 만든다. About 페이지에서 네비게이션 기능이 필요해서 만들었다. 또한, 이후 재사용성을 고려해 네비게이션 코드를 모듈로 만들었다. Category 페이지에 네비게이션 기능이 없어서 .. 2021. 8. 3.