What's the difference between data and code?

前端 未结 13 734
青春惊慌失措
青春惊慌失措 2020-12-13 10:52

To take an example, consider a set of discounts available to a supermarket shopper.

We could define these rules as data in some standard fashion (lists of qualifyin

13条回答
  •  -上瘾入骨i
    2020-12-13 11:28

    The best practical answer to this question I found is this: Any class that needs to be serialized, now or in any foreseeable future, is data. Everything else is code. That's why, for example, Java's HashMap is data - although it has a lot of code, API methods and specific implementation (i.e., it might look as code at first glance).

提交回复
热议问题