面向对象设计外文翻译
《面向对象设计外文翻译》由会员分享,可在线阅读,更多相关《面向对象设计外文翻译(6页珍藏版)》请在毕设资料网上搜索。
1、附录 A 外文翻译 原文部分 Everything Is an Object “If we spoke a different language, we would perceive a some what different world.” Ludwig Wittgenstein (1889-1951)Although it is based on C+, Java is more of a “pure” object-oriented language. Both C+ and Java are hybrid languages, but in Java the designers fel
2、t that the hybridization was not as important as it was in C+. A hybrid language allows multiple programming styles; the reason C+ is hybrid is to support backward compatibility with the C language. Because C+ is a superset of the C language, it includes many of that languages undesirable features,
3、which can make some aspects of C+ overly complicated. The Java language assumes that you want to do only object-oriented programming. This means that before you can begin you must shift your mindset into an object-oriented world (unless its already there). The benefit of this initial effort is the a
4、bility to program in a language that is simpler to learn and to use than many other OOP languages. In this chapter youll see the basic components of a Java program and learn that (almost) everything in Java is an object. You manipulate objects with references Each programming language has its own me
5、ans of manipulating elements in memory. Sometimes the programmer must be constantly aware of what type of manipulation is going on. Are you manipulating the element directly, or are you dealing with some kind of indirect representation (a pointer in C or C+) that must be treated with a special synta
6、x? All this is simplified in Java. You treat everything as an object, using a single consistent syntax. Although you treat everything as an object, the identifier you manipulate is actually a “reference” to an object. You might imagine a television (the object) and a remote control 1(the reference).
7、 As long as youre holding this reference, you have a connection to the television, but when someone says, “Change the channel” or “Lower the volume,” what youre manipulating is the reference, which in turn modifies the object. If you want to move aroundthe room and still control the television, you
8、take the remote/reference with you, not the television. Also, the remote control can stand on its own, with no television. That is, just because you have a reference doesnt mean theres necessarily an object connected to it. So if you want to hold a word or sentence, you create a String reference: Bu
9、t here youve created only the reference, not an object. If you decided to send a message to s at this point, youll get an error because s isnt actually attached to anything (theres no television). A safer practice, then, is always to initialize a reference when you create it:String s = asdf;However,
10、 this uses a special Java feature: Strings can be initialized with quoted text. Normally, you must use a more general type of initialization for objects. Where storage lives Its useful to visualize some aspects of how things are laid out while the program is runningin particular how memory is arrang
11、ed. There are five different places to store data: 1. Registers. This is the fastest storage because it exists in a place different from that of other storage: inside the processor. However, the number of registers is severely limited, so registers are allocated as they are needed. You dont have dir
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中设计图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 面向 对象 设计 外文 翻译
