Skip to Content
프로그래밍 스칼라: 실용적인 스칼라 활용법을 익히는 가장 확실한 실전 바이블 (2.11.x 버전 기반)
book

프로그래밍 스칼라: 실용적인 스칼라 활용법을 익히는 가장 확실한 실전 바이블 (2.11.x 버전 기반)

by 오현석, 딘 왐플러, 알렉스 페인
July 2016
Beginner to intermediate
776 pages
17h 26m
Korean
Hanbit Media, Inc.
Content preview from 프로그래밍 스칼라: 실용적인 스칼라 활용법을 익히는 가장 확실한 실전 바이블 (2.11.x 버전 기반)
717
23
애플리케이션 설계
전략
관련 알고리즘의 모음을 실체화해서 필요에 따라 알고리즘을 바꿔서 사용할 수 있게 한다. 고
차 함수를 사용해서 이를 쉽게 구현할 수 있다. 예를 들어
map
을 호출할 때 호출하는 쪽에서
는 원하는 대로 실제 원소를 변환하기 위해 사용하는 ‘알고리즘’을 지정할 수 있다.
템플릿 메서드
변하지 않는 메서드로 알고리즘의 뼈대를 정의하고, 그 메서드에서는 서브클래스에서 오버
라이딩함으로써 동작을 변화시킬 수 있는 다른 메서드를 호출한다. 이 패턴은 구체적 메서드
를 오버라이딩하는 것보다 훨씬 더 안전하며, 더 일관성 있기 때문에 내가 가장 좋아하는 패턴
중 하나다. 이에 대해서는
11
.
1
.
1
절 ‘구체적 멤버를 오버라이딩하는 일 피하기’에서 설명했
다. 오버라이딩하기 위한 추상 메서드를 정의하는 것의 대안은 고차 함수로 템플릿 메서드를
정의하고 템플릿 메서드가 전달받은 함수가 필요한 커스텀화를 수행하게 하는 것이다.
비지터
절차를 인스턴스에 넣어서 다른 코드에서 해당 타입이 지원하지 않는 연산의 내부에 접근할
수 있게 해준다. 이 패턴은 공개 인터페이스를 해킹하고 구현을 복잡하게 만들기 때문에 끔찍
한 패턴이다. 다행히 우리에게는 훨씬 더 나은 대안이 있다. 타입을 설계하는 사람은
unapply
unapplySeq
메서드를 사용해서 적절한 내부 상태만 외부에 노출시키는 부가 비용이 적은
절차를 정의할 수 있다. 패턴 매칭은 그 기능을 사용해서 값을 뽑아내고 새 기능을 정의할 수
있다. 타입 클래스는 기존 타입에 ...
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

스파크를 이용한 자연어 처리 : 대규모 텍스트를 다루는 가장 효율적인 딥러닝을 만나다

스파크를 이용한 자연어 처리 : 대규모 텍스트를 다루는 가장 효율적인 딥러닝을 만나다

이창현, 앨릭스 토머스

Publisher Resources

ISBN: 9788968482755