Theory of dwarf galaxies