101.school
CoursesAbout
Search...⌘K
Generate a course with AI...

    Intro to computers and programming

    Receive aemail containing the next unit.
    • Computer Basics
      • 1.1Overview of Computers
      • 1.2Understanding Operating Systems
      • 1.3Understanding Computer Networks
    • Introduction to Programming
      • 2.1What is Programming?
      • 2.2Basics of a Program
      • 2.3How a Program Runs on a Computer
    • Introduction to Coding
      • 3.1Writing your First Code
      • 3.2Language of Coding
      • 3.3Common Coding Practices
    • Scripting Basics
      • 4.1What is Scripting?
      • 4.2Difference Between Coding and Scripting
      • 4.3First Look at Shell Scripts
    • Basics of a Programming Language
      • 5.1Understanding Syntax
      • 5.2Basic Constructs – Loops & Conditionals
      • 5.3Functions and Procedures
    • Intermediate Programming
      • 6.1Arrays and Lists
      • 6.2File Handling
      • 6.3Error Handling
    • Introduction to Object Oriented Programming
      • 7.1Principles of Object Oriented Programming
      • 7.2Classes and Objects
      • 7.3Inheritance and Encapsulation
    • Practical Uses of Scripting
      • 8.1Process Automation with Scripts
      • 8.2Using Scripts for Data Manipulation
      • 8.3Web Scraping with Scripts
    • Algorithms and Data Structures
      • 9.1Basics of Algorithms
      • 9.2Introduction to Data Structures
      • 9.3Practical Uses of Data Structures
    • Code Efficiency
      • 10.1Writing Efficient Code
      • 10.2Debugging and Testing
      • 10.3Code Performance Analysis
    • Managing Code Project
      • 11.1Understanding Version Control
      • 11.2Use of GitHub for Project Management
      • 11.3Collaborative Coding Practices
    • Real World Coding Examples
      • 12.1Review and Analysis of Real World Code
      • 12.2Case Study—Use of Code in Solving Real World Problems
      • 12.3Building and Presenting a Mini Coding Project
    • Future Learning and Wrap Up
      • 13.1Essentials for Advanced Learning
      • 13.2Overview of Other Programming Languages
      • 13.3Course Wrap Up and Next Steps

    Introduction to Programming

    How a Program Runs on a Computer

    program that executes source code without a separate compilation step

    Program that executes source code without a separate compilation step.

    In this unit, we will delve into the process of how a program runs on a computer. This involves understanding the roles of compilers and interpreters, the concept of source code, object code, and executable code, and the different types of errors that can occur during the process.

    The Process of Compiling and Interpreting a Program

    When you write a program, you write it in a high-level language that humans can understand. However, computers can only understand machine language, which is a low-level language. The process of translating high-level language into machine language is done by a compiler or an interpreter.

    A compiler takes the entire program written in high-level language, translates it into machine language, and saves it as an object code (also known as binary code). This object code is then linked to create an executable file that can be run on a computer.

    An interpreter, on the other hand, translates the high-level language into machine language line by line as the program is running. It does not create an object code or an executable file.

    Source Code, Object Code, and Executable Code

    Source code is the program as it is written by the programmer. It is written in a high-level language and is readable by humans.

    Object code is the result of the source code being translated by the compiler. It is written in machine language and is not easily readable by humans.

    Executable code is the linked object code that can be run on a computer. It is also written in machine language.

    Understanding Errors: Syntax, Runtime, and Logical Errors

    Errors are common in programming and are a part of the learning process. There are three main types of errors that can occur:

    1. Syntax errors: These are mistakes in the language of the program. They can be as simple as a missing semicolon or as complex as a missing closing bracket. Syntax errors prevent the program from being compiled or interpreted.

    2. Runtime errors: These errors occur during the execution of the program. They are often caused by illegal operations such as dividing by zero or trying to access an array element that does not exist.

    3. Logical errors: These are the most difficult to detect. They occur when the program runs without crashing, but produces incorrect results. Logical errors are often due to mistakes in the program's logic.

    Understanding how a program runs on a computer is crucial for anyone learning to code. It helps you understand the process your code goes through before it can be run and the potential issues that can arise during this process.

    Test me
    Practical exercise
    Further reading

    Buenos dias, any questions for me?

    Sign in to chat
    Next up: Writing your First Code