I keep coming across the use of this word and I never understand its use or the meaning being conveyed.
Phrases like...
"add semantics for those who read"
"HTML5 semantics"
"semantic web"
"semantically correctly way to..."
... confuse me and I'm not just referring to the web. Is the word just another way to say "grammar" or "syntax"?
Thanks!
What Does Semantics Mean? Semantics in IT is a term for the ways that data and commands are presented. Semantics is a linguistic concept separate from the concept of syntax, which is also often related to attributes of computer programming languages.
Semantic networks are a way of representing relationships between objects and ideas. For example, a network might tell a computer the relationship between different animals (a cat IS A mammal, a cat HAS whiskers). Below is an example image of a semantic network.
1. Meaning attributed to words due to the content, form, style or origin of a text, rather than by the customary linguistic definition of the word. Learn more in: Land Acquisition and the Semantic Context of Land within the Normative Construction of “Modern Development”
The Semantics of Programming Languages. Semantics, roughly, are meanings given for groups of symbols: ab+c, "ab"+"c", mult(5,4). For example, to express the syntax of adding 5 with 4, we can say: Put a "+" sign in between the 5 and 4, yielding " 5 + 4 ". However, we must also define the semantics of 5+4.
Semantics are the meaning of various elements in the program (or whatever).
For example, let's look at this code:
int width, numberOfChildren;
Both of these variables are integers. From the compiler's point of view, they are exactly the same. However, judging by the names, one is the width of something, while the other is a count of some other things.
numberOfChildren = width;
Syntactically, this is 100% okay, since you can assign integers to each other. However, semantically, this is totally wrong, since the width and the number of children (probably) don't have any relationship. In this case, we'd say that this is semantically incorrect, even if the compiler permits it.
Syntax is structure. Semantics is meaning. Each different context will give a different shade of meaning to the term.
HTML 5, for example, has new tags that are meant to provide meaning to the data that is wrapped in the tags. The <aside>
tag conveys that the data contained within is tangentially-related to the information around itself. See, it is meaning, not markup.
Take a look at this list of HTML 5's new semantic tags. Contrast them against the older and more familiar HTML tags like <b>
, <em>
, <pre>
, <h1>
. Each one of those will affect the appearance of HTML content as rendered in a browser, but they can't tell us why. They contain no information of meaning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With