책의 예시들을 typescript로 작성하였습니다. 의미가 안 맞을 수 있지만 최대한 비슷한 느낌으로 작성하려 노력했습니다🥺
let a: number;
let b: string;
...
console.log(`User Requested ${b}. count = ${a}`);
/* console output */
// User Requested book. count = 3
let itemCount: number;
let itemName: string;
...
console.log(`User Requested ${b}. count = ${a}`);
/* console output */
// User Requested book. count = 3
i,j,k
사용하지 않기i,j,k
대신 맥락에 맞는 이름 사용row, col
/ width, height
/ row, col, depth
/* 💩 */
let nameString: string // name
let itemPriceAmount: number // itemPrice
let accountArray: Account[] // accounts
interface IShapeFactory // ShapeFactory
/* 🤔 */
class ShapeFactoryImpl // CircleFactory -> interface로 어떤 걸 구현할지 작성하는 쪽이 더 좋음
UpperCammelCase
(대문자로 시작)// 클래스는 명사, 명사구
class Character
class ImmutableList
// 인터페이스는 명사, 명사구, (형용사)
interface List
interface Readable
lowerCammelCase
(소문자로 시작)// 메서드는 동사, 동사구
sendMessage() {}
stop() {}