2 - Marco Cantù Object Pascal Handbook October 2014 Draft A first draft of the “Complete Guide to the Object Pascal programming language”, based on the compilers produced by Embarcadero Technologies Piacenza (Italy), October 2014 Marco Cantù, Object Pascal Handbook - 3 Author: Marco Cantù Publisher: Marco Cantù Editor: Peter W A Wood Cover Designer: Fabrizio Schiavi (www.fsd.it) Copyright 1995-2014 Marco Cantù, Piacenza, Italy. World rights reserved. The author created example code in this publication expressly for the free use by its readers. Source code for this book is copyrighted freeware, distributed via the web site http://code.marcocantu.com. The copy- right prevents you from republishing the code in print or electronic media without permission. Readers are granted limited permission to use this code in their applications, as long at the code itself is not distributed, sold, or commercially exploited as a stand-alone product. Aside from this specific exception concerning source code, no part of this publication may be stored in a retrieval system, transmitted, or reproduced in any way, in the original or in a translated language, including but not limited to photocopy, photograph, magnetic, or other record, without the prior agreement and written permission of the publisher. Delphi and Appmethod are trademarks of Embarcadero Technologies. Other trademarks are of the respective owners, as referenced in the text. The author and publisher have made their best efforts to prepare this book, and the content is based upon the final release of the software. The author and publisher make no representa- tion or warranties of any kind with regard to the completeness or accuracy of the contents herein and accepts no liability of any kind including but not limited to performance, merchantability, fitness for any particular purpose, or any losses or damages of any kind caused or alleged to be caused directly or indirectly from this book. The Object Pascal Handbook, October 2014 Draft. ISBN-10: * ISBN-13: * Electronic edition licensed to Embarcadero Technologies Inc. Any other download or sale outlet is likely to be illegal. Do not distribute the PDF version of this book without permission. Print edition to become available as the book is completed in early 2015. More information on http://www.marcocantu.com/objectpascal Marco Cantù, Object Pascal Handbook 4 - begin begin Power and simplicity, expressiveness and readability, great for learning and for pro- fessional development alike, these are some of the traits of today's Object Pascal, a language with a long history, a lively present, and a brilliant future ahead. Object Pascal is a multi-facet language. It combines the power of object-oriented programming, advanced support for generic programming and dynamic constructs like attributes, but without removing support for more traditional style of proce- dural programming. A tool for all trades, with compilers and development tools embracing the mobile era. A language ready for the future, but with solid roots in the past. What is the Object Pascal language for? From writing desktop apps to client-server applications, from massive web server modules to middleware, from office automa- tion to apps for the latest phones and tablets, from industrial automated systems to Internet virtual phone networks... this is not what the language could be used for, but what it is currently used for today, in the real world. The core of the Object Pascal language as we use today comes from its definition in 1995, a terrific year for programming languages, given that this was the year Java and JavaScript were also invented. While the root of the language dates back to its Pascal ancestor, its evolution didn't stop in 1995, with core enhancements continu- ing as of today, with the desktop and mobile compilers build by Embarcadero Technologies and found in Appmethod, Delphi, and RAD Studio. Marco Cantù, Object Pascal Handbook begin - 5 A Book on Todays' Language Given the changing role of the language, its extension over the years, and the fact it is now attracting new developers, I felt it important to write a book that offers com- plete coverage of the Object Pascal language as it is today. The goal is to offer a language manual for new developers, for developers coming from other similar lan- guages, but also for old timers of different Pascal dialects that want to learn more about recent language changes. Newcomers certainly need some of the foundations, but given changes have been pervasive even old-timers will find something new in the initial chapters. Beside a short Appendix covering the short history of the Object Pascal language, this book was written to cover the language as it is today. A large part of the core fea- tures of the language hasn't changed significantly since the early versions of the Delphi, the first implementation of modern Object Pascal in 1995. As I'll hint throughout the book, the language has been far from stagnant during all of these years, it has been evolving at quite a fast pace. In other books I wrote in the past, I followed a more chronological approach, covering classic Pascal first, and fol- lowing extensions more or less as they appeared over time. In this book, however, the idea is to use a more logical approach, progressing through the topics and cover- ing how the language works today, and how to best use it, rather than how it evolved over time. As an example, native data types dating back to the original Pascal lan- guage have method-like capabilities (thanks to intrinsic type helpers) introduced recently. So in Chapter 2 I'll introduce how to use this feature, although it won't be until much later than you'll figure out how to make such custom type extensions. In other words, this book covers the Object Pascal language how it is today, teaching it from the ground up, with only a very limited historical perspective. Even if you have used the language in the past, you might want to skim thought the entire text looking for newer features, and not focus only on the final chapters. Learn by Doing The idea of the book is to explain core concepts and immediately present short demos that readers are encouraged to try to execute, experiment with, and extend to understand the concepts and assimilate them better. The book is not a reference manual, explaining what the language should do in theory and listing all possible corner cases. While trying to be precise, the focus is more on teaching the language offering a practical step-by-step guide. Examples are generally very simple, because the goal is to have them focused on one feature at a time. Marco Cantù, Object Pascal Handbook 6 - begin The entire source code is available in a subversion repository, rather than a down- load file, so that you can easily update your code in case I publish any changes or additional demos. You can use any subversion client (my personal preference on Windows is for TortoiseSVN) and point it to the following HTTP URL to get all of the demos of the book (alternatively you can also check out individual chapters): http://code.marcocantu.com/svn/marcocantu_objectpascalhandbook/ The repository source code can also be browsed online by selecting the “Browse” link in the code repository wiki page at: http://code.marcocantu.com/trac/marcocantu_objectpascalhandbook To compile and test it the demo code, you'll need one of the available versions of the Object Pascal compiler, and possibly a recent one to compile them all. There are trial versions available that you can use, generally allowing you a 30-days free use of the compiler. Appendix C explains how to get started with the available IDEs. A Companion Web Site The book has a companion web site with further information, links, updates and more. There are both a static, traditional site with information at: http://www.marcocantu.com/objectpascalhandbook and online pages on Google+ (using a bit.ly link) and Facebook at http://bit.ly/objectpascalgplus https://www.facebook.com/objectpascalhandbook Acknowledgments As any book, this volumes owes a lot to many people, too many to list one by one. The person who shared most of the work on the book was my editor, Peter Wood, who kept bearing with my ever changing schedule and was able to smoothen my technical English very significantly as usual, helping to make this book (like my pre- vious handbooks) what it is. Given my current work position as product manager at Embarcadero Technologies, I owe a lot to all my my coworkers and the members of the R&D team, as during my time at the company my understanding of the product and its technology has further increased thanks to the insight I got in countless conversations, meetings, and email threads. Marco Cantù, Object Pascal Handbook begin - 7 Other people outside Embarcadero continued being important for this, from the cur- rent group at Wintech Italia, to the countless customers, Embarcadero sales and technical partners, Delphi community members, MVPs and even developers using other languages and tools I keep meeting so often. And finally big thank you goes to my family for bearing with my travel schedule, nights of meetings, plus some extra book writing on weekends. Thanks Lella, Benedetta, and Jacopo. About Myself, the Author My name is Marco and I've spent most part of the past 20 years writing, teaching, and consulting on software development with the Object Pascal language. I wrote the Mastering Delphi best-selling series and later self-published several Handbooks on the development tool (about the different versions from Delphi 2007 to Delphi XE).
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages333 Page
-
File Size-