We first review the results of the tidal stirring model for the transformation of gas-rich dwarf irregulars into dwarf spheroidals, which turns rotationally supported stellar systems into pressure supported ones. We emphasize the importance of the combined effect of ram pressure stripping and heating from the cosmic ultraviolet background in removing the gas and converting the object into a gas poor system as dSphs. We discuss how the timing of infall of dwarfs into the primary halo determines the final mass-to-light ratio and star formation history. Secondly we review the results of recent cosmological simulations of the formation of gas-rich dwarfs. These simulations are finally capable to produce a realistic object with no bulge, an exponential profile and a slowly rising rotation curve. The result owes to the inclusion of an inhomogeneous ISM and a star formation scheme based on regions having the typical density of molecular cloud complexes. Supernovae-driven winds become more effective in such mode, driving low angular momentum baryons outside the virial radius at high redshift and turning the dark matter cusp into a core. Finally we show the first tidal stirring experiments adopting dwarfs formed in cosmological simulations as initial conditions. The latter are gas dominated and have turbulent thick gaseous and stellar disks that cannot develop strong bars, yet they are efficiently heated into spheroids by tidal shocks.