I’ve been told HTML is a markup language, C++ is a programming language, what could make that difference?

My programming friends are always telling me that HTML is a markup language and C++ is a programming language. When I ask them what’s the difference, they never give me a reasonable answer.

What could make one call C++ a programming language, and HTML not?

7

A programming language is a notation designed to pass instructions to a machine. By that definition both C++ and HTML are programming languages, as was the notation Joseph Marie Jacquard used in 1801 to program his looms.

However with the proliferation of languages that are used to structure and/or describe data, the definition of a programming language shifted to include only languages that are capable of expressing algorithms. This is the more common definition today and it excludes languages like HTML or XML.

At the heart of the current definition is the concept of Turing completeness. Most programming languages are Turing complete, and Turing completeness is often quoted as the one critical trait that separates a programming language from any other computer language. This is good enough as a general rule of thumb, but not entirely accurate:

  1. Some non Turing complete languages are considered programming languages, for example Charity.
  2. Some languages that are not generally considered programming languages are Turing complete, for example XSLT.
  3. Turing completeness alone doesn’t say much about a language’s usefulness.

Depending on context, you can pick any definition you want.

Edit:

Let it further be known, an implementation of a language does not confer characteristics onto the language itself, for example: A language’s spec may define a turing complete language, someone could implement it haphazardly leaving off turing completeness. This implementation being non-turing complete does not however mean the language itself is not turing complete (rather it likely means that implementation is non-conformant). The details of a language and the details of a particular implementation of a language are to be recognized as separate things, this is why it’s inaccurate to call a language interpreted or compiled etc.

5

The phrase “I know it when I see it” is a colloquial expression by
which a speaker attempts to categorize an observable fact or event,
although the category is subjective or lacks clearly defined
parameters. The phrase was famously used by United States Supreme
Court Justice Potter Stewart to describe his threshold test for
obscenity in Jacobellis v. Ohio (1964).

— “I know it when I see it” Wikipedia article

Like obscenity, I think we all know a programming language when we see one. Clearly the OP does, since you’ve already judged C++ to be a programming language, and HTML not to be one.

So what exactly is the goal of pursuing a formal definition? Yannis has already given a great rundown of why the most popular definition, Turing completeness, is flawed: it leads to categorization which defy the “I know it when I see it” test.

I put it to you that any definition you can come up with will lead to some languages which we all feel are not “programming” languages will be categorized as being so; or to some languages which we all feel are “programming” languages will be categorized as not being so.

Why not just go with your gut? I use a simple heuristic: a programming language is a language whose primary purpose, in my opinion and according to my observations, is to write programs. Not to mark up content. Not to transform XML. To write general purpose programs. I’d rather just know it when I see it than try to nail down a formal definition, and I don’t see any genuine value that can come from attempting such a definition.

7

Markup languages mainly deal with how the information is displayed and they generally lack in the programming infrastructure of variables, math, comparison, decision making (if … then), loops (for, while), etc.

HTML by itself is static; that is, much like a word-processor, it is meant to present the information as it is. Only with the addition of some sort of programming languages (usually scripting languages like JavaScript, PHP, etc) can the HTML web pages can have a “changing” content. The scripting languages provide the “programming” possibilities with variables, math, comparisons, decision making, loops, etc.

HTML is a declarative language. It doesn’t do much on its own, it just describes a document and its content (using tags that have a semantic meaning).

C++ on the other hand does something. It does define functions and classes, but it also describes how these functions should work together, how their inputs and outputs are tied together in a meaningful way and how the application should run as a whole.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật