毕业论文

打赏
当前位置: 毕业论文 > 外文文献翻译 >

基于对象的编程评估英文文献和中文翻译(3)

时间:2022-07-14 22:38来源:毕业论文
Visual Basic does well in this area。 When Visual Basic invokes a method, it can pass standard data types, user-defined data types, and a flexible data type called variant。 Methods are implemented

Visual Basic does well in this area。 When Visual Basic invokes a method, it can pass standard data types, user-defined data types, and a flexible data type called variant。 Methods are implemented with subroutines or functions。 One limitation of functions is that they can not return a user defined data type。

Visual Basic provides the capability of defining methods (functions and subroutines) as private。 As in C + + , this prevents any other objects from invoking these methods。  Data can also be hidden from other objects。 However, with user defined data types only their data can be hidden, and not the type itself。

Modularity: The concepts of coupling and cohesion apply as well to object-oriented programming as they do to procedure- oriented programming [Myers 78]。 Booch says "Modularity is the property of a system that has been decomposed into a set of cohesive and loosely coupled modules" [Booch 94]。

Visual Basic does as well here as any of the OOP languages。 In fact, it does better than Smalltalk, where the class defines the only level of modularity [Booch 94] 。 Methods can be easily grouped together into  objects。

According to Booch, there is a tension between coupling and inheritance [Booch 94]。 Since Visual Basic does not support inheritance, it lends itself to weak coupling, which is good。

One notable nuisance relating to coupling is that when any change is made to a module, every projeci that includes that module must be recompiled。

Hierarchy: This refers to  the  ability  to organize abstractions into a hierarchy。 Booch claims that a set of real world abstractions  often defines  a hierarchy。  He defines hierarchy  as a ranking or ordering of abstractions。 Classes are used to define abstractions。 Inheritance defines the relationship  that classes have with one another,  usually  a hierarchy。

For example, a class in the banking industry might be Bank Account。 The methods associated with Bank Account may be Withdraw and Deposit。  Other classes might include Checking

Account and Savings Account。 These are more specific abstractions of Bank Account, therefore Checking Account and Savings Account are children of Bank Account。

When a method is needed at runtime, the associated class is searched for the method。 If it is not found, the parent is then searched。 In this way, the Checking Account only has to have methods that are unique to checking。

This is the element that precludes Visual Basic from being a true object-oriented language。 Visual Basic does not have classes or inheritance。 Although it has objects, the objects are not hierarchical in this way。

Now we will consider the minor elements of Booch’s   model。

Typing: Although Booch acknowledges that the concept of type and class are technically distinct, he uses the two concepts interchangeably in this context。 By typing, he is referring more to abstract data types than traditional data typing。 According to Booch, typing is the enforcement of the class of an object, such that objects of different types may not be interchanged, or at the most, they may be interchanged only in very restricted ways。 In other words, when you declare a variable, function, or user defined data-type, you must specify a type。

Visual Basic can be either strongly typed or weakly typed, depending on the use of the variant data-type。 If you don’t use the variant data-type, Visual Basic is strongly typed。 A variant is a special data type that can contain numeric, string, and date information。 Variant is the default data type if none is specified。

Concurrency: In a running object-oriented application, each object that represents a "live" thread of control is called active。 Concurrency is the property that distinguishes an active object from one that is not active [Booch 94)。 Visual Basic is concurrent。 For example, the Absence Tracking System (see Section IV) uses a timer routine to update the displayed time and date every 60 seconds。 基于对象的编程评估英文文献和中文翻译(3):http://www.youerw.com/fanyi/lunwen_96426.html

------分隔线----------------------------
推荐内容