깊은바다거북
개발 공부 기록
깊은바다거북
전체 방문자
오늘
어제
  • 분류 전체보기 (219)
    • JAVA (9)
    • JavaScript (15)
    • 스파르타코딩클럽 (11)
      • [내일배움단] 웹개발 종합반 개발일지 (5)
      • [내일배움캠프] 프로젝트와 트러블 슈팅 (6)
    • SQL | NoSQL (4)
    • CS 등등 (0)
    • TIL | WIL (173)
    • 기타 에러 해결 (3)
    • 내 살 길 궁리 (4)

인기 글

최근 글

최근 댓글

태그

  • TypeScript
  • 자잘한 에러 해결
  • 최대 힙(Max Heap)
  • leetcode-cli
  • BST(이진 탐색 트리)
  • tree
  • 01. 미니 프로젝트
  • DFS(깊이우선탐색)
  • Linked List
  • Backtracking(백트래킹)
  • 최소 힙(Min Heap)
  • 혼자 공부하는 자바스크립트
  • 재귀 함수
  • BFS(너비우선탐색)
  • 팀 프로젝트
  • 점화식(Recurrence Relation)
  • 코딩테스트 연습문제
  • Inorder Traversal(중위 순회)
  • 자료 구조
  • POST / GET 요청
  • 트러블 슈팅 Troubleshooting
  • Preorder Traversal(전위 순회)
  • 시간 복잡도
  • Trie
  • Binary Tree(이진 트리)
  • TIT (Today I Troubleshot)
  • 프로그래머스
  • Til
  • 자바스크립트 기초 문법
  • Leetcode
hELLO · Designed By 정상우.
깊은바다거북

개발 공부 기록

TIL | WIL

2/16 목 (코드를 실컷 작성하니 단축키가 손에 붙는다) TIL

2023. 2. 16. 23:58

(막간 보충 공부중)

“TDD 또한 큰 도움이 된다. 실패한 테스트는 당시의 흐름을 유지한다. 방해가 사라진 후 실패한 테스트가 통과하도록 일하다 보면 흐름으로 돌아갈 수 있다.”

— 클린 코더 The Clean Coder, 로버트 마틴

느낀 점

오늘 저녁에 알고리즘 문제풀이 스터디 팀원들과 튜터님을 찾아갔다가 mob programming이라는 걸 경험했다. 한 문제를 한 메모장(에디터)에, 각 1분씩 돌아가며 구두로 프로그래밍을 이어가는 것이다. 관전인이 갑자기 많아져서 긴장되긴 했지만, 긴장되는 만큼 재미있었다. 내일 스터디에 도입해보기로 하였다. 당장 흥미로운 점은 크게 두 가지였다:

  1. 누가 시작을 하든 남이 그려놓은 청사진을 빠르게 이해하고 이어서 건물을 지어 올려야 한다.
  1. 손으로 쓰던 코드를 말로 읊어내야 한다.

오늘 한 일

  • https://www.youtube.com/playlist?list=PLFg4xVJCR77Tc4oo5hAL_XPsPnFqQ4k5R
  • 프로그래머스 Lv0 피자나누기 3
  • 프로그래머스 Lv 0 문자열 뒤집기
  • + 프로그래머스 Lv 0 옹알이 1
  • 저녁 8시에 튜터님께 찾아가 문제풀이

공부 자료 후보

(리액트 + 인수(Acceptance) TDD 테스트 ⇒ 할 일 프로그램을 인수테스트 하는데, 리액트랑 잠깐 공부해 볼 시간 있으면 봐도 좋을 것)

Test-Driven Development in JS with Acceptance Tests
🤔 This video explains why TDD is not about testing to find bugs, but instead is used to find the best technical solution. I'll discuss red-green-refactor and do live-coding to show how you can use TDD with Acceptance Tests. 🌱 Source code: https://github.com/branneman/tdd-example 0:00 Intro 0:57 Why TDD 6:48 The TDD loop 13:12 TDD with Acceptance Tests
https://www.youtube.com/watch?v=ym62X_gvMXs

(Mars Rover Kata와 중복 제거 리팩토링 시범)

Test-Driven Development (TDD) in JavaScript #4 - Duplication & The Rule Of Three
In this video, Jason Gorman illustrates how refactoring to remove duplication from our code can lead us to a better design, and demonstrates the Rule of Three that can guide us towards better abstractions and protect us from leaving refactoring too late. The example used is the Mars Rover Kata https://kata-log.rocks/mars-rover-kata
https://www.youtube.com/watch?v=dFemuNMjgr4


궁금증

  • 클래스에서 생성자로 this.value를 초기화해주지 않아도 메소드 안에서 바로 this.value를 활용(작성 및 참조)할 수 있는 이유?
    class Stack {
    
        constructor() {
            this._size = 0;
        }
    
        pop() {
            if (!this.toBePopped) {
                throw new Error('Stack underflow')
            }
            const result = this.toBePopped.item;
            this.toBePopped = this.toBePopped.nextToBePopped;
            this._size--;
            return result;
        }
    
        push(item) {
            this.toBePopped = {
                item,
                nextToBePopped: this.toBePopped,
            }
            this._size++;
        }
    
        peek() {
            if (!this.toBePopped) {
                throw new Error('Stack underflow')
            }
            return this.toBePopped.item;
        }
    
        size() {
            if (!this.toBePopped) {
                return 0;
            }
            return this._size;
        }
    
        isEmpty() {
            return this.size() === 0;
        }
    }
  • get peek(), get pop() 과 그냥 push(value). 왜 get이고 왜 set push(value)가 아닌가?
    class Stack {
        constructor() {
            this.top = -1;
            this.items = {};
        }
    
        get peek() {
            return this.items[this.top];
        }
    
        push(value) {
            this.top += 1;
            this.items[this.top] = value;
        }
    
        get pop() {
            let item = this.items[this.top];
            delete this.items[this.top];
            this.top -= 1;
            return item;
        }
    }


Uploaded by N2T

    'TIL | WIL' 카테고리의 다른 글
    • 2/20 월 (튜터를 모신 코드 리뷰와 리팩토링의 달콤함) TIL
    • 2/17 금 (Rule of Three 중복 제거 리팩토링, 생생한 예제 코드가 여기있다) TIL
    • 2/15 수 (Ajax를 안 거치고 로그인이 필요한 페이지에 접근하려면 cookie밖에 답이 없다) TIL, TIT
    • 2/14 화 (표류하고 있음) TIL
    깊은바다거북
    깊은바다거북

    티스토리툴바