Question

In: Computer Science

Why is is useful to enforce the separation of interface from implementation (i.e., the abstraction boundary)...

Why is is useful to enforce the separation of interface from implementation (i.e., the abstraction
boundary) of an ADT? Provide a concrete example to help justify your explanation

Solutions

Expert Solution

It is useful to enforce, thanks to these points:

  • Majority of the program becomes independent of the abstract data type's representation, in order that representation may be improved without breaking the complete program.
  • Thanks to the separation of interface from implementation, the different parts of a program become less dependent on other parts and on how those other parts are implemented.
  • It becomes easier for every part of a program to use an implementation of its data types which will be more efficient for that specific part of the program.

Real life Example: Mobile Phones

Abstract view

  • 6 GB RAM
  • Snapdragon 845
  • 6.5 inch Super Amoled Screen
  • Quad Camera
  • Android Pie

Call(), Timer(), Calculator(), Camera(), Video(), Voice_Recorder()

Implementation View

Class mobilePhones{

private:

int ramSize;

string processorName;

float screenType;

int cameraCount;

string androidVersion;

public:

void call();

void timer();

void calculator();

void camera();

void video();

void voice_recorder();

};

Overall, the separation of data structures and operations and the constraint to only access the data structure via a well-defined interface allows to choose data structures appropriate for the application environment.


Related Solutions

What is the difference among the principles of modularization, abstraction, encapsulation, and separation of interface and...
What is the difference among the principles of modularization, abstraction, encapsulation, and separation of interface and implementation. Please provide with related examples. #Course: Software Engineering
Would a Balanced Scorecard be useful to an organization's strategy implementation process? Why? Is so, should...
Would a Balanced Scorecard be useful to an organization's strategy implementation process? Why? Is so, should an organization use it?
CAPM can trace its development from Portfolio Theory (i.e. the two fund separation theorem) which shows...
CAPM can trace its development from Portfolio Theory (i.e. the two fund separation theorem) which shows that the process of optimizing the return/risk ratio will ensure that every investor will invest in a portfolio of risk free asset and the risky market portfolio (also known as the two fund separation theorem). Explain and illustrate why no one will invest in other risky portfolios other than the market portfolio. What is the special property of this market portfolio? (Hint: a graph...
1. How does accounting profit differ from economic profit? Explain why accounting profit is more useful...
1. How does accounting profit differ from economic profit? Explain why accounting profit is more useful for paying your taxes while economic profit is more useful for deciding whether you should continue to stay in business. Give an example of an implicit cost and an example of implicit revenue. 2. What is the distinction between the microeconomic short run and the microeconomic long run? How do these definitions relate to specific periods of calendar time?
(1) ABC is a regular corporation – i.e., not an S corporation. On your 2019 Form 1040, you will report ___ of gross income from ABC. Why is that the correct amount?
(1) ABC is a regular corporation – i.e., not an S corporation. On your 2019 Form 1040, you will report ___ of gross income from ABC. Why is that the correct amount? (2) Your favorite hobby is fishing. Last week you entered a fishing contest and – Wow! – caught the biggest fish and won the $25,000 grand prize. But you’re also a partner in a Big 4 accounting firm and make almost $500,000 a year there, so another $25,000?...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT