Cost of abstraction

  1. 1. Definition - cost of abstraction
  2. 2. Thought

Duplicate is definitely something we are trying to get rid of, however, what’s the cost of abstraction? It seems some problem we could think for a while.

We should think of the tradeoff between code duplication and increased level of abstraction.

1. Definition - cost of abstraction

  • An abstraction is adding to the cognitive load of whoever works with the code
  • The main cost of abstraction: separating the implementation from the specification. Or we say separate the letter of function from the spirit of the function
  • The former being what the function does, the latter being what everybody believes it should do
  • Should involve everybody to consider what the code does, or we say what the function does

2. Thought

  • The decision about creating an abstraction should not be taken lightly.
  • There’s a large social cost to every abstraction, may lead the project to be unmaintainable.
  • lambda is also a way to reduce the abstraction layers in some way
  • Abstraction is a good way to get rid of verbose code, but itself may bring uncertainty to some extent. Only implement necessary abstraction.

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 stone2paul@gmail.com

文章标题:Cost of abstraction

文章字数:183

本文作者:Leilei Chen

发布时间:2020-02-05, 01:08:47

最后更新:2020-02-05, 01:09:17

原始链接:https://www.llchen60.com/Cost-of-abstraction/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏