正在加载图片...
34 Emulating object technology in non-O-O environments ran.Cobol.Paseal,C.Basic.PLI and even assembly anguage still accout for large part of the software being written or updated today.Clearly,a project using one of these languages will not be able to draw the full benefits ofobject technology,as this would require a notation such as the one we have studied in this book,and the supporting compiler,environment and libraries.But people who are required to use pre-O-O tools, often because of non-technical constraints,can still gain inspiration from object technology and use some of its concepts to improve the quality of their software development. This chapter presents the techniques of object emulation that may enable you to approximate some of object technology.It will particularly examine the case of Fortran, Pascal and C.(Ada and other encapsulation languages were discussed in the preceding chapter;the following one covers O-O languages such as Simula,Smalltalk,Objective-C, C++and Java.)This presentation will be directly applicable if you must use one of these languages.But it extends further: If you use another non-O-O language not on this list,such as Basic or Cobol,you should not have too much trouble transposing the concepts. Even if you are able to use an O-O language,the following discussion can give you a better grasp of the innovations of object technology and of the supporting implementation techniques(which often make use,internally,of older languages). 34.1 LEVELS OF LANGUAGE SUPPORT In assessing how programming languages succeed in supporting object-oriented concepts, we may distinguish three broad categories(ignoring the lowest level,mostly containing assembly languages,which does not even support a routine construct): The functional level comprises languages whose unit ofdecomposition is theroutine, a functional abstraction capturing a processing step.Data abstraction is handled,if at all,through definitions of data structures,either local to a routine or global. Languages at the encapsulation level provide a way to group a set of routines and data declarations in a syntactical unit,called a module or package;typically each unit can be compiled separately.This was discussed in some detail for Ada.34 Emulating object technology in non-O-O environments Fortran, Cobol, Pascal, C, Basic, PL/I and even assembly language still account for a large part of the software being written or updated today. Clearly, a project using one of these languages will not be able to draw the full benefits of object technology, as this would require a notation such as the one we have studied in this book, and the supporting compiler, environment and libraries. But people who are required to use pre-O-O tools, often because of non-technical constraints, can still gain inspiration from object technology and use some of its concepts to improve the quality of their software development. This chapter presents the techniques of object emulation that may enable you to approximate some of object technology. It will particularly examine the case of Fortran, Pascal and C. (Ada and other encapsulation languages were discussed in the preceding chapter; the following one covers O-O languages such as Simula, Smalltalk, Objective-C, C++ and Java.) This presentation will be directly applicable if you must use one of these languages. But it extends further: • If you use another non-O-O language not on this list, such as Basic or Cobol, you should not have too much trouble transposing the concepts. • Even if you are able to use an O-O language, the following discussion can give you a better grasp of the innovations of object technology and of the supporting implementation techniques (which often make use, internally, of older languages). 34.1 LEVELS OF LANGUAGE SUPPORT In assessing how programming languages succeed in supporting object-oriented concepts, we may distinguish three broad categories (ignoring the lowest level, mostly containing assembly languages, which does not even support a routine construct): • The functional level comprises languages whose unit of decomposition is the routine, a functional abstraction capturing a processing step. Data abstraction is handled, if at all, through definitions of data structures, either local to a routine or global. • Languages at the encapsulation level provide a way to group a set of routines and data declarations in a syntactical unit, called a module or package; typically each unit can be compiled separately. This was discussed in some detail for Ada
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有