YouTube2Text

Compiler and Interpreter: Compiled Language vs Interpreted Programming Languages — Transcript

by Coding Mentors · 1,092 words · 163 segments · language en · Watch on YouTube

Full transcript

  1. 0:00So, we need to get our source code
  2. 0:02converted into machine code somehow
  3. 0:05before it can run. And there are two
  4. 0:07main ways of doing this. What's called
  5. 0:09compiling the source code, and what's
  6. 0:11called interpreting the source code.
  7. 0:14Now, luckily, this is not a big decision
  8. 0:16you have to worry about. Most languages
  9. 0:18you'll deal with will naturally fall
  10. 0:20into one or the other, but it is worth
  11. 0:22knowing the difference. So, let's have a
  12. 0:24simple scenario. Let's say it's just you
  13. 0:27and me. You have your computer, and I
  14. 0:30have my computer, and you're going to
  15. 0:32write a program that you want me to run.
  16. 0:35Now, with a compiled language, what
  17. 0:37happens is you write your source code,
  18. 0:39and then you have a program called a
  19. 0:41compiler that will go through that
  20. 0:43source code and create a separate file
  21. 0:45that contains the machine code, and you
  22. 0:47just give me that file. This end result
  23. 0:50is sometimes referred to as an
  24. 0:52executable or an executable file,
  25. 0:54because I can directly execute it. I can
  26. 0:56now just run your program. You keep your
  27. 0:59source code, and I never see it. Now,
  28. 1:02with an interpreted language on the
  29. 1:04other hand, you don't compile your
  30. 1:06source code beforehand. You just give me
  31. 1:08a copy of it. So, I'll need my machine
  32. 1:11to interpret it whenever I want to run
  33. 1:14your program. Now, an interpreter is
  34. 1:16different to a compiler. It does this on
  35. 1:18the fly. We can think of it as going
  36. 1:20through your source code line by line
  37. 1:23and processing it on the spot. It does
  38. 1:25not save it as a separate machine code
  39. 1:27file.
  40. 1:29Now, you've used interpreted languages
  41. 1:30even if you don't know it. Whenever
  42. 1:32you've looked at a web page with
  43. 1:33JavaScript, which, if you've surfed the
  44. 1:35web for more than 2 minutes in your
  45. 1:37lifetime, you have, this is what's been
  46. 1:40happening. The JavaScript has been sent
  47. 1:42to you over the web, along with a bunch
  48. 1:44of other files like web pages and
  49. 1:46images, and it's been sent as source
  50. 1:48code onto your machine, and your web
  51. 1:50browser has just interpreted that
  52. 1:52JavaScript so it can run that code. So,
  53. 1:55which one's best? Well, they both have
  54. 1:57their good and their bad points.
  55. 1:59Benefits of compiled code. Once it's
  56. 2:02compiled, it's immediately ready to run
  57. 2:04and you could send it to 100 or 1,000 or
  58. 2:06100,000 different people. It's ready to
  59. 2:08go. It can be optimized for a CPU, so it
  60. 2:12can actually be faster. And you don't
  61. 2:14have to send your source code to
  62. 2:16everybody, which might be a good thing.
  63. 2:18However, the downsides are if I compile
  64. 2:21it on a PC, that executable file won't
  65. 2:24work on a Mac. In fact, it often needs
  66. 2:26to be compiled separately for different
  67. 2:28kinds of CPU even on the same platform.
  68. 2:31And when you're writing code, to compile
  69. 2:34is an extra step that you have to take
  70. 2:36every time you want to test your
  71. 2:37program. Now, with interpreted code, the
  72. 2:40big benefits are I don't really care
  73. 2:42what kind of machine is on the other end
  74. 2:44because we don't provide machine code.
  75. 2:46We just send the source code and we let
  76. 2:48the other side take care of it. So, it
  77. 2:50can be more portable and more flexible
  78. 2:52across platforms.
  79. 2:54It's also a little easier when testing
  80. 2:56because you just write your source code
  81. 2:58and then run it, letting the interpreter
  82. 3:00take care of converting it. There is no
  83. 3:02in-between compile step. And it can be
  84. 3:05easier to debug when things go wrong
  85. 3:07because you always have access to all
  86. 3:09the source code. However, it has its
  87. 3:11downsides, too. Because everyone who
  88. 3:13needs to run that program on their
  89. 3:15machine has to have an interpreter for
  90. 3:17that language on their machine.
  91. 3:19It also can be slower because you have
  92. 3:21to interpret it every time the program
  93. 3:23is run. And the source code is
  94. 3:25effectively public because you're
  95. 3:27sending it to everyone who needs to run
  96. 3:28that program. Now, because there are
  97. 3:31good things about compiled languages and
  98. 3:33good things about interpreted languages,
  99. 3:35there's also a third way of doing this,
  100. 3:37which is a bit of both. Instead of the
  101. 3:40compile model where all the work is done
  102. 3:42up front, but can be a little bit
  103. 3:44inflexible,
  104. 3:46or the interpreted model where all the
  105. 3:49work is done on the receiving end, but
  106. 3:51can be a little bit slower.
  107. 3:53We kind of do half and half. Up front,
  108. 3:56we compile it part of the way to what's
  109. 3:58called an intermediate language, which
  110. 4:01takes it as far along the way to machine
  111. 4:03code as it can get while still being
  112. 4:05portable often across platforms.
  113. 4:07You then distribute this, sending it to
  114. 4:10the people who need to run it, and each
  115. 4:12person who runs it takes it the last
  116. 4:15step to take it to machine code on their
  117. 4:17computers. This is sometimes referred to
  118. 4:19as just-in-time or JIT compilation. Now,
  119. 4:22this intermediate language sometimes
  120. 4:24also goes by the name of bytecode. So,
  121. 4:26this process has to happen somehow. It's
  122. 4:29just how much of it happens on your
  123. 4:31machine and how much of it happens on
  124. 4:33mine.
  125. 4:34Now, while theoretically all computer
  126. 4:36languages could use any of these
  127. 4:39methods, the normal usage of any one
  128. 4:41language tends to be one or the other.
  129. 4:44So, for example,
  130. 4:46C, C++, and Objective-C, these are
  131. 4:48typically found as compiled languages.
  132. 4:50So, you need a compiler. Now, the
  133. 4:52compiler can be downloaded for free, but
  134. 4:54are often built into integrated
  135. 4:57development environment applications.
  136. 5:00Now, languages like PHP and JavaScript,
  137. 5:03indeed most languages with the word
  138. 5:04script at the end are usually
  139. 5:06interpreted. And languages like Java,
  140. 5:09C#, VB.NET, and Python use this
  141. 5:12intermediate hybrid approach. Now,
  142. 5:15whether a language is compiled or
  143. 5:17interpreted or somewhere in between
  144. 5:20is rarely a reason by itself to choose a
  145. 5:22language, but it can be something that
  146. 5:24you take into account. If one main
  147. 5:26priority of your program is absolute
  148. 5:28maximum speed running on one single
  149. 5:31platform,
  150. 5:32you'll probably look at a compiled
  151. 5:34language. If you're more interested in
  152. 5:36easily moving your code across multiple
  153. 5:38platforms, you're probably more
  154. 5:40interested in an interpreted one. But
  155. 5:42more usually, you're driven more by what
  156. 5:45you need to do. Do you need to build
  157. 5:47iPhone apps or Windows desktop apps or
  158. 5:49dynamic websites or in our case just
  159. 5:52learn the fundamentals of programming
  160. 5:54and you let that decision drive the
  161. 5:56language choice and the language choice
  162. 5:59will determine whether you're compiled,
  163. 6:01interpreted, or somewhere in the middle.

About this transcript

This page contains the full transcript of Compiler and Interpreter: Compiled Language vs Interpreted Programming Languages by Coding Mentors, generated from the public captions YouTube serves with the video. The transcript has 1,092 words across 163 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.