목록2024/09 (35)
밤빵's 개발일지
협업 프로젝트를 진행하면서 Git을 사용하게 되었고, 커밋과 머지는 코드 관리에서 핵심적인 개념이다. 하지만 아직 Git 사용에 익숙하지 않은 나로서는 이 두 개념이 어떻게 활용되는지 제대로 이해하기 어렵다. 주특기 주차 때 커밋이랑 푸쉬하면서 과제를 날려먹은적이 있어서 아직도 깃사용은 손이 떨린다😢 이번에 프로젝트를 진행하며 커밋과 머지의 개념을 정확히 배우고, 협업에서 어떻게 활용하는지 기록해두려고한다. ▶ 커밋(commit)커밋은 버전 관리에서 하나의 변경 내역을 저장하는 행위이다. Git을 사용하는 개발에서는 파일을 수정하고 그 변경 사항을 기록하기 위해 커밋을 한다. 커밋을 통해 코드가 저장되고, 특정 시점으로 되돌릴 수 있는 일종의 스냅샷이 생성된다.커밋 메시지를 통해 어떤 작업이 이루어졌..
🤓프레임워크와 라이브러리프레임워크와 라이브러리는 소프트웨어 개발에서 매우 중요한 개념이다. 개발을 하면서도 자주 접하게 되는데, 이 둘의 차이점을 명확하게 이해하지 못하고 있었다. 이번 개발일지에서는 프레임워크와 라이브러리의 개념과 차이점, 그리고 백엔드 개발에서 자주 사용하는 예시들을 정리해봤다. ▶ 프레임워크란?프레임워크는 전체적인 구조와 흐름을 미리 정의해 둔 틀이다. 개발자는 그 틀 안에서 코드를 작성하고, 프레임워크가 제공하는 규칙과 구조를 따라야 한다. 프레임워크는 개발자가 호출하는 것이 아니라, 프레임워크가 개발자의 코드를 호출하는 방식이다. 이를 제어의 역전(Inversion of Control, IoC)이라고 한다. ▶ 스프링 프레임워크 예시대표적인 백엔드 프레임워크로 Spring F..
결제기능이 테스트가 너무 안되서 포스트맨만 돌려보고있다가, 테스트코드에 대한 설명을 들었다. 작성해본적도 없고, 강의를 듣지도 않아서 잘 모르는 내용이라, 테스트코드에 관한 개발일지를 작성하기로했다. 오늘 개발일지에서는 결제 기능에 대한 테스트 코드를 작성해 보았다. 결제 기능은 사용자와의 신뢰를 구축하는 중요한 부분이기 때문에, 이를 검증하기 위한 테스트 코드는 좋은방법인 것 같아서! 테스트를 통해 예상치 못한 버그나 결제 처리 실패와 같은 문제를 미리 발견하고, 이를 해결할 수 있다.▶ 스크린샷을 통한 테스트코드 설명 (with 정재님) → 테스트 코드에서 Mock 객체를 활용하여 테스트에 필요한 가짜 데이터를 주입하는 방법을 보여준다. MockitoAnnotations.openMocks(this)를..
결제기능을 구현하면서, 동시성문제와 멱등성에 대해서 알게됐는데 이름부터 너무 생소해서 이걸 어떻게 공부해야하나 걱정부터 앞서던 중 기술매니저님 께서 PUT과 PATCH를 생각하면 이해하기 쉬울거라고하셔서 연관지어 개발일지를 작성하게 되었다. 코드 예시는 내 서비스 코드를 사용했는데.. 기능 구현이 너무너무 안되고 있다😢멱등성(Idempotency) 문제는 결제 시스템을 구현할 때 중요한 개념이다. 멱등성은 같은 요청을 여러 번 반복해서 보내더라도 결과가 변하지 않는 성질을 의미하는데, 특히 결제 시스템에서는 멱등성을 보장하는 것이 매우 중요하다. 같은 결제 요청이 여러 번 처리되면 고객에게 중복된 결제가 발생할 수 있기 때문이다. 이 멱등성을 이해하기 위해서 HTTP메서드인 PUT과 PATCH와 연관지..
N+1 문제를 굳이굳이 발생시키고도 감을 못잡아서 결국 기술매니저님께 숙제를 다시 받아버렸다. 꼭 해결해보기로! 직접 해결방법까지 보여주셨지만 또 버벅거려서 시온님께 다시 여쭤보고 현재 진행하고 있는 팀 프로젝트에 적용해봤다. 🤓N+1 문제 발생과 해결 과정▶ 기술매니저님이 보여주신 예시 분석!→ TestEntity 클래스가 ProductEntity와 @OneToMany 관계로 설정되어 있고, fetch = FetchType.LAZY로 지연 로딩이 설정되어 있다. ▷ 관련 설명 → Service Layer (TestService):TestService 클래스의 test() 메서드는 TestEntity를 조회한 후 entity.getTestEntities()를 호출하고 있다. fetch = Fetch..