robinhood / ticker

An Android text view with scrolling text change animation
https://medium.com/robinhood-engineering/hello-ticker-20eaf6e51689
Apache License 2.0
4.38k stars 462 forks source link

Stop extending ArrayList in TickerColumnManager #5

Closed mandrizzle closed 8 years ago

mandrizzle commented 8 years ago

This is a textbook example for using composition over inheritance. By extending ArrayList, we were adding a bunch of unnecessary methods to this classes contract that is not needed. On top of that, it would be strange, and confusing, if someone was to do List<TickerColumn> columns = new TickerColumnManager().

With this change, we are keeping the contract of this class concise and a lot easier to maintain in the future since we would not have to worry about maintaining the ArrayList contract.