Programming Concepts

What’s a program?

  • Sequence of statements and comments written in a programming language

Core Concepts

  • input : to get data from various sources. Input can be represented by:

    • function call arguments
    • file
    • networked device
    • online service
    • user input
  • output : to send data to various streams. Output can be represented by:

    • output to the screen
    • output to a file
    • output to an online service or networked device
  • variables : store and reference values

  • classes : encapsulate attributes and methods that define a type of object

  • operations are of various types:

    • mathematical operations
      • arithmetic (e.g., additiona, multiplication)
      • logical (e.g., AND, OR, NOT)
      • comparision (e.g., less than, greater than or equal to, not equal)
    • collections processing operations (e.g., concatenate strings, index a sequence to get the value of the sequence element)
    • bitwise operation
    • and more …
  • conditionals : check for conditions and choose what to execute based on them. Types of conditionals:

    • single branch conditional
    • two-branch conditional
    • multiple-branch conditional
  • loops : do some action repeatedly. Types of loops:

    • loop or iteration a given number of times (e.g., for each element in a collection)
    • loop or iteration while a condition is true (e.g., while condition)
  • functions or methods :

    • define and call named set of instructions