Develop-02 9004 April 1990.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
develop The Apple Technical Journal USING C++ OBJECTS IN A HANDLE-BASED WORLD USING OBJECTS SAFELY IN OBJECT PASCAL THE SECRET LIFE OF THE MEMORY MANAGER SPEED YOUR SOFTWARE DEVELOPMENT WITH MACAPP MACINTOSH Q & A HOW TO DESIGN AN OBJECT-BASED APPLICATION UNOFFICIAL C++ STYLE GUIDE DEMYSTIFYING THE GS/OS CACHE APPLE II Q & A Issue 2 April 1990 E D I T O R I A L T E C H N I C A L R E V I E W E R S Editor in Chief’s Clothing Louella Pizzuti Tim Enwall Don Loomis Developmental Editors Lorraine Anderson Craig Prouse John Harvey and Carol Westberg Jon Zap Jerry Godes Editorial Assistant Susan Marsland Gregg Williams Dennis Gibbs Editorial Assistant Lenore Zelony Jim Straus Matt Deatherage Manager, Developer Press David Krathwohl Andy Shebanow Richard Clark Larry Rosenstein Mary Chan A R T & P R O D U C T I O N Lew Rollins Bob Campbell Design/Art Direction Joss Parsey Rob Neville Jeremy Bornstein Technical Illustration Cleo Huggins P. Nagarajan Rick Blair Production Bruce Potterton Robin Myers Brian Bechtel Printer Craftsman Press Bob Martin Pete Alexander Film Preparation FilmCraft Photographer Ralph Portillo Circulation Management Dee Kiamy Online Production Cassi Carpenter S P E C I A L T H A N K S Mark Kieling C O V E R Illustrator Cleo Huggins In spite of 4 years at R.I.S.D. and 10 years of experience (including an MS indigital typography from Stanford), Cleo still creates. Of course, she's got the perfect environment at home: a parrot that talks and a boyfriend that doesn't. If she runs into any ancient Egyptions (and she might), she's ready with an 800- character hieroglyphic font she created for the Mac. Pretty cool. One thing, though: she laughs at Louella's jokes (sometimes she even thinks they're funny). © 1990 Apple Computer, Inc. All rights reserved. Apple, the Apple logo, MacApp, Macintosh, and MPW are registered trademarks of Apple Computer, Inc. Content Using C++ Objects in a Handle-Based World Avoiding headaches when you use C++ objects in the Macintosh world. 118 Using Objects Safely in Object Pascal Guidelines to take the worry out of using objects so you can relax and enjoy their advantages. 129 The Secret Life of the Memory Manager Memory Manager behavior and how it affects your applications. 140 Speed Your Software Development with MacApp Let MacApp take care of the user so you can focus on writing—and reusing–—code. 155 Macintosh Q & A Questions and answers compiled by the Macintosh Developer Technical Support group. 176 How to Design an Object-Based Application A step-by-step two-phase process for designing an object-bases application. 178 Unofficial C++ Style Guide How to harness C++’s power without getting tripped up by some of its less savory features. 204 Demystifying the GS/OS Cache Taking the mystery and confusion out of caching algorithms. 233 Apple II Q & A Questions and answers compiled by the Apple II Developer Technical Support group. 243 Index 247 113 CONTENTS April 1990 Dear Readers, Wow! Your response to the first issue of develop was overwhelming! You sent almost two hundred letters and Links telling me what you liked, what you’d like changed, and what articles you’d like to see. I’ve published (and answered) a representative sampling in the Letters section and will continue to let you know what happens with your suggestions. Article-specific questions are answered (by the original authors) in the Macintosh Q & A section. This issue of develop revolves around object programming. If you’ve been reading much of what’s been coming out of Apple lately, you will have noticed quite a push toward object programming. Apple has invested years of R & D in object programming and we’re working to get you to take advantage of the work we’ve done. LOUELLA PIZZUTI Unless you’re already an object-based programmer, this issue probably won’t solve any problems you’re struggling with right now. I’m hoping, however, that it helps to convince you that object programming can save you time and effort in the long run and that it’s worth the investment it will take to learn about a new environment. Not only will object programming help you to write and to maintain today’s applications, but it will also help to prepare you for tomorrow’s system software. Providing you with code and ideas that serve you well when new products come out is one of my top priorities, so look past today and into tomorrow and use the code and ideas we give you. Keep those cards and letters coming! Louella Pizzuti Editor 114 d e v e l o p April 1990 X THEZ GOOD backgrounds on thes authors, etc. I predict that develop will establish a i W Wow! B new standard of excellence in technical k—Jim Russell supportt literature. But please find a s better font for theU source code listings; p k the font is so faint that I found qmyself We just received the first issue ofZ suffering from eye strain after a short develop. It is just what we need. In while. u fact, it couldn’t come at a better time. —Ken Friedenbach LETTERS Anyway, pleasek continue to do it—we t V v need it! Great idea, great layout, great WhatX a fantastic idea! The graphic topics, etc.... o design in develop is so good that it —Daniel Tapie almost distracts fromB the content. l Keep up the good work and please Thanks a lot for the complimentary send the next issue (this one was v Q firstW issue of develop. It makes me feel Ystolen…). healthy with the funny introduction of —Jean-Michel Karr the authors, wealthyh with its luxury, i l and happy for your name is nicer than THE BAD ever on the first page. —Philippe develop xhas NOTHING to offer an a Apple II owner/developer. Apple no K I believeA you have a winner here! longer has my respect as the founder of i develop has helped me in just the first the home computing and friendlys 10 minutes. I needed help with the interfaces. tI do not want a Mac and Palette Manager andj I found it here!y the way I feel at this moment I would m not have a Mac if you gave it to me. Might I suggest that the CD-ROM Yes, I am angry! P —R. L. Woodworth Y B envelope be perforated? This would M allow easy removal of the packet and Z alleviate the “now I have the CD- The outstanding quality of the premier ROM out, but the packet is stillc in the issue of develop was overshadowed by C its content. It wouldi have been way when I flip through the pages” w syndrome. appropriateg in a premier issue to —Bryan Carter devote approximately equal space to b BOTH Apple lines of computers. Fantastic idea!!! Keep up ther good Apple II support in develop would work. This first issue was FULL of ssurely help Apple and encourage thoseT N good, timely, and useful advice (code). who acknowledge the IIs as very Thanks for your efforts to help respectable computers. May the Apple Y developers.D II and Macintosh linesI BOTH enjoy —Ken Duncan continuedz and increasing success in d their respective markets! h Excellent magazine! I really enjoyed —Steven Gozdziewski the articles, source code examples, t n H Y u F 115 JCOMMENTS We welcomeT timely letters to the SUBSCRIPTION INFORMATION Please editor, especially from readers wishing to react to address all subscription (and subscription-related) articles thato we publish in develop. Letters should enquiries to: y be addressed to Louella Pizzuti; 20525 Mariani L Ave. M/S 75-3B; Cupertino, CA 95014 develop u (AppleLink Pizzuti1). All letters shouldG include EApple Computer, Inc. F r name and company oname as well as address P.O. Box 531 and phone number. Letters may be excerptedq or Mt. Morris, IL 61054 USA R O edited for clarity and space. AppleLink: DEV.SUBS E I S LETTERS April 1990 X LikeZ other commodities, develop is and the next issue wills have our first crack influenced by the laws of supply and at the intelligent indexer. All commentsi W demand. I publish articlesB based on what I and suggestions welcome. khave and on what I believe the development t—Louella community needs.s There is a definite need U p k for Apple II information, and develop I’m curious to find out WHYq Apple will continue to be a forum in whichZ to decided to go with a CD-ROM disc. I meet that need, but the mix of Apple II and understand that the disc holds gobs of u Macintosh articles will continue to reflect data (which I would imagine goes the mix of developersk and their needs (and mostly unused every issue); however,t I V v available articles), rather than an absolute wonderX HOW MANY of the Mac and 50-50 balance. o Apple II developers actually own a —Louella CD-ROM drive. B Apple may be trying l to encourage developers to utilize this WThe situation on technical information technology, but at the moment it looksv Q has just gotten worse with develop. Y like they are just flapping their wings in We now have Inside Macintosh, the breeze. I’ve got a great idea! Technical Notes, hthe Q & A stack, Everyone who can’t use thei CD-ROM l develop, and many other documents disc should mail it back to Apple.