Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!iuvax!pur-ee!a.cs.uiuc.edu!uxc.cso.uiuc.edu!uxe.cso.uiuc.edu!leonardr From: leonardr@uxe.cso.uiuc.edu Newsgroups: comp.sys.mac.programmer Subject: Re: Design Philosophy Message-ID: <226000021@uxe.cso.uiuc.edu> Date: 5 Jul 88 15:29:00 GMT References: <434@dogie.edu> Lines: 55 Nf-ID: #R:dogie.edu:434:uxe.cso.uiuc.edu:226000021:000:2992 Nf-From: uxe.cso.uiuc.edu!leonardr Jul 5 10:29:00 1988 terranova@vms.macc.wisc.edu(John Terranova) in comp.sys.mac.programmer >Greetings, > A friend of mine recently expressed his disapproval of the standard >Macintosh program design. Rather than putting windows, menus, icons, >def procs, strings, controls, etc. in resources he would prefer to >hard code everything into the program and make heavy use of #define >statements. He would change the #defines instead of the resources. >"That's why they made the preprocessor." > > I am interested in other peoples thoughts on this. Aside from >being able to modify parts of the program without recompilation, what >advantages are there to putting everything into resources? What >disadvantages are there to having all code with no other resources? What's >it like in the real world (outside a university)? Are there any major >trends in this type of design philosophy? > > His method is simpler to get some code running. In fact, I use >quite regularly for this purpose. Then, once the code runs the way I want >it, I move data and def/filter procs into a resource and change NewControl() >to GetNewControl() (for example). > >Comments, anyone? > Always comments on the net!! There are basically two really good reason for using resources over hard coded strings, etc. 1) You can edit them without having to recompile! 2) Other people can edit them without having access to the source code! This to me is the most important. As a programmer who does a lot of work in inter- nationalization of software, I have no need for the original source code. All I need is the program itself and ResEdit. I can then go in and change all of the textual items to the language that I am localizing for. No compiling!! As far as using resource any harder than using hard coded values. I have found the for many resource types, keep them as resource is MUCH easier than hard coding them. Dialogs and Alerts are two of the best examples. I, for one, do not like the idea of having to create a DITL on the fly!! And the standard Alert call only takes a ResID, so you need a resource for that one. Strings on the other hand are, in many cases (especially in C) easier to work with as defined items, but how could I go and change it to French without the code? +---------------------------------+-----------------------------------+ + + Any thing I say may be taken as + + Leonard Rosenthol + fact, then again you might decide+ + President, LazerWare, inc. + that it really isn't, so you + + + never know, do you?? + + leonardr@uxe.cso.uiuc.edu + + + GEnie: MACgician + MacNET: MACgician + + Delphi: MACgician + + + + + +---------------------------------+-----------------------------------+