正在加载图片...
$22.1 STUDYING A REQUIREMENTS DOCUMENT 723 If all of the operations and properties that you can identify for a type of objects are irrelevant in this sense,or are already covered by the operations and properties of a previously identified class,the conclusion is that the object type itself is irrelevant:it must not yield a class. This explains why an elevator system might not include FLOOR as a class because (as noted above)from the point of view of the elevator system floors have no relevant properties other than those of the associated integer numbers,whereas a Computer Aided Design system designed for architects will have a FLOOR class-since in that case the floor has several specific attributes and routines. Missing important classes Not only can nouns suggest notions which do not yield classes:they can also fail to suggest some notions which should definitely yield classes.There are at least three sources of such accidents. Do not forget that,as noted,the aim of this discussion is no longer to convince ourselves of the deficiencies of the"underline the nouns"approach,whose limitations are by now so obvious that the exercise would not be very productive.Instead,we are analyzing these limitations as a way to gain more insight into the process of discovering classes. The first cause of missed classes is simply due to the flexibility and ambiguity of human language-the very qualities that make it suitable for an amazingly wide range of applications,from speeches and novels to love letters,but not very reliable as a medium for accurate technical documents.Assume the requirements document for our elevator example contains the sentence A database record must be created every time the elevator moves from one floor to another. The presence of the noun"record"suggests a class DATABASE RECORD;but we may totally miss a more important data abstraction:the notion of a move between two floors.With the above sentence in the requirements document,you will almost certainly need a MOVE class,which could be of the form class MOVE feature initial,final:FLOOR. --Or INTEGER if no FLOOR class record (d:DATABASE)is .. ..Other features... end--class MOVE This will be an important class,which a grammar-based method would miss because of the phrasing of the above sentence.Of course if the sentence had appeared as A database record must be created for every move of the elevator from one floor to another.§22.1 STUDYING A REQUIREMENTS DOCUMENT 723 If all of the operations and properties that you can identify for a type of objects are irrelevant in this sense, or are already covered by the operations and properties of a previously identified class, the conclusion is that the object type itself is irrelevant: it must not yield a class. This explains why an elevator system might not include FLOOR as a class because (as noted above) from the point of view of the elevator system floors have no relevant properties other than those of the associated integer numbers, whereas a Computer Aided Design system designed for architects will have a FLOOR class — since in that case the floor has several specific attributes and routines. Missing important classes Not only can nouns suggest notions which do not yield classes: they can also fail to suggest some notions which should definitely yield classes. There are at least three sources of such accidents. Do not forget that, as noted, the aim of this discussion is no longer to convince ourselves of the deficiencies of the “underline the nouns” approach, whose limitations are by now so obvious that the exercise would not be very productive. Instead, we are analyzing these limitations as a way to gain more insight into the process of discovering classes. The first cause of missed classes is simply due to the flexibility and ambiguity of human language — the very qualities that make it suitable for an amazingly wide range of applications, from speeches and novels to love letters, but not very reliable as a medium for accurate technical documents. Assume the requirements document for our elevator example contains the sentence The presence of the noun “record” suggests a class DATABASE_RECORD; but we may totally miss a more important data abstraction: the notion of a move between two floors. With the above sentence in the requirements document, you will almost certainly need a MOVE class, which could be of the form class MOVE feature initial, final: FLOOR; -- Or INTEGER if no FLOOR class record (d: DATABASE) is … … Other features … end -- class MOVE This will be an important class, which a grammar-based method would miss because of the phrasing of the above sentence. Of course if the sentence had appeared as A database record must be created every time the elevator moves from one floor to another. A database record must be created for every move of the elevator from one floor to another
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有