C#C
C#3y ago
__dil__

❔ Design question

Hi! I'm a beginner and I'm having trouble finding a decent design for this toy application I'm making.

So, at a high level, I have a list of items, and I'd like to let the user filter the items and only display the relevant ones. So far so good, but the complexity comes from the fact that the items in my case come in many variants (let's call them A, B, C, etc. for the sake of the discussion). Item variants are definitely related in terms of the domain, but they are fairly unrelated when it comes to the data itself. So, A might have a little bit in common with C, B might have a little in common with A, etc. There's very little that is common to all the variants.

So, all the items should live in the same list to be filtered, but the filter might refer to a field that doesn't even exist on a specific variant (in that case it should be excluded). Furthermore, once the items have been filtered, it should be possible to select a particular item and see all the data specific to that variant. So I need some sort of downcasting mechanism.

I'm sorry if this sounds confusing, well I am confused :/
Was this page helpful?