Review: Getting Started with Lazarus IDE by Roderick Person

Recently I came across a new Lazarus book, Getting Started with Lazarus IDE, by Roderick Person (that’s not a typo by the way – there is no definite article in the title). This is a small book (only a hundred pages) put out by Packt, a small publisher with a growing catalogue. While you can purchase just the ebook, I bought the printed/ebook package from the Packt website, which still only cost £15.

The book is presented as being for Delphi programmers interested in Lazarus in the first instance, and any other developers used to RAD environments in the second. As such, it begins by walking through how to install Lazarus on Linux, Windows, OS X and FreeBSD. Following this, the next thirty-five pages or so (up until half way) are taken up by a quick tour of the IDE itself, brief descriptions of the core components of the Lazarus Component Library (LCL), discussions of how to create ‘hello world’ console and GUI applications, an overview of the Lazarus debugger, and an introduction to the IDE’s rename refactoring.

While nicely written, I found this section a little uneven – words are spent on introducing the Object Inspector, for instance, when this is something that works identically to the Delphi version. Conversely, the Project Inspector – Lazarus’s substitute for what on the face of it is Delphi’s rather more fully featured Project Manager – is not mentioned at all, despite actually appearing in a screenshot.

As an aside, while this is no reflection on the author, I did find Person’s description of how to create a Lazarus console application remarkable given how much code was needed simply to output ‘Hello World’. While good ol’

program HelloWorld;

  WriteLn('Hello world');

is still possible, the IDE defaults to bringing in a rather overwrought console application framework. This leads Person having to devote six pages to walking though how to write a console-based ‘Hello World’ followed by less than two for the GUI version!

Once the book gets to half way, chapter 4 tackles the topic of how to convert a Delphi/VCL application to Lazarus and the LCL. I found this chapter very well pitched, with many useful tips presented. Following it, chapter 5 provides an introduction to Lazarus custom component writing. I confess I came out of this being slightly amazed at how the Lazarus team have managed to keep their photocopiers working even when it comes to core parts of Delphi’s Open Tools API! The final two chapters of the book then provide a valuable overview of the Lazarus Documentation Editor (LazDE), followed by a somewhat less obviously useful account of rebuilding the Lazarus IDE to use the GDK+ widgetset on Windows rather than native Win32 controls.

Overall, I found the book easy to read, and with two very solid chapters (4 and 6). At other times I found it a little inconsistent in its focus however – in particular, while the best chapters were clearly aimed towards the book’s stated primary audience, namely Delphi developers, others seemed to assume very little prior Delphi knowledge. Because of that, parts of the book can cover things that most experienced Delphi developers will know off of the back of their hands. A related issue is that the author doesn’t appear to have used any modern version of Delphi. For example, when first presenting the Lazarus IDE, a comment is made about how similar it looks to the Delphi IDE – which is true, but only if you are using Delphi 7 or earlier. Likewise, mention is made when discusing 64 bit compatibility that the PtrInt/PtrUInt types should be used instead of Integer when you need to typecast from a pointer to an integer or vice versa. While that’s good advice in itself, Person doesn’t seem to be aware that Delphi defines NativeInt/NativeUInt types for the same purpose, and has done so for quite a few versions now.

Nonetheless, this shouldn’t detract from the fact that when the book maintains a clear focus, it presents its material well. Also, while it is small, it is also cheap, so if you’re interested in Lazarus, check it out.

Review of Cary Jensen, ‘Delphi in Depth: ClientDataSets’

I had been intending to blog a review of Cary Jensen’s new book when Alister Christie came along and beat me to it, and in a snazzy video form no less. Boringly enough, I’ll stick to the old-fashioned written word though — I wouldn’t dare do otherwise!

As its title very descriptively says, Delphi in Depth: ClientDataSets is a book focussed upon the TClientDataSet component, as found in most editions of Delphi for a long time now. Given not all the things done with a client dataset are specific to it, the book as a result has a less limited focus than its title may imply. For example, one chapter is devoted to the TFieldDef and TField classes, both in the practical terms of how to set them up and in the more conceptual ones of why they both exist in the first place (a question lacking an obvious answer for a newbie!). That this (and indeed other) aspects of the VCL’s general database support are covered isn’t a bad thing though – far from it, it helps make the book a truly comprehensive resource for TClientDataSet-based development.

In terms of structure, the book has 15 chapters spread over a bit more than 300 pages. This meant each chapter has a definite focus (too many programming books I find have long, meandering chapters that should be broken down). In terms of coverage, the book includes chapters on (amongst other things) setting up the aforementioned fields, defining indices, managing the change cache, using aggregates and understanding nested datasets, before ending with a couple DataSnap chapters. While I read the book sequentially myself, its chapters are frequently self-contained enough to be read out of order too. It also has an excellent index.

While all were informative, the chapters I found particularly successful were those with a more pronounced conceptual element, one example being the chapter on cloned cursors in its covering typical usage scenarios. If I were to be hyper-critical, I would have liked a bit more of that sort of thing in other chapters too. In other words, on occasion, it would have been nice to be told up front the purpose of a given feature before being led through how to use it.

Another small negative was the book taking a little long to get going. Admittedly, I have been reading a couple of books in the O’Reilly ‘Nutshell’ series recently, which are edited to have a very abrupt style. Nonetheless, following a general ‘Introduction’ with a bit too much history for my liking, the first chapter proper of Delphi in Depth (‘Introduction to ClientDataSets’) could have been half the length without losing anything substantive. Once the two introductions were out the way however, I found the book well paced with very little cruft. All in all, it is highly recommended.