Is there some literature on this type of programming?

前端 未结 8 727
[愿得一人]
[愿得一人] 2021-02-01 05:56

In college I took on a class on modern physics, in which we learned about special relativity. I was completely blown away by how different frames of reference could actually ob

8条回答
  •  臣服心动
    2021-02-01 06:33

    What you're doing is separating the data of the concept from the operations that act on that concept. What the system is from what the system does. This opens the door for many different scenarios, in which you change the behavior of the system by using different behavior classes. These behavior classes can also be reusable for different data classes. Many patterns address this problem, like Visitor, Command, Strategy, or Observer.

    But there's something deeper at play here. Maybe we need another concept in our (mainstream) programming languages (or maybe just in our minds), that will allow us to separate, and reuse, these bahaviors.

    The DCI architecture addresses these issues, and presents roles, or traits (pdf), as the fundamental unit of behavior and code reuse.

提交回复
热议问题