Lessons:24Length:2.4 hours
  • Overview
  • Transcript

3.12 Replace Array with Object

Many times we think we are making things easier by sticking to primitives (such as Array or Hash) to represent our data. You quickly learn that it’s harder to test and operate on top of primitives because they are just that: primitives. You can’t extend on them, create new messages or interact effectively. Encapsulation is broken as every piece of data is accessible, and so there’s no privacy. There is no interface; no collaboration.

In this lesson, you learn how to turn Array or Hash “objects” into proper objects, and how to accommodate that decision in your codebase.