Property or Method

As we have seen, properties are for data and methods are for operations.

Here are some guidelines to help us with decision property or methods.

Property

  • Does it describe data? for example, product name and description.
  • Does it execute quickly, 

Method

  • Does it describe processing? for example, place an order. 
  • Does it produce side effects?
  • Does it require a parameters? 

Comments

Popular posts from this blog

Method Overloading

Building a Method