If you are amplifying DC, 0-5v, and only care about positive gain, you can use an opamp + 1 NPN transistor per bit on the feedback with 1k, 2k, 4k, 8k for 4 bit programmable gain, feeding the bases, with series resistor, in parallel from your MCU's digital outputs. Mosfets will work too, but, their output capacitance may add gain at truly, really, high frequencies when they are off and their on-resistance at 5v becomes a factor.
The more transistor/resistor bits, the more programmable steps in your gain, plus, the more IOs you need. With quality 1% resistors and simple 2N3904s, you will achieve repeatable, predictable, reliable results.