Don't miss an insight. Subscribe to Techopedia for free.


Syntactic Sugar

What Does Syntactic Sugar Mean?

“Syntactic sugar” is a term for syntax changes in computer programming which make it easier for humans to code. There are several different types of syntactic sugar and synonyms include “syntactic saccharine” and even “candygrammar,” which is often used to describe superfluous or unhelpful “syntactic sugar” changes.


Techopedia Explains Syntactic Sugar

People often define syntactic sugar as changes that make computer programming languages more like English – helping less tech-savvy people to program. However, others also describe shortcuts that consolidate programming tasks in fewer characters as syntactic sugar as well. Sometimes both of these are incorporated in the same change – other times they are at odds with each other. For example, if a syntactic sugar for the unskilled programmer is a command like “make X equal to one” and the skilled programmer shortcut is “X = 1,” both of these could be considered syntactic sugar in their own ways. One simplifies the task for the non-tech savvy person, but expands the amount of syntax needed to complete the task. The other provides a simplified shortcut, but is more cryptic and obscure, making things harder for the unskilled programmer.

In general, syntactic sugar is seen as a lazy way to approach syntax design. The best practice, according to many skilled programmers, is to create a consistent syntax that is efficient and stands up well to change.


Related Terms