← Object-Oriented Programming Power 1991

Object-Oriented Programming Power 1991

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

Image 1

MACINTOSH® PROGRAMMING SERIES DISK INCLUDED OBJECT-ORIENTED PROGRAMMING POWER for THINK Pascal™ Programmers ■ Creating and Using Object Class Hierarchies ■ Using a MacApp-like Application Framework ■ Building Reusable Software Components Microsoft PRESS® CHUCK SPHAR

A book cover with a tan background, large blue title text, a teal panel containing a colorful geometric illustration of concentric arcs, spheres, and cubes, a Microsoft Press logo block at lower right, and a floppy disk icon marked DISK INCLUDED at upper right.

Reading notes: The bullet-point subtitle lines are small teal and blue text and were read in order from top to bottom. The 'DISK INCLUDED' text wraps around a floppy disk icon and its reading order is approximate.

Languages
English
PDF page 1

Creating and Using Obied Class Hierarchies

CINTOSH® PROGRAMMING SERIES Creating and Using Obied Class Hierarchies • Using a MacApp-like Application Framework • Building Reusable Software Components for THINK Pascal™ Programmers CHUCK SPHAR

Reading notes: Top series line reads 'CINTOSH®' and is likely truncated from 'MACINTOSH®'; the first letter is not visible in the supplied copy. 'Obied' in the headline may be an OCR error for 'Object'; it is recorded as printed and not corrected. Bullet points and line breaks in the feature list are reconstructed from the supplied copy, and the original layout could not be verified. No prices, dates, or years appear in the supplied copy. The image itself was not available, so the visual description and layout are inferred from the supplied text only.

Printed product names
THINK Pascal™
Languages
English
PDF page 2

OBJECT-ORIENTED PROGRAMMING POWER for THINK Pascal™ Programmers

Large bold black three-dimensional display headline in stacked uppercase letters with a gray drop shadow across the upper portion of an otherwise blank white page, with a smaller bold subtitle line to the right of the last headline word.

Reading notes: The trademark symbol after Pascal is rendered as a superscript TM and is transcribed as ™. Headline is split across three lines in the image and is transcribed in reading order; the subtitle sits on the same baseline as the final headline word POWER.

Languages
English
PDF page 3

OBJECT-ORIENTED PROGRAMMING POWER for THINK Pascal™ Programmers Microsoft PRESS® CHUCK SPHAR

Book cover page with a large bold black drop-shadowed title in the upper left, a smaller subtitle beside the last line, a black Microsoft Press logo box at lower right, and the author name in bold capitals below it on a white background.

Reading notes: Faint body text in the background near the top and middle of the page is too light to transcribe reliably and was omitted. Logo text 'Microsoft' and 'PRESS' is set in white on black and read as printed.

Languages
English
PDF page 4

PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 1991 by Chuck Sphar All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Cataloging-in-Publication Data Sphar, Chuck, 1947- 0bject-oriented programming power for THINK Pascal programmers I Chuck Sphar. p. cm. Includes index. ISBN 1-55615-348-1 1. Think Pascal. 2. Macintosh (Computer}-Programming. -oriented programming (Computer science) I. Title. QA76.8.M3S67 1991 005.265-dc20 Printed and bound in the United States of America. 123456789 AGAG 654321 3. Object 91-16715 CIP Distributed to the book trade in Canada by Macmillan of Canada, a division of Canada Publishing Corporation. Distributed to the book trade outside the United States and Canada by Penguin Books Ltd. Penguin Books Ltd., Harmondsworth, Middlesex, England Penguin Books Australia Ltd., Ringwood, Victoria, Australia Penguin Books N.Z. Ltd., 182-190 Wairau Road, Auckland 10, New Zealand British Cataloging-in-Publication Data available. Apple~ Mac~ MacApp~ Macintosh~ MPW,'" and MultiFinder" are registered trademarks and Finder,™ Macintosh Programmer's Workbench,'" MacsBug,'" MPW Pascal,'" and SADE'" are trademarks of Apple Computer, Inc. Turbo Pascal"' and Turbo Vision"' are registered trademarks of Borland International, Inc. Microsoft"' is a registered trademark and QuickPascal •• is a trademark of Microsoft Corporation. Symantec~ TCL~ and THINK Class Library" are registered trademarks and THINK Pascal•• is a trademark of Symantec Corporation. Object Professional"' is a registered trademark of Turbo Power Software. Acquisitions Editor: Dean Holmes Project Editor: Erin O'Connor Technical Editor: Mary Dejong

Reading notes: OCR damage in the Library of Congress data, e.g. '0bject-oriented' and '-oriented programming (Computer science)' Garbled characters in the trademark notice and the ISBN/CIP block, e.g. '(Computer}' and 'AGAG' Reading order of the cataloging block is uncertain

Printed product names
Microsoft Press · Macintosh · MacApp · MultiFinder · Finder · Macintosh Programmer's Workbench · MacsBug · MPW Pascal · SADE · Turbo Pascal · Turbo Vision · Microsoft · QuickPascal · Symantec · TCL · THINK Class Library · THINK Pascal · Object Professional
Printed dates
1991 · 1947 · 91-16715
Languages
English
PDF page 5

The image is an entirely blank white page with no visible artwork, layout elements, or text.

Reading notes: No visible text or graphics were found in the image, so all printed fields are empty.

PDF page 6

CONTENTS xi ACKNOWLEDGMENTS 1 INTRODUCTION Who should read the book, equipment needs, prerequisites, and how the book is set up. Part 1. ABOUT OOP Introducing Pascal programmers to object-oriented programming, spiraling deeper into OOP concepts and techniques, and ending with three technical reference chapters. 9 1. INTRODUCTION TO OOP Object Pascal from two points of view: the OOP view and the Pascal view. History of Object Pascal. 15 2. OOP OVERVIEW Introduction to OOP concepts for Pascal programmers: what OOP is; what objects are; where they come from (classes); what's inside them (encapsulation, instance variables, methods, interface vs. implementation); and how they oper- ate (messages, methods, self). Introduction to object class design and compiling. 45 3. RECORDS PLUS PROCEDURES EQUALS OBJECTS A comparative example: the same simple program in standard Pascal and in Object Pascal. Emphasis on syntax and program structure. 67 4. MACOBJECTS Class TButton, a full-blown Macintosh interface object class. More on class design and method writing. Preparation for the next chapter on inheritance and subclassing. 91 5. PROGRAMMING BY DIFFERENCES Building new classes from old (inheritance, subclassing, overriding). Using inheritance in design. Compiling subclasses. Example program: a familiar Macintosh user interface object, the button. 111 6. MANY SHAPES Demonstrating the uses of polymorphism in a simple auto parts inventory program.

Languages
English
PDF page 7

Object-Oriented Programming Power

Object-Oriented Programming Power 137 159 193 229 253 273 299 viii 7. OOP COOKBOOK A roundup of commonly used OOP techniques, including creating, using, and disposing of objects; designing classes; writing methods; using units; and com- piling, debugging, and optimizing. 8. THE FAMILY TREE Classes in hierarchies. Implic~tions of hierarchical structure for team programming. The inherited mechanism, abstract superclasses, and scope. 9. INSIDE OBJECT PASCAL More on Object Pascal syntax. How compilers implement objects, inheritance, and runtime binding. Part 2. OBJECT·ORIENTED APPLICATIONS Showing how OOP techniques are used to build an application framework like Apple's MacApp or Symantec's THINK Class Library (TCL); how to set up the Mac interface with a number of MacApp-like objects; and how to manage interobject communication and event handling. The principles of using an application framework. IO. DESIGNING OOP APPLICATIONS Guidelines for designing object-oriented programs exemplified by the high-level design of a game of craps: finding the objects, designing thein, and developing and testing them. Introduction to the idea of a general application framework that handles generic chores of the Macintosh graphical user interface. Introduc- tion to PicoApp, a small application framework modeled on MacApp and TCL. 11. PICOAPP: A TINY APPUCATION FRAMEWORK Structure and communication in the Crapgame program. How events are handled. How to solve problems of scope and how to use inheritance. Comparison of PicoApp with MacApp and TCL. Deriving the structure of PicoApp from Crapgame. 12. PICOOBJECTS Class declarations for the four main object classes in PicoApp. The concepts underlying the classes, the classes' main functions, what the classes lack, and the "hooks" the classes provide for modifying their default behaviors. 13. INSIDE PICOAPP: THE APPLICATION How PicoApp handles application-level tasks: application startup, event handling, document creation, menus, and application shutdown.

Reading notes: Some characters appear garbled in extraction, such as 'thein' and 'Implic~tions'. Reading order of the table of contents fragments may be uncertain.

Languages
English
PDF page 8

333 349 387 411 431 CONTENTS 14. INSIDE PICOAPP: MORE ON THE APPLICATION How PicoApp manages the cursor and memory. Possible improvements to PicoApp, including a way to implement Undo. 15. INSIDE PICOAPP: DOCUMENTS, WINDOWS, AND VIEWS How PicoApp document, window, and view objects function in relation to each other and to the application. PicoSketch, a simple PicoApp-based program illustrating how to implement drawing with tools. 16. USING PICOAPP Detailed explanation of the steps in using PicoApp to develop an application: subclassing PicoApp's classes; overriding PicoApp's methods (deciding which ones); writing and incorporating application-specific classes; creating a resource file; and compiling, debugging, and testing. 17. THE MODEL Brief overview of Model-View-Controller (MVC) concepts. Implementation of the Crapgame model in the document object, a player list object, player objects, and dice objects. Part 3. POLYMORPHIC SOFTWARE COMPONENTS Demonstrating more advanced uses of OOP by means of a selection of useful objects. More on polymorphism and runtime binding and more on deriving one class from another. Focus on building highly general reusable software com- ponents, or "software !Cs." Centerpiece a highly general list data structure built as a component to be reused in any application. List model implemented both as a linked list and as a dynamic array-based list. Other reusable software com- ponents, including a general binary search tree. 18. LIST OBJECTS AND LISTS OF OBJECTS A progression of approaches to building lists of objects-from conventional nodes containing objects to nodes that are objects to nodes that are elements of a dynamic array. "Linkability" as an inheritable trait of objects. List manager objects. The problem of searching lists (especially polymorphic lists). Ix

Reading notes: Primary heading not identifiable; source appears to be a table of contents page with chapter entries.

Languages
English
PDF page 9

Object-Oriented Programming Power

Object-Oriented Programming Power 457 485 19. DESIGNING A GENERAL LIST SOFTWARE COMPONENT Design issues for a highly general list software component: making the list safe to use, easy to reuse, and general enough to hold many types of data. The list abstraction. A node "locking" mechanism. General encapsulated lists and the problem of "data knowledge." 20. IMPLEMENTING THE l'LINKEDLISl'COMPONENT Implementation of many of TLinkedList's more interesting methods (except those involving searching and traversing the list). Comparison of list models for speed, space, and reusability. 511 21. IMPLEMENTING THE r11sr COMPONENT 545 Designing TList's class hierarchy. Implementation of class THandleArray, a dynamic array class. Implementation of TList's more interesting methods. Making the list dynamic. Constraining the data types the list can hold. Storing non-object data types in the list. 22. POLYMORPHISM: THE FIND PROBLEM How to search a highly general list: procedural parameter and search key object techniques. 571 23. POLYMORPHISM: THE DOTOEACH PROBLEM 587 607 639 647 659 667 x How to traverse a list, sending arbitrary messages to its elements: command system, traversal action object, and sequence object approaches. 24. COMPONENTS FROM COMPONENTS When to subclass and when to build on a substrate of imported objects. Examples include stacks and a general collection class. 25. MORE COMPONENTS A consideration of other useful classes and OOP components: trees, general nodes, array objects, streams and filters for input/output. Examples include a binary search tree software component. Final thoughts on reusability. APPENDIXES A. PORTING TO OTHER PASCALS B. BOOKS AND ARTICLES ABOUT OOP C.GLOSSARY INDEX

Reading notes: Page number '457' and '485' appear in the header with ambiguous reading order OCR-like spacing and possible character errors in "l'LINKEDLISl'COMPONENT" and "r11sr"

Printed product names
TLinkedList · TList · THandleArray
Languages
English
PDF page 10

ACKNOWLEDGMENTS Thanks first to Gary Little and his compatriots at Apple Computer. Gary's advice, his moral support, and especially his putting me in contact with the best agent in the business made the back end of the process much easier. Thanks next to Claudette Moore, my agent, whose tireless efforts not only got the manuscript into Microsoft Press's hands and made publication a reality but also made the book stronger, cleaner, and more effective. Claudette's advice made all the difference. The technical support people at Symantec, especially Philip Borenstein and Dave Alcott, helped with a number of technical issues. My list of those to thank at Microsoft Press is long and full of extraordinary profes- sionals who care about their craft. It starts with Dean Holmes, my acquisitions editor, who had the faith and the courage to take on a book that wasn't written about some massively popular DOS product. The book's final quality and appearance come in great measure from the work of art designer Kim Eggleston; word processors Debbie Kem and Judith Bloch; typographers Lisa Iversen and Rodney Cook; layout artist Peggy Herman; and proofreaders Cynthia Riskin, Kathleen Atkins, and Alice Copp Smith. I'd also like to thank the researchers at Microsoft Library; who tracked down a great many bibliographical details. Most of all, my appreciation goes to my technical editor, Mary Dejong, and my manuscript editor, Erin O'Connor. Mary caught my program bugs, made many in- valuable suggestions, and taught me to eat Thai food. Finally, and above all, thanks to Erin, whose wit and love of what she does made the editorial process an actual joy. These are really my coauthors and my friends. Then thanks also to my friends and colleagues at White Sands Ground Terminal, who cheered me on when I left them to write and who read the ever-changing versions of the manuscript for me. Thanks, Aaron Goodman, Robin Wells, Terry Stambaugh, Bill Shaeffer, Paul Berver, and Toni Giacalone. Thanks also to Kay Patton, Jo Ann Hoffman, and other TDRSS people for their support. Thanks as well to Gary Willis, fellow seeker in the quest for publication. His encouragement and advice meant a lot to me. Thanks too to my family, especially Max, for a lifetime of encouragement. But thanks most of all to Pam, for assistance, encouragement, reading, encouragement, testing, encouragement, and earning a living while I wasn't. How could I have done it without you? CbuckSpbar Las Cruces, New Mexico xi

Reading notes: Closing line 'CbuckSpbar' is unclear and may be a garbled signature or OCR artifact.

Printed product names
DOS
Languages
English
PDF page 11

INTRODUCTION If you do any programming at all, you've no doubt paid some attention to the hoopla about object-oriented programming, or OOP as it's usually called. There are lots of ways to do OOP, of course, and you can program with objects in a variety of languages, from Smalltalk to THINK C to MPW C++ to Prograph. This book-disk package guides you into doing OOP in Pascal-that is, in a modified form of Pascal, called Object Pascal, that preserves every capability you already have in Pascal while adding a parsimonious and rather elegant set of extensions that permit you to do object-oriented programming. So welcome to OOP. And to Object Pascal. And to this book. Is This Book for You? If you program the Macintosh in Pascal and you're intrigued by what you've been hearing about object-oriented programming, this book is for you. It will deliver what you want to know-in your native language. If you've heard about Apple's MacApp application framework and you're interested in learning to write applications with it, this book will teach you the fundamentals of object-oriented programming on which MacApp is based. The book doesn't teach MacApp, but it does teach you the skills you need to get into MacApp. You don't have to be interested in MacApp to benefit from this book, but you probably will be by the time you finish it. What lquip111ent Will You Need? You'll need a Macintosh with 1 megabyte of RAM or more-a Macintosh Plus, Classic, or LC, or any member of the Macintosh SE and Macintosh II lines. You'll need Apple's MPW Pascal 2.0, TML Systems' TML Pascal 2.0 (now discontinued), or Sy- mantec's THINK Pascal 2.0 (formerly Lightspeed)-or later versions. To use any of these Pascals effectively, you'll need a hard disk. See Appendix A for a discussion of the relative merits of these Pascals and for buying information. I've written the book's code with THINK Pascal 3.0. 1

Reading notes: Hyphenated line breaks (e.g., 'Sy-mantec', 'lquip111ent') may contain OCR artifacts.

Printed product names
Smalltalk · THINK C · MPW C++ · Prograph · Object Pascal · Macintosh · MacApp · Macintosh Plus · Classic · LC · Macintosh SE · Macintosh II · MPW Pascal 2.0 · TML Pascal 2.0 · THINK Pascal 2.0 · THINK Pascal 3.0
Languages
English