How do we spell “ID” (and similar acronyms) in Code?¶
ID and all other acronyms are controversial identifiers for variables.
We need an agreement on how to write it.
The following pargraphs use only ID as example, but the result can be applied to every other acronym as well (XML, HTTP, REST, RPC, JSON, …).
Possible Solutions¶
idif there is no prefix,-IDotherwise (->lectureID,lectureDTO,LectureDTO)idif there is no prefix,-Idotherwise (class names included) (->lectureId,lectureDto,LectureDto)idif there is no prefix,-Idfor variables,-IDfor class names (->lectureId,lectureDto,LectureDTO)idif there is no prefix,-Idfor acronyms of a single word (i.e.ID),-IDfor acronyms of multiple words (i.e.XML,DTO) (->lectureId,lectureDTO,LectureDTO)
Chosen Solution¶
idif there is no prefix,-Idfor acronyms of a single word (i.e.ID),-IDfor acronyms of multiple words (i.e.XML,DTO) (->lectureId,lectureDTO,LectureDTO)
Pro 1)¶
Correct spelling of acronyms
Contra 2)¶
Incorrect spelling of acronyms
Pro 3)¶
Conforms with the way many (Java) libraries handle it
Contra 3)¶
Inconsistent and you would have to change everything
Pro 4)¶
Uniform and you would not have to change anything