If you violate the walls of an ADT in a program, will the program run? The wall is basically all the operations right?
I am just reading about this and want to make sure I understand it. :confused:
Thanks!!!
Printable View
If you violate the walls of an ADT in a program, will the program run? The wall is basically all the operations right?
I am just reading about this and want to make sure I understand it. :confused:
Thanks!!!
I'm not sure what you mean by "the walls."
if you were to ........ one of the operations or any function by say sending invalid parameters, it may crash, it depends how you handle it. You can have it crash, or you can do some error checking and have the operation/function do nothing.Quote:
The wall is basically all the operations right?
If you mean memory bounds of an ADT, it will hopefully crash when you're debugging, and will definitely crash if try accessing NULL pointers. If you run it in some sort of release mode or a stand alone exe, the chances of it crashing are lower. At that point, the OS has to tell you if the program is pointing somewhere it shouldn't.
use exceptions :)
>If you violate the walls of an ADT in a program, will the program run?
Yes, it just may not run if any changes are made to the ADT. The wall is basically data hiding. The client has no idea about the internal workings of an ADT, just the interface. As long as the client only uses the interface, the ADT can change its implementation drastically provided the interface never changes. If the client relies on knowledge of the ADT's internal workings, the wall collapses and the code becomes brittle. Any changes to the ADT could potentially break all code that relies on a certain implementation.