-
Please help me answer a chalenging test question
What is the main reason for not violating the walls of an Abstract Data Type (ADT) in an application program? Before answering this be certain you understand what it means to violate the walls of an ADT.
a. the program won't run
b. the information about the ADT should be private
c. a change in ADT implementation requires a change in the application program
d. a change in ADT implementation requires that the application program be recompiled
Many thanks
-
since its just one question and its multiple choice, I see no harm here.
The best choice appears to be C. The point of an ADT is you use it and don't care about the implementation details. By "hacking into" the details, a program is vulnerable to needing modifications every time the ADT is changed, which is bad at many levels (a variable you used might be deleted, or have a different value set, etc -- your program may now have hard to find bugs or fail to compile or have undefined behavior or who knows what).
A -- not true, until you re-compile it. Possible true if you do re-compile, but thats less important than the man-hours required to fix all the user programs every time the ADT module is changed. This answer just does not cover the heart of the matter -- its a cop out that tells your professor "I dont know"
B. It may or may not be private (yes, it should be) -- C++ lets you get around privacy with pointers and hackery, so private or not, you can still break down the walls and make a mess if such is your intention. This answer, while "correct" does not cover the question.
D. This is a good answer - but its more than this. A re-compile is needed if the ADT change fixed a bug, even if you just used it "correctly". You don't have to maintain your program, and that is why C is a better choice.
Similar Threads
-
Replies: 0
Last Post: 09-09-2005, 11:17 AM
-
By mark9876 in forum Java
Replies: 0
Last Post: 03-24-2005, 10:57 PM
-
Replies: 2
Last Post: 03-06-2002, 01:21 PM
-
Replies: 1
Last Post: 11-06-2001, 09:43 AM
-
Replies: 3
Last Post: 08-30-2001, 11:45 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks