I am using Scala for my example but I believe this probably could apply anywhere.
Say I am using a class somewhere in my project that reads in data from a live stream of events which monitors where a player is in a 2D game at any given moment.
case class Player(player_id: String, time: Long, age: Int, color: String, position_x: Int, position_y: Int)
I then take this live data and store it in a database.
Now somewhere else in a different part of my project I want to collect a series of data related to the player and run some calculations on it involving the player_id, time, position_x, and position_y fields. But because my Player class has age, and color I will have to set these to 0, and null respectively as I do not care about those fields. So it is providing to be unnecessarily bulk (in this example its not much data but in my actual project my class has many other attributes that I would need to ignore and set which increases the memory load unnecessarily)
What would be the best practice for this then or alternative?
Would I create a new class like
case class PlayerLimitedData(player_id: String, time: Long, position_x: Int, position_y: int)
I could see this could easily get out of control in other places in my project where I need to run statistics where I just need a view piece of information about a player and not all the information.