Muutke küpsiste eelistusi

Domain-Specific Languages [Kõva köide]

  • Formaat: Hardback, 640 pages, kõrgus x laius x paksus: 231x185x37 mm, kaal: 1154 g
  • Sari: Addison-Wesley Signature Series (Fowler)
  • Ilmumisaeg: 07-Oct-2010
  • Kirjastus: Addison-Wesley Educational Publishers Inc
  • ISBN-10: 0321712943
  • ISBN-13: 9780321712943
Teised raamatud teemal:
  • Formaat: Hardback, 640 pages, kõrgus x laius x paksus: 231x185x37 mm, kaal: 1154 g
  • Sari: Addison-Wesley Signature Series (Fowler)
  • Ilmumisaeg: 07-Oct-2010
  • Kirjastus: Addison-Wesley Educational Publishers Inc
  • ISBN-10: 0321712943
  • ISBN-13: 9780321712943
Teised raamatud teemal:
When carefully selected and used, Domain-Specific Languages (DSLs) may simplify complex code, promote effective communication with customers, improve productivity, and unclog development bottlenecks. In Domain-Specific Languages, noted software development expert Martin Fowler first provides the information software professionals need to decide if and when to utilize DSLs. Then, where DSLs prove suitable, Fowler presents effective techniques for building them, and guides software engineers in choosing the right approaches for their applications. This books techniques may be utilized with most modern object-oriented languages; the author provides numerous examples in Java and C#, as well as selected examples in Ruby. Wherever possible, chapters are organized to be self-standing, and most reference topics are presented in a familiar patterns format.

Armed with this wide-ranging book, developers will have the knowledge they need to make important decisions about DSLsand, where appropriate, gain the significant technical and business benefits they offer.

 

The topics covered include:

      How DSLs compare to frameworks and libraries, and when those alternatives are sufficient

      Using parsers and parser generators, and parsing external DSLs

      Understanding, comparing, and choosing DSL language constructs

      Determining whether to use code generation, and comparing code generation strategies

      Previewing new language workbench tools for creating DSLs
Preface xix
Part I Narratives
1(144)
Chapter 1 An Introductory Example
3(24)
Gothic Security
3(2)
Miss Grant's Controller
4(1)
The State Machine Model
5(4)
Programming Miss Grant's Controller
9(7)
Languages and Semantic Model
16(3)
Using Code Generation
19(3)
Using Language Workbenches
22(2)
Visualization
24(3)
Chapter 2 Using Domain-Specific Languages
27(16)
Defining Domain-Specific Languages
27(6)
Boundaries of DSLs
29(3)
Fragmentary and Stand-alone DSLs
32(1)
Why Use a DSL?
33(3)
Improving Development Productivity
33(1)
Communication with Domain Experts
34(1)
Change in Execution Context
35(1)
Alternative Computational Model
36(1)
Problems with DSLs
36(3)
Language Cacophony
37(1)
Cost of Building
37(1)
Ghetto Language
38(1)
Blinkered Abstraction
39(1)
Wider Language Processing
39(1)
DSLLifecycle
40(2)
What Makes a Good DSL Design?
42(1)
Chapter 3 Implementing DSLs
43(24)
Architecture of DSL Processing
43(4)
The Workings of a Parser
47(2)
Grammars, Syntax, and Semantics
49(1)
Parsing Data
50(2)
Macros
52(1)
Testing DSLs
53(9)
Testing the Semantic Model
53(4)
Testing the Parser
57(4)
Testing the Scripts
61(1)
Handling Errors
62(2)
Migrating DSLs
64(3)
Chapter 4 Implementing an Internal DSL
67(22)
Fluent and Command-Query APIs
68(3)
The Need for a Parsing Layer
71(1)
Using Functions
72(5)
Literal Collections
77(2)
Using Grammars to Choose Internal Elements
79(1)
Closures
80(2)
Parse Tree Manipulation
82(2)
Annotation
84(1)
Literal Extension
85(1)
Reducing the Syntactic Noise
85(1)
Dynamic Reception
86(1)
Providing Some Type Checking
87(2)
Chapter 5 Implementing an External DSL
89(16)
Syntactic Analysis Strategy
89(3)
Output Production Strategy
92(2)
Parsing Concepts
94(6)
Separated Lexing
94(1)
Grammars and Languages
95(1)
Regular, Context-Free, and Context-Sensitive Grammars
96(2)
Top-Down and Bottom-Up Parsing
98(2)
Mixing-in Another Language
100(1)
XML DSLs
101(4)
Chapter 6 Choosing between Internal and External DSLs
105(8)
Learning Curve
105(1)
Cost of Building
106(1)
Programmer Familiarity
107(1)
Communication with Domain Experts
108(1)
Mixing in the Host Language
108(1)
Strong Expressiveness Boundary
109(1)
Runtime Configuration
110(1)
Sliding into Generality
110(1)
Composing DSLs
111(1)
Summing Up
111(2)
Chapter 7 Alternative Computational Models
113(8)
A Few Alternative Models
116(5)
Decision Table
116(1)
Production Rule System
117(1)
State Machine
118(1)
Dependency Network
119(1)
Choosing a Model
120(1)
Chapter 8 Code Generation
121(8)
Choosing What to Generate
122(2)
How to Generate
124(2)
Mixing Generated and Handwritten Code
126(1)
Generating Readable Code
127(1)
Preparse Code Generation
128(1)
Further Reading
128(1)
Chapter 9 Language Workbenches
129(16)
Elements of Language Workbenches
130(1)
Schema Definition Languages and Meta-Models
131(5)
Source and Projectional Editing
136(2)
Multiple Representations
138(1)
Illustrative Programming
138(2)
Tools Tour
140(1)
Language Workbenches and CASE tools
141(1)
Should You Use a Language Workbench?
142(3)
Part II Common Topics
145(54)
Chapter 10 A Zoo of DSLs
147(12)
Graphviz
147(2)
JMock
149(1)
CSS
150(1)
Hibernate Query Language (HQL)
151(1)
XAML
152(3)
FIT
155(1)
Make et al.
156(3)
Chapter 11 Semantic Model
159(6)
How It Works
159(3)
When to Use It
162(1)
The Introductory Example (Java)
163(2)
Chapter 12 Symbol Table
165(10)
How It Works
166(2)
Statically Typed Symbols
167(1)
When to Use It
168(1)
Further Reading
168(1)
Dependency Network in an External DSL (Java and ANTLR)
168(2)
Using Symbolic Keys in an Internal DSL (Ruby)
170(2)
Using Enums for Statically Typed Symbols (Java)
172(3)
Chapter 13 Context Variable
175(4)
How It Works
175(1)
When to Use It
176(1)
Reading an INI File (C#)
176(3)
Chapter 14 Construction Builder
179(4)
How It Works
179(1)
When to Use It
180(1)
Building Simple Flight Data (C#)
180(3)
Chapter 15 Macro
183(10)
How It Works
184(8)
Textual Macros
184(4)
Syntactic Macros
188(4)
When to Use It
192(1)
Chapter 16 Notification
193(6)
How It Works
194(1)
When to Use It
194(1)
A Very Simple Notification (C#)
194(1)
Parsing Notification (Java)
195(4)
Part III External DSL Topics
199(142)
Chapter 17 Delimiter-Directed Translation
201(18)
How It Works
201(3)
When to Use It
204(1)
Frequent Customer Points (C#)
205(6)
Semantic Model
205(2)
The Parser
207(4)
Parsing Nonautonomous Statements with Miss Grant's Controller (Java)
211(8)
Chapter 18 Syntax-Directed Translation
219(10)
How It Works
220(7)
The Lexer
221(2)
Syntactic Analyzer
223(3)
Output Production
226(1)
Semantic Predicates
226(1)
When to Use It
227(1)
Further Reading
227(2)
Chapter 19 BNF
229(10)
How It Works
229(9)
Multiplicity Symbols (Kleene Operators)
231(1)
Some Other Useful Operators
232(1)
Parsing Expression Grammars
233(1)
Converting EBNF to Basic BNF
234(2)
Code Actions
236(2)
When to Use It
238(1)
Chapter 20 Regex Table Lexer (by Rebecca Parsons)
239(6)
How It Works
240(1)
When to Use It
241(1)
Lexing Miss Grant's Controller (Java)
241(4)
Chapter 21 Recursive Descent Parser (by Rebecca Parsons)
245(10)
How It Works
246(3)
When to Use It
249(1)
Further Reading
249(1)
Recursive Descent and Miss Grant's Controller (Java)
250(5)
Chapter 22 Parser Combinator (by Rebecca Parsons)
255(14)
How It Works
256(5)
Dealing with the Actions
259(1)
Functional Style of Combinators
260(1)
When to Use It
261(1)
Parser Combinators and Miss Grant's Controller (Java)
261(8)
Chapter 23 Parser Generator
269(12)
How It Works
269(3)
Embedding Actions
270(2)
When to Use It
272(1)
Hello World (Java and ANTLR)
272(9)
Writing the Basic Grammar
272(2)
Building the Syntactic Analyzer
274(2)
Adding Code Actions to the Grammar
276(2)
Using Generation Gap
278(3)
Chapter 24 Tree Construction
281(18)
How It Works
281(3)
When to Use It
284(1)
Using ANTLR's Tree Construction Syntax (Java and ANTLR)
284(8)
Tokenizing
285(1)
Parsing
286(2)
Populating the Semantic Model
288(4)
Tree Construction Using Code Actions (Java and ANTLR)
292(7)
Chapter 25 Embedded Translation
299(6)
How It Works
299(1)
When to Use It
300(1)
Miss Grant's Controller (Java and ANTLR)
300(5)
Chapter 26 Embedded Interpretation
305(4)
How It Works
305(1)
When to Use It
306(1)
A Calculator (ANTLR and Java)
306(3)
Chapter 27 Foreign Code
309(10)
How It Works
309(2)
When to Use It
311(1)
Embedding Dynamic Code (ANTLR, Java, and Javascript)
311(8)
Semantic Model
312(3)
Parser
315(4)
Chapter 28 Alternative Tokenization
319(8)
How It Works
319(7)
Quoting
320(2)
Lexical State
322(2)
Token Type Mutation
324(1)
Ignoring Token Types
325(1)
When to Use It
326(1)
Chapter 29 Nested Operator Expression
327(6)
How It Works
327(4)
Using Bottom-Up Parsers
328(1)
Top-Down Parsers
329(2)
When to Use It
331(2)
Chapter 30 Newline Separators
333(4)
How It Works
333(2)
When to Use It
335(2)
Chapter 31 External DSL Miscellany
337(4)
Syntactic Indentation
337(2)
Modular Grammars
339(2)
Part IV Internal DSL Topics
341(144)
Chapter 32 Expression Builder
343(8)
How It Works
344(1)
When to Use It
344(1)
A Fluent Calendar with and without a Builder (Java)
345(3)
Using Multiple Builders for the Calendar (Java)
348(3)
Chapter 33 Function Sequence
351(6)
How It Works
351(1)
When to Use It
352(1)
Simple Computer Configuration (Java)
352(5)
Chapter 34 Nested Function
357(16)
How It Works
357(2)
When to Use It
359(1)
The Simple Computer Configuration Example (Java)
360(1)
Handling Multiple Different Arguments with Tokens (C#)
361(2)
Using Subtype Tokens for IDE Support (Java)
363(2)
Using Object Initializers (C#)
365(1)
Recurring Events (C#)
366(7)
Semantic Model
366(3)
The DSL
369(4)
Chapter 35 Method Chaining
373(12)
How It Works
373(4)
Builders or Values
375(1)
Finishing Problem
375(1)
Hierarchic Structure
376(1)
Progressive Interfaces
377(1)
When to Use It
377(1)
The Simple Computer Configuration Example (Java)
378(3)
Chaining with Properties (C#)
381(1)
Progressive Interfaces (C#)
382(3)
Chapter 36 Object Scoping
385(12)
How It Works
386(1)
When to Use It
386(1)
Security Codes (C#)
387(5)
Semantic Model
387(3)
DSL
390(2)
Using Instance Evaluation (Ruby)
392(2)
Using an Instance Initializer (Java)
394(3)
Chapter 37 Closure
397(6)
How It Works
397(5)
When to Use It
402(1)
Chapter 38 Nested Closure
403(14)
How It Works
403(2)
When to Use It
405(1)
Wrapping a Function Sequence in a Nested Closure (Ruby)
405(3)
Simple C# Example (C#)
408(1)
Using Method Chaining (Ruby)
409(2)
Function Sequence with Explicit Closure Arguments (Ruby)
411(1)
Using Instance Evaluation (Ruby)
412(5)
Chapter 39 Literal List
417(2)
How It Works
417(1)
When to Use It
417(2)
Chapter 40 Literal Map
419(8)
How It Works
419(1)
When to Use It
420(1)
The Computer Configuration Using Lists and Maps (Ruby)
420(2)
Evolving to Greenspun Form (Ruby)
422(5)
Chapter 41 Dynamic Reception
427(18)
How It Works
428(1)
When to Use It
429(1)
Promotion Points Using Parsed Method Names (Ruby)
430(4)
Model
431(2)
Builder
433(1)
Promotion Points Using Chaining (Ruby)
434(4)
Model
435(1)
Builder
435(3)
Removing Quoting in the Secret Panel Controller (JRuby)
438(7)
Chapter 42 Annotation
445(10)
How It Works
446(3)
Defining an Annotation
446(1)
Processing Annotations
447(2)
When to Use It
449(1)
Custom Syntax with Runtime Processing (Java)
449(2)
Using a Class Method (Ruby)
451(1)
Dynamic Code Generation (Ruby)
452(3)
Chapter 43 Parse Tree Manipulation
455(12)
How It Works
455(1)
When to Use It
456(1)
Generating IMAP Queries from C# Conditions (C#)
457(10)
Semantic Model
458(2)
Building from C#
460(5)
Stepping Back
465(2)
Chapter 44 Class Symbol Table
467(10)
How It Works
468(1)
When to Use It
469(1)
Statically Typed Class Symbol Table (Java)
469(8)
Chapter 45 Textual Polishing
477(4)
How It Works
477(1)
When to Use It
478(1)
Polished Discount Rules (Ruby)
478(3)
Chapter 46 Literal Extension
481(4)
How It Works
481(1)
When to Use It
482(1)
Recipe Ingredients (C#)
483(2)
Part V Alternative Computational Models
485(46)
Chapter 47 Adaptive Model
487(8)
How It Works
488(4)
Incorporating Imperative Code into an Adaptive Model
489(2)
Tools
491(1)
When to Use It
492(3)
Chapter 48 Decision Table
495(10)
How It Works
495(2)
When to Use It
497(1)
Calculating the Fee for an Order (C#)
497(8)
Model
497(5)
The Parser
502(3)
Chapter 49 Dependency Network
505(8)
How It Works
506(2)
When to Use It
508(1)
Analyzing Potions (C#)
508(5)
Semantic Model
509(2)
The Parser
511(2)
Chapter 50 Production Rule System
513(14)
How It Works
514(3)
Chaining
515(1)
Contradictory Inferences
515(1)
Patterns in Rule Structure
516(1)
When to Use It
517(1)
Validations for club membership (C#)
517(4)
Model
518(1)
Parser
519(1)
Evolving the DSL
520(1)
Eligibility Rules: extending the club membership (C#)
521(6)
The Model
523(2)
The Parser
525(2)
Chapter 51 State Machine
527(4)
How It Works
527(2)
When to Use It
529(1)
Secret Panel Controller (Java)
530(1)
Part VI Code Generation
531(48)
Chapter 52 Transformer Generation
533(6)
How It Works
533(2)
When to Use It
535(1)
Secret Panel Controller (Java generating C)
535(4)
Chapter 53 Templated Generation
539(8)
How It Works
539(2)
When to Use It
541(1)
Generating the Secret Panel State Machine with Nested Conditionals (Velocity and Java generating C)
541(6)
Chapter 54 Embedment Helper
547(8)
How It Works
548(1)
When to Use It
549(1)
Secret Panel States (Java and ANTLR)
549(3)
Should a Helper Generate HTML? (Java and Velocity)
552(3)
Chapter 55 Model-Aware Generation
555(12)
How It Works
556(1)
When to Use It
556(1)
Secret Panel State Machine (C)
557(7)
Loading the State Machine Dynamically (C)
564(3)
Chapter 56 Model Ignorant Generation
567(4)
How It Works
567(1)
When to Use It
568(1)
Secret Panel State Machine as Nested Conditionals (C)
568(3)
Chapter 57 Generation Gap
571(8)
How It Works
571(2)
When to Use It
573(1)
Generating Classes from a Data Schema (Java and a Little Ruby)
573(6)
Bibliography 579(2)
Index 581
Martin Fowler is Chief Scientist at ThoughtWorks. He describes himself as an author, speaker, consultant, and general loudmouth on software development. I concentrate on designing enterprise softwarelooking at what makes a good design and what practices are needed to come up with good design. Fowlers books include Patterns of Enterprise Application Architecture; UML Distilled, Third Edition; and (with Kent Beck, John Brant, and William Opdyke) Refactoring: Improving the Design of Existing Code. All are published by Addison-Wesley.