Lecture 1: Introduction to Computer Programming

Computer

  • A device capable of performing computations at speeds millions (even billions) of times faster than human beings

  • Computer programs are sets of instructions that computers follow to process data

  • Computer programmers are the people that specify the programs

  • Logical Units of a Computer

    • Input Unit - “receiving” section of the computer

    • Output Unit - “shipping” section of the computer

    • Memory Unit - rapid-access, relatively low-capacity “warehouse section of the computer”

    • Arithmetic and Logic Unit - “manufacturing” section of the computer

    • Central Processing Unit (CPU) - “administrative” section of the computer

    • Secondary Storage Unit - long-term, high-capacity “warehousing” section of the computer


Computer Programming

  • The process of designing, writing, testing, debugging, and maintaining the source code of computer programs

  • This source code is written in one or more programming languages (such as JavaScipt, C++, C#, Java, Python, etc.)

  • DEVELOP > TEST > DELIVER > FEEDBACK > DEVELOP…

  • Why Study Programming?

    • The discipline of learning any programming language tends to help in the understanding of computer-based environments, such as GIS or RS

    • This way of thinking involves taking often ambiguously defined problems and breaking them down into computable steps

    • Programming can help us perform complex tasks at a faster rate


Applications of Geomatics and Programming

  • Image matching

  • Map Projections


Programming Language

  • A programming language allows communication between ourselves and the computers that share the common language

  • Like any other languages, it contains syntax and semantics


Types of Computer Languages

  • Machine Languages

    • “natural language” of a computer and as such is defined by its hardware design

  • Assembly Languages

    • uses English-like abbreviations to represent elementary operations. Translator programs called assemblers were developed to convert early assembly-language programs to machine language at computer speeds

  • High-Level Languages

    • To speed the programming process, high-level languages were developed in which single statements could be written to accomplish substantial tasks. Translator programs called compilers convert high-level language programs into machine language


Interpreters vs Compilers



Python

  • a high-level multi-paradigm, programming language, with applications in numerous areas

  • Allows users to express concepts in fewer lines of codes

  • Since its public release in early 1991, a growing community of Python developers and users have improved it to create a mature and well-supported programming language

  • Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms

  • Guido Van Rossum

    • a Dutch researcher at the National Research Institute for Mathematics and Computer Science Amsterdam (CWI), needed a high-level scripting language to accomplish administrative tasks for his research group’s Amoeba distributed operating system

    • Created Python in late 1989, appeared 1991

    • When he began implementing Python, Guido van Rossum was also reading the published scripts from “Monty Python’s Flying Circus”, a BBC comedy series from the 1970s. Van Rossum thought he needed a name that was short, unique, and slightly mysterious, so he decided to call the language Python.

  • Who Uses Python?

    • Google

    • Facebook

    • Spotify

    • Netflix

    • NASA

    • Reddit

  • Why Use Python?

    • Simple and easy to learn

    • Similar to pseudocode (dynamic typing)

    • Code looks like English language

    • Has bindings for most advanced programming modules

    • Used on different platforms (Windows, MacOS, Linux)

    • Most GIS platforms/software uses python for scripting


JavaScript

  • a high-level multi-paradigm, programming language

  • one of the core technologies of the World Wide Web (along with HTML and CSS)

  • Has extended into server development (NodeJS) and even mobile app development (React Native)

  • Designed by Brendan Eich of Netscape, first appeared in 1995


Other Productivity Tools

  • Used to create computer programs faster and more efficiently

  • Help in debugging code and linting (error warnings)

  • Support collaborative development


VS Code

  • a streamlined code editor with support for development operations like debugging, task running, and version control

  • runs on macOS, Linux, and Windows

  • Free for private and commercial use


Git

  • A free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency

  • Git allows and encourages you to have multiple local branches that can be entirely independent of each other. The creation, merging, and deletion of those lines of development takes seconds.