전체 글
-
k8s와 gitlab(+ArgoCO)을 이용한 CI/CD 모험기 - 손주호세미나, 영상 요약정리 2023. 1. 29. 00:01
https://www.youtube.com/watch?v=-hO1m__aLu8 손주호님의 영상을 요약한 내용입니다. CI/CD인프라 구성 배경 컨테이너화 된 배포를 진행하고 있었지만 오케스트레이션을 따로 구성하진 않은 상황이었습니다. 다양한 잠재적인 위험요소가 있었습니다. - 특정 태그를 전달받아 해당 태그 이미지를 배포하는 형식이라 휴먼에러가 발생할 수 있었습니다. 이외에도 여러 이슈가 있었습니다. 1개의 VM에 1개의 컨테이너를 띄워서 사용하고 있었습니다. 이때 VM 스펙이 비해 컨테이너 리소스가 많이 낭비되고 있었습니다. DEV용 테스트 코드를 빌드하더라도 Deploy는 운영자에게 요청해야 하는 작업이 비효율적이었습니다. CI구축 CI를 위해서는 gitlab CI를 사용했습니다. 이때 gitlab-..
-
34장 - 빠져 있는 장클린 코드(Clean Code)/클린 아키텍처요약 2023. 1. 28. 00:01
계층 기반 패키지 전형적인 계층형 아키텍처에는 웹, 업무 규칙, 영속성 코드를 위한 계층이 하나씩 존재합니다. OrderController(Spring MVC) OrdersService(인터페이스) OrderServiceImpl(구현체) OrdersRepository(인터페이스) JdbcOrderRepository(구현체) 기능 기반 패키지 서로 연관된 기능, 도메인 개념, 또는 Aggregate Root에 기반하여 수직의 얇은 조각으로 코드를 나누는 방식입니다. Aggregate Root란 에릭 에반스의 도메인 주도 설계에 나온 개념으로 데이터 변경의 단위로 다루는 연관 객체의 묶음입니다. orders라는 패키지를 두고 Controller, Service, Repository를 모두 묶어둡니다. 이제 ..
-
33장 - 사례 연구: 비디오 판매클린 코드(Clean Code)/클린 아키텍처요약 2023. 1. 27. 00:01
뛰어난 아키텍트가 일을 처리하는 과정과 결과 예시 비디오를 판매하는 소프트웨어에서 아키텍트가 일을 처리하는 과정과 결정을 내리는 과정을 보여주고자 합니다. 1단계: 액터와 유스 케이스를 식별하기 제작자, 구매자, 관리자, 시청자로 엑터를 구분합니다. 엑터는 시스템이 변경되어야 할 네 가지 주요 근원이 됩니다. 이때 유사한 유스케이스는 식별해서 초기에 통합하는 방법을 찾습니다. (유스 케이스 추상화) 2단계 : 컴포넌트 아키텍츠 그리기 뷰, 프레젠터, 인터랙터, 컨트롤러로 분리된 전형적인 분할된 컴포넌트 아키텍처를 그릴 수 있습니다. 각 컴포넌트는 단일 .jar 파일 또는 단일 .dll 파일에 해당합니다. 하지만 꼭 모두 배포할 필요는 없고 선택적으로 배포방식을 조정할 수 있습니다. 예를 들어 다섯 개의 ..
-
10장 - 단위 테스트를 만들어라Kotlin/Effective Kotlin 요약 2023. 1. 26. 00:01
코드를 안전하게 만들기 사용자의 관점에서 애플리케이션이 외부적으로 제대로 작동하는지 확인하기 위해서는 단위 테스트가 필요합니다. TDD TDD라는 접근 방식도 존재합니다. 1. 테스트를 먼저 작성하고 2. 테스트를 통과시키는 것을 목적으로 하나씩 구현해나가기 단위 테스트의 장점 리팩터링 하는 것이 두렵지 않습니다. 테스트가 있기 때문에 리팩터링 했을 때 버그가 생기는지 쉽게 확인할 수 있습니다. 수동으로 테스트하는것보다 훨씬 빠르게 테스트할 수 있습니다. 단위 테스트의 단점 테스트를 만드는 데 시간이 걸립니다. 테스트를 활용할 수 있게 코드를 조정해야 합니다. 좋은 단위 테스트를 만드는 작업이 꽤 어렵습니다. 다음과 같은 부분에 테스트를 적용하면 좋습니다. - 복잡한 부분 - 계속해서 수정이 일어나고 리..
-
9장 - use를 사용하여 리소스를 닫아라Kotlin/Effective Kotlin 요약 2023. 1. 25. 00:01
close 메서드를 사용해서 명시적으로 닫아야 하는 리소스들 - InputStream, OutputStream - sql.Connection - java.io.Reader - Socket과 Scanner 보통 이런 리소스들은 AutoCloseable을 상속받는 Closeable 인터페이스를 구현하고 있습니다. 전통적으로 이런 리소스는 다음과 같이 try-finally 블록을 사용해서 처리합니다. var socket: Socket? = null var inputStream: InputStream? = null var reader: InputStreamReader? = null try { socket = Socket("thdev.tech", 80) inputStream = socket.getInputStre..
-
8장 - 적절하게 null을 처리하라Kotlin/Effective Kotlin 요약 2023. 1. 24. 00:01
null이 의미하는 바 값이 부족하다는 것을 의미하며 프로퍼티의 값이 설정되어있지 않거나 제거되었음을 의미합니다. 함수가 null을 반환한다는 것은 여러 의미를 가집니다. -. firstOrNull에서 주어진 조건에 맞는 요소가 존재하지 않음 - String.toIntOrNull에서 String을 Int로 적절하게 변환할 수 없음 이처럼 null은 명확한 의미를 주어야 합니다. null 처리법 null은 대게 API를 사용하는 사용자가 처리합니다. 기본적으로 null은 3가지 방법으로 처리합니다. -?. , 스마트 캐스팅, Elvis 연산자 사용 - 예외 throw - nullable 하지 않도록 리팩터링 의도적으로 예외 throw 하기 만약?. 을 사용할 경우 개발자가 null이 되리라 예상하지 못했다..
-
클라우드 환경에서의 Kafka 운영기세미나, 영상 요약정리 2023. 1. 23. 00:01
https://www.youtube.com/watch?v=XyuqoWUCdGA 클라우드 플랫폼 개발팀의 김대호 님의 영상을 요약한 내용입니다. 카프카의 특징 카프카는 토픽에 메시지를 발행(Publish) 및 구독(Subscribe) 구조 토픽은 병렬 처리를 위해 파티션 단위로 구성되어 있습니다. 파티션은 안정성을 위해 레플리카로 복제 구성되어 있습니다. 카프카는 상태 기반 시스템입니다. 발행되는 메시지는 브로커의 파일 시스템에 저장됩니다. 브로커가 토픽 파티션의 메시지를 저장하고 있다 => 브로커가 토픽 파티션의 레플리카를 가지고 있다 => 브로커가 토픽 파티션의 상태를 가지고 있다로 귀결됩니다. 하지만 카프카는 상태를 자동으로 옮기지 않습니다. 브로커가 가지고 있는 레플리카를 다른 브로코로 임의로 옮기..
-
7장 - 결과 부족이 발생할 경우 null과 Failure를 사용하라Kotlin/Effective Kotlin 요약 2023. 1. 22. 00:01
개요 함수가 원하는 결과를 만들어낼 수 없는 경우가 발생할 수 있습니다. 다음과 같은 상황이 예시로 존재합니다. - 서버로부터 데이터를 읽어 들이려 했지만 인터넷 연결 문제가 발생한 경우 - 조건에 맞는 첫 번째 요소를 찾으려 했지만 찾을 수 없는 경우 - 텍스트를 파싱해서 객체를 만드려고 했지만 텍스트의 형식이 맞지 않는 경우 이런 상황을 어떻게 처리하면 좋을까요? 다양한 처리 방법들 - 예외를 throw 한다 - null 또는 실패를 나타내는 sealed 클래스를 리턴한다(대게 이름을 Failure 사용) 이때 예외는 정보를 전달되는 방식으로 사용되서는 안 됩니다. 예외적인 상황이 발생했을 때 사용하는 것이 좋습니다. 예를 들어 JPA를 사용하여 findByID로 특정 ID값을 가진 하나의 객체를 조..