Review of Object Oriented Programming (OOP) Principles

Object-Oriented Programming (OOP) Principles

You only need to review the video, below, if need a refresher on basic classes and methods in java.



Why You Should Avoid Parallel Array Structures

Here are some articles explaining why you should avoid parallel arrays and use classes and objects to encapsulate your date:

https://www.dreamincode.net/forums/topic/147196-moving-away-from-parallel-arrays/
https://codeblog.jonskeet.uk/2014/06/03/anti-pattern-parallel-collections/
https://stackoverflow.com/questions/5347338/why-use-parallel-arrays-in-java

Things to consider with parallel arrays:

  1. Parallel arrays do not scale: If there is a corrupt (or missing) data item, not only is the current item corrupted but potentially all the remaining items on the list could be corrupted or have the wrong indices.
  2. If you have to add a new field, you have to add a new array.
  3. Reordeing is more complicated because all the arrays have to be reordered in unison.

Review Questions on Object Oriented Programming and Encapsulation



TBD