TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Is coding like speaking another language?

27 pointsby tbirrellalmost 8 years ago
I&#x27;m in a position where I need to describe what coding is like to someone else. I&#x27;ve been programming since I was 13, so I understand it at a level that is hard to put into words, let alone describe to someone else. My latest attempt is as follows:<p>&quot;Coding is like working in another language. Just like spoken languages, programming language each have their own grammar and keywords. Reading code and understanding it is like having to translate a document.&quot;<p>However, I&#x27;m not bilingual, so I was wondering if someone who was could tell me if this is a reasonable simulacrum. Especially the comparison of effort and difficulty between grokking code and successfully translating documents.

40 comments

travisjungrothalmost 8 years ago
I think comparing programming languages to natural languages will lead your listener down the wrong path.<p>Programming is writing instructions for a computer. It&#x27;s just like how you program your alarm clock to go off at a certain time. But imagine if you could write instructions like, &quot;If it&#x27;s a weekday ring at 8, if it&#x27;s a weekend ring at 9. If I hit snooze, ring again in 5 minutes.&quot; A programming language is a formal way of writing this down so it&#x27;s easy for the computer to understand.
评论 #15010181 未加载
评论 #15010285 未加载
superplussedalmost 8 years ago
As a programmer who is working on a language learning startup, I&#x27;ve thought alot about how and why these two disciplines are different. And I believe that learning a spoken language is actually much harder than learning a programming language for the following reasons:<p>* In order to strengthen your spoken language skills you must engage in what amounts to a performance in front of experts, akin to getting on stage as an raw amateur and performing jazz music to a crowd of experts. Programming can be learned in the quiet and safety of your home.<p>* Speaking a language is a synchronous activity, programming is asynchronous. You need full command over an enormous amount of new material when speaking a new language, whereas with programming you can always pause things in order to look something up.<p>* Learning to speak a language has a slow feedback loop compared to programming. You learn concept or word A, and by the time you first need to deploy that word or concept in the wild, it has been forgotten.<p>* Learning to speak a language has inconsistent feedback, with native speakers giving contradictory or unclear advice. Compilers, not so much.<p>* Speaking a language requires relearning muscoskeletal behavior that has been ingrained since birth.<p>* Speaking a new language badly is an act of courage that often penalizes introverted or perfectionist personality types. These types thrive when learning computer programming.<p>I could go on... :)
评论 #15009901 未加载
Tharkunalmost 8 years ago
No. It&#x27;s more like speaking the same language (English or whatever) aimed at a very specific audience. A bit similar to talking to someone who takes everything literally. Without room for interpretation.<p>In that sense, it&#x27;s closer to a method of organizing thought than it is to another language.<p>Background: software engineer who speaks 5 languages.
评论 #15010158 未加载
captainmuonalmost 8 years ago
I think it is very unfortunate that we use the same work &quot;language&quot; for human languages and computer languages. They are nothing alike, except you can write them in textual form and they have some kind of &quot;grammar&quot;. It&#x27;s a bit silly, but if you can&#x27;t say &quot;I love you&quot;, it is not a language to me.<p>I would rather say, programming is like designing an intricate mechanism, such as a mechanical clock. Some people have compared it to carpentry, or engineering.
评论 #15009803 未加载
评论 #15010512 未加载
评论 #15009820 未加载
评论 #15009984 未加载
imronalmost 8 years ago
It&#x27;s not like working in another language at all (I speak English and Mandarin).<p>When I try to explain to non-programmers what programming is like, the analogy I like to use is drawing.<p>With drawing, you start of with a blank piece of paper, and someone asks you to draw something (or you decide to draw it for yourself) and so you draw away, adding bits here and bits there, adjusting things, erasing things, redoing mistakes and maybe even starting over entirely. Slowly it starts to take shape and you keep going until you are satisfied with the end result (though sometimes you are never fully satisfied and there are always small adjustments you feel you could make).<p>Each artist has their own style and you could ask 10 people to draw you a picture of a house or a dog, and you&#x27;d get 10 different pictures of houses and dogs, each one definitely a house or a dog (assuming competent artists here), but each one unique and drawn in the style of the individual artist.<p>Programming is then drawing with math and logic. You start with a blank file, and someone asks you to program something (or you decide to program it for yourself) and so you program away, adding bits here and bits there, adjusting things, erasing things, redoing mistakes and maybe even starting over entirely. Slowly it starts to take shape and you keep going until you are satisfied with the end result (though sometimes you are never fully satisfied and there are always small adjustments you feel you could make).<p>Each programmer has their own style and you could ask 10 programmers to implement a given program or feature and you&#x27;d get 10 different programs, each one matching the requirements (assuming competent programmers here) but each one unique and programmed in the style of the individual programmer.<p>Anyway, it&#x27;s not a perfect analogy, but I&#x27;ve found it works quite well to explain things to non-programmers.
Bjorkbatalmost 8 years ago
Not really. Looking at my code, I&#x27;ll often see myself writing comments where I refer to functions and the like as &quot;things&quot;. I never see written sentences as things, at least not in the same way.<p>The closest analogy I can think of are magic spells. When I think of, say, a wizard, casting a spell, I don&#x27;t think of him speaking some kind of magical language, he&#x27;s uttering some words which have magical consequences. In this way a spell is a thing which results in an action. In the same way I use a programming language to write what I see as discrete blocks of code that cause something to happen. By contrast, &quot;normal&quot; languages are just used for communication.<p>It&#x27;s kinda hokey, and you probably won&#x27;t be able to tell people that programming is like creating magical spells, but you asked.
conner_bwalmost 8 years ago
When it comes to code, English speakers like to talk about how good, pure, or expressive a code language is. For example, ask people up in here to describe PHP and you&#x27;ll get bile. Ask them to talk about Closure and you&#x27;ll get accolades. Usually summarized as &quot;because the language is bad the result will be bad&quot;<p>...the irony is that the discussion will be in English. One of the worlds most inconsistent, awkward, written languages. [1] Further more, most code <i>is</i> English. Example: it&#x27;s usually &quot;if&#x2F;else&quot; not &quot;si&#x2F;sinon&quot; or &quot;と&#x2F;又は&quot;<p>IMHO I don&#x27;t think the analogy holds. However, I don&#x27;t know of a better way to describe it.<p>PS: I&#x27;m bilingual (French&#x2F;English)<p>[1] <a href="http:&#x2F;&#x2F;aclassen.faculty.arizona.edu&#x2F;content&#x2F;english-language-crazy-inconsistencies" rel="nofollow">http:&#x2F;&#x2F;aclassen.faculty.arizona.edu&#x2F;content&#x2F;english-language...</a>
评论 #15010253 未加载
评论 #15010017 未加载
turc1656almost 8 years ago
No, definitely not. To me it is about the logical flow of thought that is put into a structured format. That might sound like spoken language, and to a certain extent it is. But code is more than just that. It is precise. There is no ambiguity. There are hard rules. A violation of format&#x2F;structure&#x2F;syntax is not allowed.<p>Most importantly, logical errors result in unexpected behavior. In most spoken language, someone could be an absolutely terrible speaker and can still manage to get the idea across. There is no code equivalent of saying to someone, &quot;I dunno, it&#x27;s hard to explain, but you know what I mean, right?&quot;<p>I would say the closest &quot;language&quot; that code can be related to is legalese. It has definitions and exceptions and legal agreements tend to conform to standard to ensure their validity and enforceability. A significant error in this regard would void the agreement, or at least part of it - similar to a compiler error. Also, I like to think of good code being a battle plan where you want to make sure no one is able to do anything you don&#x27;t want them to do, even if they do something unexpected or deliberately try to break your code. You try to think of every scenario that you can possibly encounter and you code for it. This creates a defense for your code. Legal documents tend to be created with a similar mindset of protection and survival.
metaphormalmost 8 years ago
I think it&#x27;s more like learning to express yourself in a different style, rather than learning an entirely different language.<p>The style we are accustomed to allows for an interlocutor with significant ability to fill in the gaps in what you&#x27;ve said or written. To read appropriate context and subtext into your words and interpret them meaningfully despite ambiguity.<p>The style we must learn when programming is to remove all possible ambiguity and subtext, and explicitly provide a context (arguments, scope, closure, environment, etc.) for evaluation.<p>When we learn a new language we learn new vocabulary and alternate syntax but we still express ourself in the same style. When we learn a new style we must unlearn and relearn all of our assumptions about how language is interpreted. That&#x27;s what learning programming is like.
drewrvalmost 8 years ago
I don&#x27;t think they&#x27;re similar at all. It&#x27;s an anecdote and all, but I am terrible at learning foreign languages. Something about the way my brain works. I lived in France for two years and married a French woman and I still couldn&#x27;t get by for more than a day or two in that country on my own. Yet I picked up programming pretty quickly and consider myself good at it.<p>I think the best analogy is mathematics, in the sense that you&#x27;re reasoning about abstract objects and solving puzzles. Unfortunately most people don&#x27;t think about math that way so it probably doesn&#x27;t help much.
noahltalmost 8 years ago
The authors of SICP draw a distinction between declarative knowledge (facts about the world) and procedural knowledge (instructions for how to do things). Programming, they say, is a way to precisely communicate procedural knowledge.<p>Most interpersonal communication is both imprecise and not procedural knowledge, and that is the biggest difference between speaking with a person and programming a computer.
lillesvinalmost 8 years ago
Linguist here. It&#x27;s doesn&#x27;t seem very similar to speaking another language at all. Hockett&#x27;s Design Features is a set of features that is commonly used to distinguish natural human languages from other systems of communication: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hockett%27s_design_features" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hockett%27s_design_features</a><p>Not that those features are requirements or anything, but they serve as a good guideline. As you can see, programming languages lack many of these features. For one, lack productivity — you can&#x27;t suddenly switch up the syntax in some novel way or make up a new keyword to achieve some effect and expect the compiler&#x2F;interpreter to just understand it.<p>Programming is probably more akin to a jargon + some technical knowledge to go with it, but it&#x27;s still a bad comparison because a jargon is still a part of a natural language — programming languages are not.
pinkythepigalmost 8 years ago
I like to equate it to giving instructions to someone who takes everything you say extremely literally. Ask me to make a PB&amp;J? If you tell me to stick the knife in the PB, since you didn&#x27;t specify what side to stick in, I sometimes put it in handle first, sometimes knife edge first, depending on how I found it. To make a successful program, you would need to account for all the possible inputs (the different orientations of the knife in the drawer, the possibility that there might not be a knife, etc.). The difference between good software and bad software is that the good software will properly handle all of these error conditions, and the bad software will either do the wrong thing (sticking it in handle first, because the instructions assumed the knife was always oriented correctly) or will crash when something unexpected happens (such as there not being any more knifes, or running out of peanut butter half way through making a sandwich).
0x4f3759dfalmost 8 years ago
Coding is like describing a trip to the grocery store in 100 pages.<p>&quot;He stood up, he walked forward 10 paces, he grabbed the door, he opened the door, he walked through the door...&quot;
评论 #15010466 未加载
dansanufalmost 8 years ago
As a bilingual person, I wouldn&#x27;t describe learning to code as being similar to learning a new human language. The fundamental building blocks of programming (loops, variables, functions, etc.) are vastly different from the building blocks of human language (nouns, verbs, adjectives, etc.).<p>However, I would describe learning a new programming language if you already know one (say, C++ to Python) as similar to learning a new human language (English to Spanish). The languages in both cases may be different, but the fundamental building blocks of expression are mostly the same.
fragmedealmost 8 years ago
Who&#x27;s your target audience, and what will that description be used for?<p>That single sentence of description is fine for a general audience, and as a lead-in to a more in-depth discussion but it&#x27;s a single sentence and not an in-depth analysis. There are books more that could be said about the differences and similarities between being multilingual for programming languages verses spoken languages but a dissertation on why the comparison (likely) not what&#x27;s being asked of you.<p>The follow-on ramifications of something being in a different language than one you speak, rather than a comparison of multilinguality itself might be useful to highlight. It&#x27;s one thing for you as a person to speak two programming languages, but if one language runs server-side, and the other is client side, it&#x27;s good to illustrate that teaching Chrome to &quot;speak&quot; a different language is going to be harder than for your company to provide translations. Similarly, if the company is trying to move to and canonicalized on a second programming language, it needs to be illustrated (in lines of code) as to how much currently exists at in the first language, and must be translated to the second.<p>Programming languages are not like spoken languages because people there can be discussions about syntax and parsing, but then a new version of the compiler comes out and the system is rolled and every&quot;one&quot; speaks the new version (and the old, for that matter). Meanwhile we&#x27;re still working on being able to do that for humans.
innocentoldguyalmost 8 years ago
I know several programming languages (e.g. Elixir, Elm, Erlang, Haskell, Ruby, Python, etc.), and I also speak English and Japanese fluently. With programming languages, the fundamentals beneath the syntax are basically the same. For example, whether I use recursion or for loops, all of the programming languages I know support iterating through a list of data. Similarly, they all have some mechanism for making logic decisions, such as if or case statements. So, learning a new programming language is just a matter of mapping new syntax to concepts I already know. If learning a new spoken language were simply a matter of mapping vocabulary words to meanings, then I would say both are the same, but this is not the case.<p>In spoken languages, there are cultural differences that have to be learned and concepts that just don&#x27;t translate well between languages, if at all. Idioms are also difficult. Often times, there is no cultural foundation in one language to make sense of the idioms used in another. Unlike computer programming, there is no underlying base that you can use to map new knowledge too. You have to build your entire understanding from scratch.
CodeTheInternetalmost 8 years ago
I would assume it feels that way to those who don&#x27;t speak English natively. Otherwise, I would say it&#x27;s more like turning math into a language.
ramses0almost 8 years ago
Programming is a &quot;class of language&quot; ... latin&#x2F;romance, germanic, slavik, etc.<p>&quot;I speak programming. Specifically I speak C++.&quot;<p>Furthermore, within programming there are classes of languages (imperative, functional, oo, pattern matching, etc).<p>&quot;I speak programming. I understand imperative and OO from C++, but struggle to understand functional, as I&#x27;m not used to composing my thoughts that way.&quot;<p>There are varying degrees of fluency &#x2F; literacy in each of these classes of languages.<p>&quot;I&#x27;m an expert in C++11, and wouldn&#x27;t hesitate to write or maintain any C++ code. I can also read and modify many C-like languages (Java, JavaScript, Objective-C, Go) and may play with them on the weekend, but they would not be my first choice in starting a project at work. I can read some lisp code, but I can never understand something written in erlang no matter how many times I try.&quot;<p>So I would say that you can draw comparisons between northern v. southern english (ie: versions of C++) then english (ie: C-like languages) rolling up into germanic &#x2F; romance (ie: imperative languages).<p>Regarding &quot;translation&quot;, that&#x27;s reasonable to understand. However, a programming translation has extra requirements to be successful.<p>1) it must be complete (at least the translated portion) 2) it must be 100% correct 3) regardless of the language, it must cause the same effect<p>...a partial translation, a translation with errors, or a slightly different meaning can &quot;ruin&quot; the programming translation, whereas minor errors or awkwardness in your normal translation are generally easy to overcome compared to a traditional written text designed for human (not computer) consumption.
nikdaheratikalmost 8 years ago
It really depends on the language and what you are doing. The majority of of the field is closest to working with mathematical equations which makes sense as the people who created the languages took ideas from mathematics when designing the language and did the hard work of transforming those ideas into something that could be ran on a computer.<p>However, as you get closer to the hardware level, you move away from the abstract and need to think about the way the machine is built&#x2F;configured and the actual instructions that will be executed. There are some languages, like C, that kind of bridge the divide between the two. Others, like Lisp, are almost entirely abstract with little need to think about how the instructions get ran at a lower level.
jon_richardsalmost 8 years ago
Combining a few other answers, I&#x27;d say it&#x27;s a lot like writing a goosebumps (choose your own adventure) book in another language.<p>While I do like the analogy of writing instructions for someone who is very dumb, that analogy doesn&#x27;t capture the different paths of execution that a program can take.
udfalksoalmost 8 years ago
Not quite, but what I do believe is true is that learning multiple programming languages is similar to learning multiple spoken languages.<p>Just as knowing Spanish will aid you in learning Portuguese, knowing Python will help you pick up Ruby. After you know a few varying languages it becomes much easier to pick up a new one. You notice that they all share the same basic constructs.<p>Also, each language (in both realms) brings new modes of expression to the table and these can open your mind to alternate ways of thinking. You notice this with spoken languages most when you run into a phrase that is untranslatable to some other languages. This part is perhaps more true of programming languages than spoken languages, but I believe it is true of both to some degree.
KirinDavealmost 8 years ago
It depends. But generally, I think it is. Although it uses different facilities from those which we commonly use to speak languages.<p>It&#x27;s most evident when you use related families of languages. Using up to Python, Ruby or Coffescript is a lot like the related family of english languages; once you know one or two you sort of get them all fundamentally. Javascript, Io and Perl are like lost cousin languages; you can often recognize bits but the sentence structures and dialogue conventions may seem quite foreign.<p>Confronting purely functional languages is VERY much like having to relearn the same skills of communication from the ground up.
alexashkaalmost 8 years ago
I&#x27;d say it&#x27;s like writing down very specific instructions to do something, that afterwards can be translated to manipulation of numbers.<p>The results get to be stored, retrieved and displayed.<p>Since it&#x27;s a manipulation of numbers, the set of rules you get to use are all based on logic (if this, then that, etc)<p>Then you can add an extra step of number manipulation can be boiled down to manipulating binary numbers consisting of 0s and 1s, so the logic used is boolean logic etc.<p>So I&#x27;d say programming is more like learning logic constructs (math) - it&#x27;s a universal language with rules that are interested in manipulating values in very complex ways.
brangoalmost 8 years ago
Yes. It&#x27;s a way of thinking that is communicated by words. Same as speaking a foreign language for me. I wouldn&#x27;t be surprised to find out that the same parts of the brain are involved.<p>To elaborate, in some spoken languages you have adjective noun (e.g. blue house), but in others the order is reversed (casa azul). At some point of learning you just subconsciously know which form to use. This is similar to programming when you can use the appropriate idioms in each language. E.g. using duck typing in python vs type checks&#x2F;conditionals etc. in Java.
CryoLogicalmost 8 years ago
I think it&#x27;s more like a different type english.<p>You express the same types of concepts, but you break them down into very small parts and than build up the argument comprised of small parts.<p>Like instead of saying &quot;the bike went forwards&quot; which is very conceptual and requires a lot of background understanding of bikes and physics, you describe a bike consisting of wheels, a frame, a steering wheel etc. than describe the action of moving in a direction. finally you apply to action to the bike.
SadWebDeveloperalmost 8 years ago
No, coding is a series of instruction put on a specific order for a machine to process not an a instrument to communicate with another (computer) entity.<p>Modern languages are designed to be the most human-friendly possible to express those &quot;commands&quot;, even the &quot;lowest&quot; language you could learn (assembly) it&#x27;s still way to human friendly if compared to real bare bones communicating with the computer hardware.
shujitoalmost 8 years ago
It&#x27;s not (quite)<p>Despite being called &quot;programming languages&quot;, they are not really languages for people to communicate, but for computers to understand instructions (although, humans do need to understand a programming language to be able to code).<p>Saying that coding is like speaking another language can be confusing, so I&#x27;d recommend that coding is more like instructing a computer to do something (by writing instructions).
indubitablyalmost 8 years ago
I don&#x27;t think so at all. Natural languages evolve with ambiguity built in — any sort of ambiguity is almost always an error in programming.
bjournealmost 8 years ago
Someone can say &quot;coding is like solving equations&quot; another &quot;coding is like wandering in a (irl) forest.&quot; I don&#x27;t think there is any right or best answer. My take on it is that coding is like sculpturing, but that answer is just as flawed as all the others. Few activities (that I know of) are very similar to computer programming.
machinemobalmost 8 years ago
I actually agree with your simulacrum. I also agree with others that code has more in common with a cake recipe than Pride and Prejudice ;-)<p>The above said, language is language whether you&#x27;re struggling to control a state-machine, baking vegan cookies or ordering lunch in Paris. It&#x27;s difficult, it takes time to learn and delivers the same rewards all around.<p>Cheers
novembermikealmost 8 years ago
Programming is about defining requirements in excruciating detail. A business person says &quot;I want this data stored somewhere&quot; and a programmer has to define where it comes from, what the schema is, what transformations happen, how does it get stored, where does it get stored, and what happens if anything in that pipeline goes wrong.
satisficealmost 8 years ago
To code is to be very, very specific. That&#x27;s it. Imagine asking someone to get you a coffee, but you have tell him exactly how to do it down to the tiny details of how to grip a cup with fingers.<p>The challenge of learning to code is largely the challenge of learning to be specific in your communication and having the patience for all that entails.
tptacekalmost 8 years ago
Not even a little bit. It&#x27;s more (but not perfectly) like if we had multiple alphabets to express the same language.
评论 #15019066 未加载
eitlandalmost 8 years ago
Most of the code I write is a mix of broken English and simple equations.<p>I agree with you: programming languages are languages.<p>I personally find them simpler than normal languages (no gender pronouns like in German, no special rules for past and present tense etc. Oh, and immediate honest (if somewhat mumbling) feedback from the compiler.
caspervonbalmost 8 years ago
Polyglot here, dont think that it matters tho.<p>I think of it more as a notation and has more in common with constructs like mathematics than actual spoken language. Yeah we have rules and syntax grammer, but at the end of the day you are expressing it in plain ol English.
dozziealmost 8 years ago
No, it&#x27;s not really like that. It&#x27;s more like preparing an instruction on how to execute some complicated process, say, cook a fancy meal, for somebody who is very dumb (but will follow the instruction precisely).
rchalmost 8 years ago
I find that programming feels more like spatial navigation than speech or language.<p>Cognizing (e.g.) the Eclipse codebase might be roughly equivalent to maintaining a complete mental model of NYC.
ams6110almost 8 years ago
I would say no. It&#x27;s a shorthand way of writing very explicit instructions. There is far more variety and nuance in human languages than in programming languages.
vkjvalmost 8 years ago
No. In my opinion, it&#x27;s much closer to domain specific jargon. Similar to other specialized fields (e.g., paleontology).