Book review: Delphi Cookbook by Daniele Teti, Packt publishing
Posted by jpluimers on 2014/12/01
After speaking on EKON 2014 and ItDevCon 2014, the last month has been extremely busy on both the work and family side of things.
Before the review, first two ways to see for yourself if you’d like the book:
- The Amazon page for Delphi Cookbook has a Look Inside option to view about 80 pages.
- The Packt page for Delphi Cookbook has a Free Sample option to view about 70 pages, and a code listing download (which also contains the errata).
Some other reviews of the Delphi Cookbook also make an interesting read (I read them after writing my own):
- Simon Stuart: OTAPI – Book Review – Delphi Cookbook by Daniele Teti.
- David Millington: Review: Delphi Cookbook by Daniele Teti.
Before the review a disclaimer. I bought the eBook version before Packt publishing asked for reviewers. They sent me a paper copy for free (which somehow took 2 weeks to arrive). I read about 25% of the book before the two European Delphi conferences, and the rest over the last two weeks.
I’ll try to keep this to the point, as too much detail would be killing. And I’m not writing a book here (:
So lets start with what I like:
- Writing style: most of it is very pleasantly and encouraging to read.
- introduction – short description of the aim
- how to do it – step by step explanation to get an example working
- how it works – explaining the crucial parts of the example
- there’s more – revealing more details and providing background information
- Explanation where recipe deviates from best practices
- Mix of topics
- Fresh and surprising examples
- Building the examples on (relatively) new language and library features without distracting the examples: I was positively surprised about every other example how well Daniele did this
- For Delphi features in the book introduced in a specific Delphi version mentioning this version
- Keeping a variety of topics throughout the book, while still building up on previous sections during the book
I want to stress the last: Daniele Teti did an excellent job on this.
When writing a book or teaching material, it is hard to strike balances between the kinds and diversity of topics, the depth and order of the topics, and choosing between what to cover and how to cover it.
The way the chapters a built together with a variety of interesting topics per chapter, a great mix of chapters, and the various topics building (but not too much relying) on previously covered topics is really great. The whole book shows that Daniele is a great teacher. Well done.
Then a few things I dislike:
- Chapter 1
- The first chapter has a few VCL topics that could have been explained better. I have the feeling those were the initial writing chapters, and Daniele and the reviewers were still settling down on a routine. Shortly after that, the book gets much much better: like hearing Daniele doing a talk on a conference.
- Code formatting
- Especially in the eBook, the code is poorly formatted. There are enough tools to to a properly formatted example code export from Delphi, so this should have been done much better.
- There is still a quite a bit of non-English idiom and sentence structure in the book. This can be distracting. The reviewers and editors should have done a better job on this.
- Even though explaining SQL injection, the book does not talk about any other kinds of injection. Since there are many examples of clients and servers passing parameters by strings, there is virtually no error checking. This is bad, as exactly those kinds of parameter passing can make for very vulnerable applications.
- Hard coded Delphi XE6 links
- most of the Embarcadero web site allows you to link to topics in a non-Delphi version speficif way
- Some “there’s more” portions are a bit thin
- I know this is a trade off: so few pages, to much to cover. But still (: Maybe Daniele finds time to write a series of blog posts on the “there’s more” portion.
- Cleanup without doing try..finally
- Way too few programmers value the try..finally construct (Delphi, C#, and many other languages) so this should be the cornerstone of every resource cleanup example.
The dislikes are minor compared to the likes, so here is the…
I didn’t buy the book by accident: knowing the presentation and teaching style of Daniele, I was expecting a nice mix of topics explained in a light and fun way. The book surpassed those expectations by far.
So any Delphi programmer should buy this book. If not for using right now, then for getting some ideas, and reading the various topics later.
Below some suggested combinations for using this book various Delphi audiences.
Buy this book. It gets you inspired, even if only some of the topics are suited for real beginners. Then get the books below, read them and get back to the Delphi Cookbook for more inspiration:
- The free German Delphi Starter book from Delphi-Treff (yes, Germany is not the primary language for a lot of you, but this book is very well written) which covers covers introductory topics in a very nice pace.
- The paid Delphi XE2 Foundations by Chris Rolliston.
- The free Delphi Essentials eBook by Marco Cantù. Though more than a decade all, it is still a good book for starters. By now you can get the electronic version of the book at CodeCentral.
Average Delphi users
Buy this book. Consider buying Coding in Delphi by Nick Hodges.
Advanced Delphi users
Also read Coding in Delphi by Nick Hodges.
I know few people that master all Delphi topics well (I’m not one of them: especially on the mobile side I’ve still a lot to learn). Even for gurus, I think this is a nice book, especially considering the price.
Table of Contents
Chapter 1: Delphi Basics
- Changing your application’s look and feel with VCL styles and no code
- Changing the style of your VCL application at runtime
- Customizing TDBGrid
- Using the owner’s draw combos and listboxes
- Creating a stack of embedded forms
- Manipulating JSON
- Manipulating and transforming XML documents
- I/O in the twenty-first century – knowing streams
- Putting your VCL application in the tray
- Creating a Windows service
- Associating a file extension with your application on Windows
Chapter 2: Become a Delphi Language Ninja
- Fun with anonymous methods – using higher-order functions
- Writing enumerable types
- RTTI to the rescue – configuring your class at runtime
- Duck typing using RTTI
- Creating helpers for your classes
- Checking strings with regular expressions
Chapter 3: Going Cross Platform with FireMonkey
- Giving a new appearance to the standard FireMonkey controls using styles
- Creating a styled TListBox
- Impressing your clients with animations
- Using master/details with LiveBindings
- Showing complex vector shapes using paths
- Using FireMonkey in a VCL application
Chapter 4: The Thousand Faces of Multithreading
Synchronizing shared resources with TMonitor
Talking with the main thread using a thread-safe queue
Synchronizing multiple threads using TEvent
Displaying a measure on a 2D graph like an oscilloscope
Chapter 5: Putting Delphi on the Server
- Converting a console service application to a Windows service
- Serializing a dataset to JSON and back
- Serializing objects to JSON and back using RTTI
- Sending a POST HTTP request encoding parameters
- Implementing a RESTful interface using WebBroker
- Controlling remote applications using UDP
- Using App Tethering to create a companion app
- Creating DataSnap Apache modules
Chapter 6: Riding the Mobile Revolution with FireMonkey
- Taking a photo, applying effects, and sharing it
- Using listview to show and search local data
- Do not block the main thread!
- Using SQLite databases to handle a to-do list
- Using a styled TListView to handle a long list of data
- Taking a photo and location and sending it to a server continuously
- Talking to the backend
- Making a phone call from your app!
- Tracking the application’s life cycle
Chapter 7: Using Specific Platform Features
- Using Android SDK Java classes
- Using iOS Objective-C SDK classes
- Displaying PDF files in your app
- Sending Android intents
- Letting your phone talk – using the Android TextToSpeech engine