This question has been asked first on Stack Overflow, I've been told that this forum would be more appropriate
I am wondering what's the recommended way to solve the following situation :
- I have items, Cars which have a color and a car model property
- When a customer choses a car on the carmaker website (the one I am in charge of), an image is sent back to his browser for visualization
- So, I logically have a database which stores an image file path for every brand/color combination, that I query any time a request is made.
Right now, the carmaker wants to implement additional color choices, which are really close to existing ones, let's say crimson and firebrick in addition to an existing darkred. For visualization purposes, we use the image of darkred for the three colors.
So, here is my question, I can think of two ways of implementing this change :
- Either I hardcode into the ImageManager class (or its config object), the class in charge of retrieving images from the database, that darkred, firebrick, and crimson colors are all refering to darkred when queried
- Either, I keep everything as it is and I just append new rows into the existing datatable pointing all new colors/car model combinations to an existing image (this is a lot of rows).
From your point of view, what'd be the best design choice and why? I am wondering about coupling, future evolutions and maintenance.