Increased Data Flexibility: Using Hash for Initialize Argument

Emily Ekdahl
1 min readFeb 28, 2017

Here’s a way to structure your class such that a new data type is less likely to break your code:

So, as you can see above, introducing brand when creating a new store item, item2, doesn’t impact the Class’s ability execute. Data flexibility for the win!

--

--