Skip to Content
Java 8 Lambdas 技術手冊
book

Java 8 Lambdas 技術手冊

by Richard Warburton
November 2014
Intermediate to advanced
176 pages
3h 16m
Chinese
GoTop Information, Inc.
Content preview from Java 8 Lambdas 技術手冊
設計與架構原則
|
117
運用了 Lambda 的領域專用語言
領域專用語言
domain-specific language
, DSL)是著重在軟體系統中特定部份的程式設
計語言。它們通常是小型語言,對多數程式設計任務而言,經常不若 Java 之類的通用性
語言(general-purpose language)那麼有表達力。DSL 的任務特殊化了:捨棄了樣樣精
通,DSL 只專攻某些事物。
DSL 通常被分為兩類:
內部
internal
)與
外部
external
)。外部 DSL 是在程式原始碼
外獨立撰寫,而後獨立地剖析與實作。例如,CSSCascading Style Sheet)與規則表達
式是常用的外部 DSL
使用某程式語言撰寫,並被嵌入該語言中的是內部 DSL。如果你用過 mock 程式庫,像
JMockMockito,或是 JOOQ Querydsl 之類的 SQL 建造者 API,那麼對內部 DSL
並不陌生。某些意義上,它們只是有流暢 API 設計的一般程式庫。儘管內部 DSL
單,然而價值在於它們是能讓程式碼變得更簡潔且易於閱讀的強大工具。理想上,DSL
撰寫的程式碼閱讀起來,就像在反映出問題域中之對話。
導入了 lambda 表達式,實作具流暢性的 DSL 就更為容易,而想嘗試 DSL 的人們也多了
樣工具。我們會建立一個用於行為驅動開發(behavior-driven development, BDD),
LambdaBehave
DSL,藉此探討這類議題。 ...
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

Java 8 Lambdas

Java 8 Lambdas

Richard Warburton

Publisher Resources

ISBN: 9789863474067