Sometimes you need it sometimes you don’t. At first glance, and even at the fourth glance, it seems confusing.
It is not. The rule is simple and we call it the ORIGIN substitution rule.
If there is a dot at the end of a name in a resource record or directive, the name is qualified and if it contains the whole name including the host then it is a Fully Qualified Domain Name - FQDN. In this case the the name as it appears in the RR is used unchanged.
If there is NO dot at the end of the name (a.k.a. label in DNS jargon), the name is unqualified and DNS software adds the value of the last or only $ORIGIN directive. In the absence of an $ORIGIN directive the zone name from the named.conf file for this zone is used to synthesize an $ORIGIN directive. The fragment below illustrates this using A records and CNAME records.
; zone file fragment for example.com
; the named.conf file contains 'zone "example.com"'
; there is no $ORIGIN statement
; name in the line below is expanded to joe.example.com.
joe IN A 192.168.254.3
; line below - www.example.com. aliased to joe.example.com.
www IN CNAME joe
; next line is functionally the same as line above
www.example.com. IN CNAME joe.example.com.
; and so is this line
www IN CNAME joe.example.com.
; the name in this is record defaults to example.com
; assuming it was placed at the zone apex
IN A 192.168.254.3
; and could have been written as
example.com. IN A 192.168.254.3
; OR
@ IN A 192.168.254.3