In the first part of the paper, we make a brief review on the coding and programmable metasurfaces recently proposed at microwave and terahertz frequencies, which are realized by distributing coding particles “0” and “1” with opposite reflection phases on surfaces with certain coding sequences. The powerful manipulations to microwaves and terahertz waves using the coding and programmable metasurfaces are presented. In the second part of the paper, we propose a new coding scheme for the generation of ring-shaped radiation pattern. Different coding strategies are provided to demonstrate the flexible controls of the size, position, and number of rings in the radiation patterns, including changing the periodicity of the gradient coding sequence and adding it with one or multiple periodic sequences. A new structure featuring low electromagnetic interference and ultrahigh efficiency is designed to implement the ring-shaped pattern, which shows highly consistent results to the theoretical results calculated by Fourier transform. We remark that such a ring-shaped radiation pattern may find a wide range of applications in radar detections.