Skip to content

Instantly share code, notes, and snippets.

View SheffieldKevin's full-sized avatar

Kevin Meaney SheffieldKevin

View GitHub Profile
import Foundation
/*
Lets suppose you have a class called "Action" which has to represent an user action in a drawing app. There are a fixed number of different actions: Delete, Add, Modify. Some of those action types have different properties. For example:
If the user adds something, the add action contains "what" the user has added and the "content" of the new object.
If the user modifies something, the modify action contains "what" has been edited, the "previousContent" and the "newContent".
So there are basically at least three different approaches how you can model that. Which one is the best?