title: OO Design pattern for shopping cart
body: <p>I am trying to learn oo design pattern and developing shopping cart application where different cart items will have different types. Each type is will have some additional attributes. </p>
  
  <p>Option 1: Is it good to create a separate class with every cart item with their own attributes and common attributes in base class. In this option, I will have to create multiple classes and corresponding table hierarchy in the database. </p>
  
  <p>Option 2: Create single cart item with type attribute which will identify the type of the attribute. Irrelevant attributes for the particular cart item will be null in this case.</p>
  
  <p>I know this is very basic question but I want to know about how people follow best practices.</p>
  
  <p>Thanks in advance.</p>