Object-Based
Total Page:16
File Type:pdf, Size:1020Kb
Information Technology Solutions, Inc. Inc. Solutions, Technology Information FIRST CLASS FIRST is published often by often published is Computing Object-Based Computing Computing Object - Based Based - - Object Object THE OBJECTWARE PROFESSIONALS NETWORK Eric Wespestad, Chicago • quality (trusting objects you didn’t Robust interobject communication is a Information Technology Solutions create, standards for testing), and necessary precondition for component • storage of objects (persistency and software. Among other methods to archiving) accomplish this end, NEXTSTEP is OPN was founded shortly before NeXT- graced with Portable Distributed Objects, WORLD Expo 1993 under the name of OPN maintains an archive of its mailing a nearly transparent method of interappli- Open Protocols for NeXTSTEP - but list that is available via ftp for those cation messaging, even across heteroge- later changed its name, as it’s focus interested in the topics mentioned above. neous networks. expanded, to reflect the many facets of the ObjectWare equation. Since that time “OPN's mission is to evangelize individuals from about 80 organizations component software which can be Component software also needs stan- have participated in discussions like the woven by users into customized dard object programming interfaces to be following: solutions. OPN will provide the tech- exported by the various components. nical and political infrastructure for a OPN is serving as a forum where the vibrant component software mar- • brokering of objects (finding them), ket.”—Marcos Javier Polanco NEXTSTEP community can discuss and agree on what these standards must be. • documenting objects (figuring out “NeXT has for years offered the best Once users obtain these various objects technical foundation for this new how to use commercial objects), they will want to weave them together into age, but it did not come about. Why • licensing objects (how to distribute not? Selling kits to developers will customized applications, using either the and pay for third-party objects), not cause a paradigm shift in the Objective-C++ compiler or systemwide industry. Selling components to scripting languages. ! • normalization of protocols by which users will, and that means asking objects interroperate (assembling them "what will it take" for them to applications from the parts of other prefer components to Lotus Smart- See the related article “A Scenario for the applications), Suite.”—Marcos Javier Polanco ObjectWare Marketplace“ on page 5 . INFORMATION TECHNOLOGY SOLUTIONS, INC Object-Based Computing / December 1993 500 WEST MADISON, SUITE 2210, CHICAGO, IL 60661 14 NEW ADDRESS ! Information Technology Solutions, Inc. 500 West Madison, Suite 2210 Chicago, Illinois, 60661 312.474.7700 312.474.9361 FAX NEW ADDRESS ! these in the future. In any case, be sure to Secondly, while our basic Makefile is (and probably will continue to be) BACKUP THE ORIGINAL MAKE- easily created/modified for each new kit, debated regarding performance FILES FIRST! we would be more inclined to create particularly. more such kits, if the process of putting the kit together (i.e. generating the • Shared libraries. This is what NeXT You might also consider modifying the Makefile) were as simple as Project- does with NEXTSTEP. This is useful basic ProjectBuilder templates (located Builder makes it for "normal" applica- (like the bundles approach described inside of its ".app" folder) in order to tion projects. Therefore, some kind of have your libraries (say, "libSuperDuper- above) for having common, shared code, "automated makefile generator" could be Kit.a") as a default library (much like which is dynamically loaded. used here. "libSys_s.a" and "libNeXT_s.a") for Additionally (this benefit is also present every new project that you start. Once in the bundle idea) this common code again, the warning is to BACKUP THE Finally, it's always nice to be able to could be changed, and all other ORIGINAL FILES FIRST! "see" your kit. By this I mean program- applications that use it would have the mers often want to view the relationship new and (hopefully) improved code between objects (in the case of an OO automatically! (Much like NeXT's Some other issues which I haven't environment, the class hierarchy). Some addressed here (but may in a future arti- tool for being able to quickly and easily famous claim about faxing in the Print cle) include such things as: Kit/Library look at your kit would be helpful. Dia- Panel.) documentation; an automatic kit/library gram! from Lighthouse Design is • Object repositories and class version makefile generator; and, a kit/library delightful, but manual. Who wants to management. This addresses the need to hierarchy viewer draw out class hierarchies by hand? maintain a history of revisions of code, and to restore previous versions as FUTURE DIRECTIONS In order to best facilitate the code re-use necessary. This is an item that must be that we advocate and that should be gen- There are future directions that code re- addressed regardless of the choice of erally encouraged, comprehensive docu- use might go in on the NEXTSTEP oper- strategies suggested above. Since mentation is a requirement. Program- ating system. We might talk about these mers must be able to look at, not only, the irrespective of how you share code, in future articles. Specifically, other code header files, but also, fully written class ultimately there will be the need to track re-use strategies might include: description files (such as those provided and manage revisions of code. by NeXT for its classes). While access to CONCLUSION the source code is okay, this should gen- • Using the ".subproj" as the basic unit of re-usability. This accommodates the erally be discouraged, since one of the • In conclusion, you can see how easy basic tenets of good object-oriented inclusion of ".nib" files as well as other resources such as sounds and images it is to get started with a simple code re- design is that each object is a "black box" use strategy right away. This will help to and the programmer should not design (which our current system, sadly, does address many of your needs to leverage around how an object does its work, only not accommodate.) off of previous work. As we continue what the results are. But...reality is real- • Using the ".bundle" as the basic unit ity, and typically, programmers "must" of re-usability. This accomplishes the with this (hopefully) series of articles, look at the source code. To work-around same as above, but also opens the and experiment (as is always required) this, we could use an "automatic docu- possibility of creating a "/LocalLibrary/ with new tactics, we will cover new and ment generator" that would create fully Bundles" folder which would contain better ways to re-use your older code formatted ".rtf" class description files bundles of re-usable code that can be and continue to improve your (much like NeXT's). dynamically loaded. This issue has been programming leverage! ! INFORMATION TECHNOLOGY SOLUTIONS, INC Object-Based Computing / December 1993 500 WEST MADISON, SUITE 2210, CHICAGO, IL 60661 13 Strategies for Re-use continued… Now...you want use your new library in build "fat" or "Multi-Architecture your latest project ("MyProject"). To do Binary" libraries for NEXTSTEP You can put your generic ".c" files (such this, go to your ProjectBuilder Release 3.1 and on. This requires only as functions) or ".m" files (such as cate- "PB.project" file, and select the "Librar- two minor changes: gories) on the "CFILES =" or "MFILES ies" category at the bottom of the first = " lines, as follows: column in the ProjectBuilder browser. CFLAGS = -Wall -g From the Files menu, select the "Add..." CFILES = ReallyWickedFunctions.c should be changed to: EvenMoreFunctions.c command to add your new library. Find your library ("/LocalDeveloper/Librar- MFILES = ZippyCategory.m CFLAGS = -Wall -g -arch m68k -arch ies/lib SuperDuperKit.a") in the "Add" i386 As with the class files above, the header panel browser, and click "OK". in order to specify the various (in this files don't need to be explicitly listed. case two) architectures you want to build Now, one final addition and you're ready for. Next, for any headers such as protocol to fly. If already have a "Makefile.pream- declarations, or files that simply define ble" file in your project, then add the fol- And this: macros or, enums, or new types, you lowing line: must list the header on the "HEADERS = $(LIB):$(OFILE_DIR) $(OFILES) " line: OTHER_CFLAGS = -I/LocalDeveloper/ ar rc $(LIB) $(OFILES) Headers -L/LocalDeveloper/ HEADERS = $(CLASSES:.m=.h) Libraries should be changed to: $(MFILES:.m=.h) $(CFILES:.c=.h) If you don't have a Makefile.preamble SuperNeatProtocol.h already, create one with Edit, and add $(LIB):$(OFILE_DIR) $(OFILES) ReallySpecialMacros.h libtool -o $(LIB) -s - $(OFILES) UnbelievableTypedefs.h this line. This enables your project Makefile to find the new library or librar- Using NeXT's new "libtool" program to Finally, you have to specify the name of ies that you have specified, as well as any properly build your libraries. There are the directory in the "Headers" folder, that headers, of the form: certain bugs with "ar" as used previously, all of the headers (including a pre-com- when applied to "fat" libraries. What I piled header) for this kit will be put in. In #import <SuperDuperKit/ might suggest, for the time being, if you this case: MyCoolView.h> are transitioning from 3.0 to 3.1, is creat- Now your ready to go, use anything ing a "Makefile_3.0"