DTO
-
엔터프라이즈 애플리케이션 아키텍처 패턴 3 - 데이터 전송 객체, 기본 패턴책책책 책을 읽읍시다/프로그래밍 2023. 3. 14. 23:43
15장. 분산 패턴 - 데이터 전송 객체 메서드 호출 횟수를 줄이기 위해 프로세스 간에 데이터를 전송하는 객체이다. 원격 파사드와 같은 원격 인터페이스를 사용할 때는 각 호출의 비용이 상당히 부담스럽다. 따라서 호출 횟수를 줄여야 하며, 이를 위해서는 각 호출에서 더 많은 데이터를 전송해야 한다. 한 가지 방법은 다수의 매개변수를 사용하는 것이다. 그러나 이 방식은 프로그램을 작성하기에는 상당히 불편하며, 자바와 같이 단일 값만 반환할 수 있는 언어에서는 아예 불가능하다. 이 문제를 해결하는 방법은 호출에 필요한 모든 데이터를 저장하는 데이터 전송 객체(Data Transfer Object)를 만들어 사용하는 것이다. 데이터 전송 객체는 직렬화가 가능해야 연결을 통해 전송할 수 있다. 일반적으로 데이터 ..