DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2006

    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

  2. #2
    Join Date
    Dec 2003
    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

  1. to use or not to use SingleThreadModel?
    By ashiers in forum Java
    Replies: 0
    Last Post: 09-09-2005, 11:17 AM
  2. Test Java samples in fly
    By mark9876 in forum Java
    Replies: 0
    Last Post: 03-24-2005, 10:57 PM
  3. Tree View - Hit Test Question
    By DevX in forum .NET
    Replies: 2
    Last Post: 03-06-2002, 01:21 PM
  4. Top fixed screen
    By Cheng in forum Web
    Replies: 1
    Last Post: 11-06-2001, 09:43 AM
  5. Script for scrolling
    By Mark in forum Web
    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
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.