Maybe you noticed that there was no books review for December — I had too much to do, so I hadn't finished reading of any book. But Christmas and New Year brought me more free time, and I finished reading of several books.
DSLs in ActionSometime ago I decided, that I need to read something about domain specific languages (DSL) to find new ideas, compare with my own implementation (I developed several DSLs, that I use in my projects), and maybe improve my solutions. I selected , written by Debasish Ghosh, who is well-known developer in Scala community, although he is also using other languages, for example, Haskell, Groovy, Clojure. When I was trying to select which book to read, I also thought about book, written by Martin Fowler, but Manning offered good discount on books, so I bought their book ;-)This book is written using very simple and clear language, but it provides very interesting information. Author uses in examples different languages — Ruby, Groovy, Scala, Clojure (in this book the only languages that are working on JVM are used, so some things are applicable only to this platform). This allows to demonstrate different approaches to design and development of DSLs (you can also read on why this book is polyglotic).First part of book is dedicated to DSLs basics — author begins with description what is DSL, what parts it consists from, which types of DSLs are exist, how they are executed, benefits and drawbacks of using DSLs in your projects. Separate section describes how to model specific domains, and how this affect DSLs structure.Second chapter demonstrates simple DSL, built in Java, and analysis of its drawbacks is performed. In the next section, the similar DSL is created with Groovy, and its benefits are described, comparing with first implementation. In the rest of this chapter the DSLs implementation patterns are reviewed.The third chapter is dedicated to description of how to integrated DSLs into your project. It describes java scripting engine, Spring-based integration, and some other. For each of approaches, benefits and drawbacks are analyzed, including how it could affect DSL's implementation, and related questions.The second part (chapters 4-8) concentrates on DSLs implementation using different programming languages. 4th chapter describes common patterns in implementation of internal DSLs — meta-programming, typed abstractions, run-time code generation, etc. And next 2 chapters (5 and 6) demonstrate this with DSLs implementation in Ruby, Groovy, Clojure, and Scala.Seventh chapter continues DSLs implementation theme with description of how to implement external DSLs. The different types of parsers of reviewed, that could be used to parse DSL's code, and small example of ANTLR's usage is provided. There is also small section on Xtext — Eclipse's framework, that simplifies development of external DSLs.In 8th chapter, the use of parsers combinators is demonstrated with application to development of external DSLs. Chapter begins with small introduction to parsers combinators, and continues with demonstration of how Scala's parsers library could be used to create external DSL.The last part of the book provides some thoughts on modern tendencies in DSLs development, support tools, etc.Besides main material, the book has several appendixes that contain short descriptions of programming languages, that were used in book, so you can get familiar with them, if you hadn't used them yet. Separately, I want to mention "philosophical" appendix A, that dedicated to discussion of role of abstractions in domain modeling, how purity and lack of side effects affect development, and some related problems. Besides this, you can also look on appendix B, that discusses role of meta-programming in DSL's development.Conclusion: if you're using and/or developing DSLs, or you're interested in this topic, then you need to read this book — it contains a lot of practical information, that could be useful in DSLs development.Camel in ActionFor one of my "pet" projects I was need to create data processing system that will get and process data from different sources, so, after some googling, I found , that was looked pretty interesting and mature project, so I bought at Manning the books, written by Claus Ibsen and Jonathan Anstey.The book begins (chapter 1) with introduction into Apache Camel — which tasks are solved with it, which components it consists from, etc. The second chapter provides more detailed description of routes, and how you can create them using code in Java or Spring.The second part of book describes basic Camel's techniques — how to convert data, handle errors, test code, use additional components (such as JMS, databases, etc.).And third parts provides description of how to work with transactions inside Camel's workflow, how to process data concurrently. There are also chapters on deployment of projects, that are using Camel, and how to monitor Camel in production environment.Separate chapter (11th) describes development process for projects that are using Camel, including development of new adapters and components. Besides this, there is description of DSL, written in Scala (although, from my point of view, the project looks more interesting), and also shown how to use Camel with other languages.Conclusion: if you interested in Apache Camel's usage, then you can acquire this book — it contain pretty good introduction to this system, and could be used as reference to some of the base components.P.S. The new project was also created to integrate Clojure with Apache Camel. Project is called , and if you interested in it, then you can join to discussions in specially created .Test-driven development: By ExampleSeveral days ago I made a presentation (for our internal developers seminar) on test driven development (TDD) and unit testing, and during preparation, I decided to read something from peoples, who were founders of this movement. The Extreme Programming series I read many years ago, right after release of corresponding books, so I decided to read the book by Kent Beck.Book isn't big (about 200 pages), but I think, that it still too big for this topic — author took small problem (exchange conversion), and describes test-driven implementation of solution in great details. This example is used in the first part of the book to demonstrate basics of TDD and unit testing.In the second part, TDD is illustrated by implementing of xUnit-like testing framework for Python language, with detailed description of all necessary steps.The third part of the book is dedicated to description of base approaches and patterns in test-driven development, how to design code for testability, how to design tests, etc.Conclusion: this is pretty good introduction to TDD, but I could recommend it only for people who never used TDD in their work — it's too elementary from my point of view. Although, there are some good advices on code organization, workflow, etc. But if you know something about unit testing, then you can find other sources of information. - Full Post
No comments:
Post a Comment