The Intersection Between Coding and Learning a Language

There’s a reason that learning a programming language used to be considered a stand-in for a traditional language class. A flexible programming language like Lua or Perl (among many others) can instruct the computer in different ways. There’s not necessarily a “right” way to do most operations, as long as the code adheres to the syntax and grammar of the programming language and accomplishes the task. Certain things work better than others, and some languages feature idioms and conveyances that other languages require pages to pull off.

It’s easy to see how a programming language is like a natural language (especially with Wenyan), but it’s also easy to see where they diverge. The same basic principles exist, and with the right abstraction the differences can be reconciled. Languages work with grammar, semantics, and something worth saying. In programming, data structures and algorithms become the grammatical units for “conversation”. Coding is more than just learning to make a language do what you want, it’s learning to know what you can make it do.

Linguistics in Programming

Programming language theory is a branch of science which sits in the space where programming languages meets (human-oriented) linguistics. The Chomsky Hierarchy applies as much to human language as it does programming. As you abstract the rules, the difference between programming and human languages becomes a classification issue rather than a philosophical one.

Both programming languages and human languages can be described in terms of their units. They each have grammar, syntax, semantics, idioms, etc. As you delve into the more scientific side of linguistics, the breakdown of a sentence looks more and more like math. Your word loses its identity and becomes a member of a set of potential words which fit the set of grammar rules which allow a word of similar classification in that spot. Our sentence is abstracted into the derivative and the abstraction of every constituent building block.

Grammar, Semantics, and Something Worth Saying

Grammar breaks down our language and creates rules, but rules can be adhered to without making any sense. Chomsky’s Colorless green ideas sleep furiously, is grammatically sound, but means absolutely nothing. The focus on the semantics, or more simply the meaning, of what is created in the language is important as well.

The computer is not cognizant of the world that you or I know, all it “knows” are the rules built into it. You tell it what to do, and it at best tells you the results of what it’s programmed to do. The same architecture should be identical for basic operations and a program made for one system should work on another (which is similar).

“Hey sweetheart” will get a kaleidoscope of reactions in an English speaking country. It can be a term of endearment or a muttering of condescension based on the person, the inflection, or the context. Each individual you interact with is going to have a different life story, which is going to factor into how what you say is interpreted. They have different experiences, different levels of person growth, different relationships with who they’re speaking to, etc., but everything on a computer is reduced to Boolean logic and binary.

Data Structures and Algorithms as Units of Conversation

An illogical statement is thrown out in an argument or in life is thrown out just as quickly with a programming language. The major difference between programming and normal linguistic communication is what makes up the meaning behind each linguistic construction. A computer doesn’t know what a “forest” is, but it’s fine with an array of Tree objects.

You aren’t discussing physical objects, you’re “discussing” data and (maybe) its actions. You’re working with data, and specific operations which all add up into something which makes sense to the user when it’s regurgitated out of the rules you created. The computer doesn’t comprehend your ideas, it only processes the algorithms which you use to implement them.

Your basic unit of “conversation” with a computer in most programming language is going to be the algorithm which does something, and the data structures which are acted on. While this may seem to break down with functional programming, you can argue that even though the data isn’t changed, you get new data which is the result of these actions. Your data as its structured and the actions and processing as the algorithm become the units of a meaningful “conversation” within the system of the specific programming language employed.

Something Worth Saying

This is where computer science and the study of a specific language diverge heavily. Computer science teaches “the art of conversation” as well as the “linguistics” behind a computer rather than just a specific language (though one or two are taught to actualize this understanding, or it becomes just math, which is where linguistics can go too). To “speak” to a computer you have to have something worth saying, which is why just learning the grammar and usage of a language isn’t enough.

The average neurotypical person doesn’t really need this level of instruction for a language. They should have some understanding of how to interact with other people, so the cultural aspects may be taught, but the more universal bits are not. If you want to talk to someone, you have to have something to talk about or the other person isn’t going to be interested.

Omitting learning about data structures and algorithms when learning to program is akin to the cautionary tale of a former classmate when I lived abroad. He could hold a conversation with anyone in Western Europe (including the Anglosphere and Francosphere), the economic centers of Asia, and the Americas, but no one wanted to talk to him. It didn’t matter the language he spoke, people avoided him, because he couldn’t fit in with social norms and didn’t have anything relevant to say. A conversation about sports turned into one about Anime, and then one about places people had to be.

Learning to program the language but omitting the theory is intentionally restricting how you can interact with the computer. The computer won’t judge you for your inability to communicate, but you will hit a wall, hard. Don’t just learn the language, learn to convey what you want done in a way that is efficient for your “audience”.

Image by PDPics from Pixabay