The resin is a porous, insoluble exchange material. The resin water treatment facility contains millions of fine resin balls (beads), all of which contain many negative charge exchange sites for absorbing positive ions. These charge exchange sites are occupied by positively charged sodium ions when the resin is in a nascent state. When calcium and magnesium pass through the resin sump, they come into contact with the resin beads, replacing sodium ions from the exchange sites. The resin preferentially binds to a strongly charged cation, and the charge of calcium and magnesium ions is stronger than that of sodium ions. So the resin machine generate soft water.
And compared to RO system which would produce lot of waste water, resin is a better choice applying water treatment.