I have the code but I want to be pseudo as possible so I learn from other ways as much as possible.
So what I am building is web based tool and in one section we have a table.
This table renders lines of data given it matches conditions.
So the way it works is user enters a number and based on that we out specific lines in the front end.
E.g
If(one) return lineA
If(two) return lineB . ...
You can see I already I need a minimum of two views but let's say there 20 separate conditions that means 20 separate views.
Then because it's accounting calculations these could be a combo of any, many or all.
The way I've currently done is as follows:
Calcs
If(one) return lineA
If(two) return lineB
If(one and two) return lineA + lineB
Delegation
If(one) return viewA
If(two) return viewA
If(one and two) return viewA + viewB
Views
viewA()
viewB()
Obviously you can see I'm going down spaghetti lane.
Is there anyway to make this work with few conditions as possible?
It would help if you've coded such tools before.
Do I/should I stop coding and draw a large matrix of all possible combos first?
I think these two are irrelevant here but: If it helps this is all done in JS and Angular.
If it helps this is for a accounting/finance tool.