CS136 Lecture Notes - Lecture 12: Information Hiding, In C, Data Structure

71 views6 pages

Document Summary

For consistency, always have (# include my-module. h ) even in (my-module. c: my-module. c, my-module. h, client. c. Prevent the client from tampering with data used by the module. Ensure only way the client can interact with the module is through the interface: flexibility. Can change the implementation freely, updates and lots. Avoid client to write based on implementation, which create error when implementation is changed: in c. C is not very good at hiding data. Can simply guess the memory address of some data. Opaque structures: good for hiding data from a friendly client, like a black box , incomplete declarations (a struct is declared without any fields) Incomplete declarations (a struct is declared without any fields) Opaque, structure details hidden away > client cannot access: full structure definition in implementation file + incomplete structure in the interface. Transparent, structure details available to all: full structure definition in interface. Data structure & abstract data types: as clients doesn"t know how data was structured.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents