Foundation – Classroom Notes- 11/08/2021

Why do we have programming languages?

  • Machine code is very difficult to write for us humans, but easier for machines to understand.
  • It also takes time to write a program, find errors and update the new features.
  • High level programming languages can help us here. They enable us to write our own code to program the system. At least to some degree they resemble english
  • Lets look at this code snippet from machine code
  msgEqual db "Equal", "$"
  msgNotEqual db "NotEqual", "$"
main proc
   mov bl,"Alice"
   mov bh,"Bob"
   cmp bh, bl
   jne NotEqual
   mov ax, seg msgEqual
   mov ds,ax
   mov ah, 09h
   lea dx, msgEqual
   mov ah, 4Ch
   int 21h
   mov ax, seg msgNotEqual
   mov ds,ax
   mov ah, 09h
   lea dx, msgNotEqual
main endp
end main
  • Lets look at some higer level programming
IF "Alice" == "Bob" THEN
   print "Equal"
   print "Not Equal"
  • When we write higher level programming using languages then to execute they needed to be converted to machine code.
  • To convert the higher level programming into machine understandable format, we have
    • Compilers:
      • Compilers compile the high level language into low level language
      • Compilation happens before execution
      • If language uses Compiler then to make our application work in
        • Windows: We have to compile to Windows Macine code
        • MAC: We have to compile to Mac Macine code
      • i.e We need to compile our application for different platforms
      • Compile applications can directly run on target platforms
    • Interpreters:
      • Intepreters convert the high level language into low level language
      • Interpretation happens during execution.
      • Since it happens during execution, we need the interpreter software to be installed on the machine where we execute our application
  • In the modern world languages like C#, Java, Python Go with the hybrid mode i.e. these lanugages use both compilation and interpreters Preview

Hierarchy of programming languages



  • I know a kid Anil Preview
  • Anil knows only addition. (adding numbers)
  • Now i want to make anil multiply numbers without teaching about multiplications
  • I want anil to do 3*2
  • So if i want anil to do 5 * 4
5 + 5 + 5 + 5

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner