Skip to Content
함수형 프로그래밍 with 자바
book

함수형 프로그래밍 with 자바

by 벤 바이디히, 허귀영
March 2024
Beginner to intermediate
528 pages
10h 48m
Korean
Hanbit Media, Inc.
Content preview from 함수형 프로그래밍 with 자바
474
PART 02
함수형 접근 방식
public class StandardShipping implements ShippingStrategy
{
//
...
}
public class ExpeditedShipping implements ShippingStrategy
{
public ExpeditedShipping
(
boolean signatureRequired
)
{
//
...
}
//
...
}
각 전략은 고유한 타입과 구체적인 구현이 필요합니다. 이러한 일반적인 접근 방식은 이전
절에서 알아본 데코레이터와 매우 유사해보입니다. 그렇기 때문에 거의 동일하게 함수형 방
식으로 단순화할 수 있습니다.
더 함수적인 접근 방식
전략 패턴의 전반적인 개념은
행동의 매개변수화
behavioral
parameterization
로 요약할 수 있습니다.
즉,
ShippingService
는 소포 배송을 가능하게 하는 일반적인 구조를 제공합니다. 그러나 실
제로 배송되는 방법은 외부에서 전달되는
ShippingStrategy
를 통해 결정됩니다.
전략은 최대한 단순하고 컨텍스트에 영향을 받지 않는 결정이어야 하며, 종종 함수형 인터페
이스로 나타낼 수 있습니다. 이 경우 전략을 만들고 사용하는 방법에 대한 여러 가지 옵션이
있습니다.
람다와 메서드 참조
부분 적용 함수
구체적인 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

실무로 통하는 클린 코드

실무로 통하는 클린 코드

막시밀리아노 콘티에리

Publisher Resources

ISBN: 9791169212175