The problem of finding the optimal dividend strategy is very important for insurance companies. In order to solve this problem a discounted cash flow model has been used which is a special case of valuation models. We analyse the surplus of an insurance company with attention focused on probability of ruin. The usual strategy of insurers to allow the surplus go to infinity in order to avoid ruin has been crticised by several economists (De Finetti and others) as too conservative. In the paper we discuss the so-called barrier strategy for treating the surplus of an insurance company and show how dividends are paid out in the case the surplus is greater than a predetermined value of the barrier. Using the results in (1(and  we present the expected discounted sum of dividends and show for which value of the barrier this sum will attain the greatest value. In the first part of the paper the problem is analysed in details provided that claims are exponentially distributed. The purpose of the paper is to solve the same situation, however, for the so-called large claims. It is well known that the ruin problem which is closely related to the dividend strategy problem leads to different results for such claims. On the other hand insurance companies are now confronted with such claims more often than before. Let us mention catastrofic floods, earthquakes, etc. which cannot be modelled by exponential and similar distributions. The problem of non-identically distributed claims is also treated. The last section of the paper deals with the question how the dividend strategy should be changed after ruin happens. A solution is mentioned suggested by several actuaries that instead of maximizing the expected discounted sum of dividends the difference between them and the deficit at ruin should be maximized. At the end our attention is paid to the questions of parameter estimation and the choice of a proper claim distribution.