Why Is HTML Not A Programming Language?

HTML is not a programming language. While some may point out that HTML is a "markup language", this doesn't clarify how that is different from a programming language. I'd like to provide a simple reasoning that is easy to understand by the layperson. (This isn't meant to be a thorough argument, but rather a brief explanation that goes just a bit more in detail than "HTML isn't a programming language but instead a markup language.")

Here is a point I'd like to make: HTML is no more a programming language than Microsoft Word is. With Word (or any other word processor software), you can write out text and format it with different fonts, sizes, and colors. Images and tables and bullet points can be added as well. This is all done through the word processor's graphical user interface.

An HTML file is similar, except it does not have a GUI. Instead, it is entirely written out in plaintext, so all the formatting instructions must be typed out as HTML tags (for example, <b> or <center>.) This "language" of tags is how we can format the appearance of a webpage.

Programming languages, on the other hand, can process data and make decisions. You can store data such as text strings and integers, and then manipulate these values to perform calculations. For example, doing some math or sorting text alphabetically are kinds of data processing that you cannot do in HTML.

Programming languages can also make decisions about what instructions they should execute. Depending on if a certain condition is true or false, a set of instructions may be executed or skipped by a program. Here is a Python example of such code:

if password == 'rosebud':
    print('Access granted.')
else:
    print('Access denied.')

Programming languages also have ways of executing instructions over and over again in loops. Loops, if-else statements, and other such instructions are called flow control statements. All programming languages have these flow control statements, but HTML (and Microsoft Word) do not.

JavaScript is a programming language. It has all these features of flow control and data processing. While JavaScript is used in many web pages, it is a distinctly separate thing from HTML. You can write HTML without JavaScript, and you can write JavaScript code without HTML.

Because HTML lacks these features, it cannot be called a programming language. One does not "program in HTML" nor could one "write HTML code". You should never list HTML on your resume under "programming languages".

The difference is not just a snobbish opinion of elitist software developers. While this post is by no means the definitive and complete reasoning of what a "programming language" is, it is good to know the general difference between a programming language and HTML.

Read More

A Common Programmer Mistake: Dog is not the Opposite of Cat

True is the opposite of false. Up is the opposite of down. What is the opposite of dog?

If you replied “cat”, what exactly makes cats the opposite of dogs the same way up is the opposite of down?

I use this example to point out a common problem that software developers make with variable and parameter names. When there are two possible values for some variable or parameter, it is very common that it should be defined as a boolean type.
(more…)

Read More

A Modest Proposal: Please Don't Learn to Code Because It Will Damage Your Tiny Brain

Jeff Atwood wrote a post on his Coding Horror blog entitled "Please Don't Learn to Code" in which he rails against the idea that "everyone should learn programming".

And I couldn't agree more.

People, not everyone needs to learn programming. Only some gifted individuals (of which we professional software developers are included) need to learn programming. For the rest of you, unless you are srsly committed it will just be a meaningless chore that may damage your tiny brains.

Coding is just like surgery: if an amateur decides to code their own Angry Birds clone as a fun little project, people will literally die. Those are the stakes, folks. That's why it should be left to those who are explicitly pursing it as a professional career.

TL; DR link

You have my assurance that I find Bloomberg's encouragement of people to learn a technical skill personally offensive. It filled me with a rage that was only subdued after discouraging a small child from learning to play the harmonica. (What's the kid going to do with that skill anyway? There are better ways he could spend his valuable time.)

(more…)

Read More

CircleMUD Data in XML Format for Your Text Adventure Game

Long before World of Warcraft, people played text-based MMORPGs called MUDs (Multi-User Dungeon). These were basically multiplayer text adventure games where people could wander through a virtual world fighting monsters and exploring. They had several RPG elements to them.

CircleMUD was a popular piece of server software for running a MUD, and it came with a sizeable virtual world (which the admin could modify/append to customize their fantasy world.) It would be pretty handy to use parts of this data if you were creating your own virtual world for a text adventure game, but the format of CircleMUD's data files is kind of obtuse and not amenable to manipulation.

So I wrote a few scripts to convert these files into a single XML file which is 4MB when unzipped. You can parse this file and modify it to suit your needs. It contains 1979 rooms across 30 different areas (called zones in the file), with 46 shops and 569 different "mobs" (mobile objects, which are the monsters and NPCs). There are 678 different types of objects, including 116 weapons and 154 types of armor.

The scripts and original CircleMUD data (along with descriptions of the data formats) are included in the zip:

Download CircleMUD XML Data (1.3 MB zipped)
(more…)

Read More

“How much math do I need to know to program?” Not That Much, Actually.

Here are some posts I’ve seen on the r/learnprogramming subreddit forum:

Math and programming have a somewhat misunderstood relationship. Many people think that you have to be good at math or made good grades in math class before you can even begin to learn programming. But how much math does a person need to know in order to program?

Not that much actually. This article will go into detail about the kinds of math you should know for programming. You probably know it already.

For general programming, you should know the following:
(more…)

Read More

Nobody Wants to Learn How to Program

I frequently see a problem when people (especially techies) try to teach programming to someone (especially non-techies). Many programming tutorials begin with basic programming principles: variables, loops, data types. This is both an obvious way to teach programming and almost certainly a wrong way to teach programming. It’s wrong because nobody wants to learn how to program.

If you are teaching a class of adults who are paying with their own money for an education, then this is an appropriate and direct way to teach programming. It’s their money. They expect that they’ll have to focus and slug through concepts to come out the other end with programming knowledge. The start-with-variables-loops-data-types approach is fine for this. But most likely they still don’t want to learn how to program.

But for the casually interested or schoolchildren with several activities competing for their attention, programming concepts like variables and loops and data types aren’t interesting in themselves. They don’t want to learn how to program just for the sake of programming. They don’t want to learn about algorithm complexity or implicit casting. They want to make Super Mario or Twitter or Angry Birds. This idea is best summed up in one of Ryan North’s Dinosaur comics (click to enlarge):

Here are my five pieces of advice to people who want to teach programming or create programming tutorials:
(more…)

Read More