The paper studies a discrete counterpart of Gerber et al. (2006). The surplus of an insurance company (before dividends) is modeled as a time-homogeneous Markov chain with possible changes of size + 1, 0, - 1, - 2, - 3, .... If a barrier strategy is applied for paying dividends, it is shown that the dividends-penalty identity holds. The identity expresses the expected present value of a penalty at ruin in terms of the expected discounted dividends until ruin and the expected present value of the penalty at ruin if no dividends are paid. For the problem of maximizing the difference between the expected discounted dividends until ruin and the expected present value of the penalty at ruin, barrier strategies play a prominent role. In some case...