Overview

Background

Learning a programming language starts with learning the specifications of elemenatary pieces or building blocks.

  • Language specifications
    • Building blocks: specifications for elements and blocks of code
    • Architecture: specifications for writing programs
      • means to combine elements and blocks to build programs
      • management of execution of blocks behind the scenes
  • Design: knowledge of how to write good programs
  • Tools: needed to write, test, debug and run programs

Introduction

Building blocks comprise of following elements which provide the basic elements to write code.

  • Basic specifications
    • Lexicons: allowed symbols and characters
    • Variables: mechanism of storing and re-using information
    • Comments: annotating code
  • Data types and operations: storing and operating on numbers, strings, collections
  • Control flow blocks
    • Conditional exectution blocks: if-elif-else, match-case
    • Loops (Iteration): for, while
  • Functions: re-use code with configurable inputs
  • Object Oriented Programming (OOP): re-use predefined type of data and associated operations
  • Special features: Python specific extra features
    • Conditional expressions: short-circuit, context aware evaluation
    • Comprehensions: special short syntax to combine transformation iteration filter

Objectives

Building blocks are introduced with related specifications (lexicons, syntax, semantics). Examples are provided to demonstrate implications of the specifications to demonstrate experimentation. Specifications are limited and easy to understand, implications are a lot as they grow with application and combination of the specifications.

Building blocks can be combined in multiple directions to solve problems. Multiple direction means a conditional block can contain a function, and a function can contain a conditional block. Therefore there are multiple ways to combine different elements, but not all are same in terms of readability elegance and efficiency.

The objectives for this part are to

  • Learn specifications (lexicons, syntax, semantics) for the building blocks
    • Understand semantic specifications and their implications
    • do experiments in isolation
  • Introduce basic examples of combining different building blocks
  • Tools: Jupyter notebook in editor (VSCode or Jupyter lab)