Abstraction

Abstraction is a basic concept in computer programming. It means that **you don’t need to know how to achieve a function, but only know how to use it and what can it do.

For example, function itself is a type of process abstraction. It contains only a small step of the whole program, but you can use it repletely with a unified interface. When combining several functions together, an algorithm forms. Thus, function is the abstraction of algorithm, which decomposed a sophistic procedure into multiple basic steps.

Also, data structures like list, tuple, dictionary are data abstraction. They provide different methods for you to modify data, without actually realize how it work, but only know how to make them work for you. For instance:

>>> list1 = [1,2,3,4]
>>> list1[1]
>>> 2

You create a list and want to check the value of index one. You may don’t know what the real address of this info actually storage, but you can check it with the property of list object.

Thus, abstraction has several advantages:

  1. reduce complexity. Once you complete a function, you don’t have to spend efforts on it; also, when you are writing a function, you don’t need to care other things as well
  2. Improves Maintainability. Since your program is composed by some function modules, it is easy to find out where the bugs are, and fix them without influence other functions
  3. Increases Reusability. Once you create a function, you can reuse it at anytime at anywhere.
  4. Facilities Teamwork. If interface rules are unified among the group, every member can develop their own functions without knowing how others achieve them, which benefits simultaneous work.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *