Kylix:
The Professional Developer's
Guide and Reference

Buy it!

The commission I get if you buy through these links helps make it possible for me to write more books - without affecting the price that you pay.

Amazon
Amazon (US)

Amazon.UK
Amazon.de

or

Barnes and Noble
Barnes & Noble

Hello Kylix

Newton famously said "If I have seen farther than others, it is because I have stood on the shoulders of giants." This made a big impression on me as a boy, and to this day I still think that the highest thing one can do is to add something to the store of human knowledge. Spreading some of that knowledge a bit more widely is probably the next best thing. So, when I set out to write a programming book, I don't want to write a book that will be pulped in six months. I want to write a classic like K&R or The Camel Book that will go through multiple printings and multiple editions. When a small bookstore only carries one Kylix book, I want it to be this book.

The hallmark of programming classics seems to be that not only do they have something for everyone, but that they are also worth keeping around for reference. A Kylix classic needs to introduce Kylix to people who've never used Delphi or Borland Pascal, and it needs to introduce Linux programming to experienced Windows programmers. At the same time, it needs to be deep and well organized, so that it's the first place you turn when the on-line help isn't enough.

These are not necessarily easy goals to reconcile. I think I've done a pretty good job, but of course only you can make that decision.

This book is a tutorial or a guide, in the sense that each section assumes nothing but intelligence and a broad programming background. I explain Pascal so that someone who's done lots of programming, but not in Pascal, can understand every detail of the language and how and why to use it. I explain Kylix's tools and libraries so that anyone who's done any GUI programming can understand the architecture and how to use it. I explain Linux programming so that anyone who knows what files and processes are can understand how files and processes work under Linux.

At the same time, this book is a reference in that it's full of details and is organized so as to make it easy to find answers to specific questions. This is a big book, but that's because it covers a lot of material, not because it's full of white space and screen shots. I don't expect you to remember everything you read; I expect you to come away from each chapter and each section with enough of a feel for the material to go out and get in trouble. Then come back to check the details. I've provided lots of tables and a global index to them, and every chapter has a detailed table of contents that lists every section heading.

About Kylix

Kylix is a Linux application development environment. You can't use Kylix to write device drivers or kernel modules, but you can use Kylix to write any type of Linux application. Kylix can do small command line utilities that read standard input and write standard output. Kylix can do system daemons. Kylix can do database apps and web server apps. And Kylix is simply the best and most productive environment in which to write Linux GUI apps.

Kylix is an amazing product. Most programming projects are considered successes if they get one key thing right. Kylix gets a whole basketful right.

  • Kylix compiles and links incredibly quickly. The longer an environment takes to compile and link, the more likely you are to make a lot of changes after each test run. The more changes you make, the harder it is to figure out which change caused new problems. Kylix compiles so quickly that it's entirely practical to test each change as you make it. It's not uncommon for Kylix programmers to compile and test tens and hundreds of times a day.
  • Kylix has a capable and tightly integrated source code debugger. Combined with fast compiles, debugging with Kylix is almost as easy as debugging with an interpreter. Easier, perhaps, as the GUI environment means that you don't have to keep typing commands.
  • Kylix is full of cross-referencing tools that make it easy to understand both applications and the libraries they use.
  • Kylix is built on top of Object Pascal, a language that is fully as expressive as C++, but that is much easier to read and that offers stronger protection against careless errors.
  • Kylix uses Borland's CLX [Component Library, cross platform] library, a 4th generation GUI object library. The old OWL [Object Windows Library] reflected lessons learned from TurboVision. Delphi's VCL [Visual Component Library] reflected lessons learned from OWL. In turn, Kylix's CLX reflects lessons learned from the five iterations of the VCL. Kylix's CLX is powerful, extensible, clean, and elegant.
  • Kylix and the CLX let you write cross-platform applications with a native feel and native capabilities. There's nothing 'lowest common denominator' about the CLX.
Kylix and Delphi users absolutely love their development tool. I think this book will show you why.

About this book

Experienced Delphi programmers will especially appreciate the material on operator overloading and custom variants in Chapter 3.

This book is divided into four sections, plus a series of appendices. Section 1, Object Pascal , introduces the Object Pascal language as used in Kylix and Delphi 6. While this section is written to be accessible to people who have never programmed in Pascal, or who haven't done so for years and years, even experienced Delphi programmers will find it worth their while to read Section 1. Unlike some other Kylix books, this book is not in any way a "port" of a Delphi book. Section 1 describes Kylix's Object Pascal as an organic whole; it wasn't originally written for a 16-bit Pascal with material inserted for each new feature as it came along.

Section 2, Kylix, describes Kylix as a programming environment and as an object library. Again, while programmers who have never used Delphi can profitably read this section, I also think that very few experienced Delphi programmers will think that they wasted their time in reading Section 2. The material on basic form design in Chapter 5, Using Kylix, for example, includes an explanation of "Anchors" that might change the form design practices of anyone who learned Delphi before version 4. Chapter 6, Visual Objects, explains the fundamentals of widgets and drawing surfaces, as well as detailing what's new in the CLX and how the CLX differs from the VCL. Chapter 7, Foundation Objects, similarly describes utility code from streams and collections to threads and semaphores for both those who've never used the VCL equivalents and for those who chiefly need to know what's new. Chapter 8 is a wide-ranging overview of Library Procedures that will surprise anyone who thinks they know their way around SysUtils. Chapter 9, Component Creation , covers less new ground, but even here there are a few Qt-specific techniques that old hands may find useful.

Section 3, Linux, is an introduction to Linux programming: "Linux for Windows programmers", by a Windows programmer. There's probably little here for an experienced Linux or Unix programmer, but Linux newbies will find that Chapter 10, Unix, contains what they need to know about files and processes, memory mapping and signals, as well as environment strings and user ids. Chapter 12, Regexes & Scripts, introduces POSIX regular expressions and their use in Kylix applications, as well as basic shell scripting. Chapter 13, X & Qt, contains an architectural overview of X and Qt .

Section 4, Projects , contains a couple of extended examples, showing Kylix in action. The first three sections contain plenty of short bits of sample code that illustrate key concepts-and the tarball that you can download from the Apress web site contains the working projects that the sample code comes from-but Section 4 contains two complete applications and detailed walkthroughs of their most interesting features.

What you won't find in this book is anything about databases and web servers. Obviously these are key topics, but if I'd covered them well, this book would have been much bigger and much later. If you like this book, let Apress know that you want a companion volume.

Download instructions and Hello World applications snipped ...