In this paper we present a critical discussion of the algorithms commonly u
sed in N-body simulations of galaxy formation to deal with the energy equat
ion governing heating and cooling, to model star formation and the star for
mation rate, and to account for the energy feedback from stars. First, we p
ropose our technique for solving the energy equation in the presence of hea
ting and cooling, which includes some differences with respect to the stand
ard semi-implicit techniques. Secondly, we examine the current criteria for
the onset of the star formation activity. We suggest a new approach, in wh
ich star formation is allowed to depend on the total mass density - baryoni
c (gas and stars) and dark matter - of the system and on the metal-dependen
t cooling efficiency. Thirdly, we check and discuss the separate effects of
energy (and mass) feedback from several sources - namely supernovae, stell
ar winds from massive stars and ultraviolet flux from the same objects. All
the simulations are performed in the framework of the formation and evolut
ion of a disc galaxy. We show that the inclusion of these physical phenomen
a has a significant impact on the evolution of the galaxy models.