Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Learning New Programming Languages

Learning New Programming Languages

Session at Cohack on 02/20/2021 for Middle and High School students.

Manish Pandit

February 20, 2021

More Decks by Manish Pandit

Other Decks in Programming


  1. About this session We will talk about... ..what complexity is

    solved by programming languages ..basic constructs of a programming language ..how to recognize patterns so it’s easier to pick up new languages
  2. Guess the language! org 0x100 mov dx, msg mov ah,

    9 int 0x21 mov ah, 0x4c int 0x21 msg db 'Hello, World!', 0x0d, 0x0a, '$'
  3. Why do we need Programming Languages Programming Languages help us

    write human readable programs - making it easier to interact with the underlying complexity in a computer. All programs end up being translated in a format that the computer understands.
  4. Microprocessors Microprocessors are the lowest level programmable units in a

    computer. Each processor defines an “architecture”, laying out it’s internal components and a programming manual. Intel 8086 from 1979 AMD64 from 2020
  5. Operating Systems Operating Systems are programs that allow other programs

    to run, and handle basic and primitive operations like memory management, I/O, storage management, etc. Often times Operating Systems are called “System Software”. Can you think of some examples of Operating Systems?
  6. Compilers Compilers convert Higher Level Programming Languages (think human readable)

    to Machine Code (Operating System or processor readable), which can run natively on the Operating System.
  7. Runtime Compilers Runtimes, or “cross-platform-runtimes” host an environment for the

    compiled code to run. Think of it as an another layer between the operating system and the machine code, called bytecode. This allows code to be compiled once, regardless of the operating system, as long as that operating system supports the target runtime. Can you think of some examples of runtimes?
  8. Interpreters Interpreters run program instructions one step at a time,

    by converting them into machine code (or runtime bytecode). You cannot run programs written in an interpreted language without the interpreter being present. You can run code compiled by a compiler without that compiler being present.
  9. Syntax A programming language syntax is a set of rules

    (called grammar) to form statements and expressions. A statement is an instruction to carry a task, like assigning values, or calling other parts of the program. An expression needs to be evaluated to determine the value - like 1+2. Think of the English Language Grammar - the words, their order, and how we start and finish the sentences matters (and makes a huge difference!). All programming language differ in their syntax in varying degrees.
  10. Variables and Types Variables are references to data. Type of

    a Variable indicates the structure of the data the variable references to. Examples - Characters, Integers, Booleans, Floats, Strings..
  11. Keywords Keywords are reserved words in any programming language that

    carry a special meaning to the compiler or interpreter. These cannot be used as variable names. Examples - if, else, while, for..
  12. Conditionals Conditionals are statements that control the flow of the

    code. Usually they’re if-then-else, and each language has a different syntax. Some languages support multiple conditionals - like switch. Recall expressions vs. statements - An if-then-else or if-else is a statement that uses an expression to evaluate the code to execute. if <expression> {..} else {..} if <expression> {..} else if <expression> {..} .. else {..}
  13. Loops Loops allow us to do the same set of

    instructions repeatedly. All modern languages support for-loops, while-loops. Let’s talk about statements and expressions again. A loop is a statement that evaluates an expression to know when to stop looping, among other things. for <expression> {..} while <expression> {..} do {..} while <expression>
  14. Methods or Functions Methods, or functions are blocks of code

    grouped together to process input and provide output. They help with readability and code structure. Functions can call other functions, and can be called from other functions. Most languages have built-in functions for common tasks. Can you tell which function did we see being used in the “Hello, World!” examples?
  15. Code Structure Also referred to as “packaging”. Most languages have

    a way to distribute code so it can be re-used. Packaging also helps manage large codebases by organizing the code in a standard way. You’ll hear terms like modules, libraries, and packages being used to represent this.
  16. Data Structures A data structure is a way to organize

    data so it can be used and managed efficiently. A data structure has a fixed set of functions that can be run on the data contained in it. Can you think of some examples of data structures?
  17. Data Structures Maps - put(K,V), get(K), get_keys() Linked Lists -

    next(), previous(), add(), delete() Queues - enqueue(), dequeue(), peek(), is_empty() Stacks - push(), pop(), peek(), is_empty() Other Data Structures are Arrays, Sets, Lists, Trees, Graphs, etc.
  18. Algorithms Algorithms are a set of ordered instructions that operate

    on input to produce an output. Think of them as recipes - which operate on a set of ingredients to produce a dish.
  19. Algorithms There are standard algorithms to perform common operations in

    computing. Searching Sorting Encrypting Random Number Generation ..
  20. Complexity While there are multiple ways (algorithms) to perform an

    operation (search), the efficiency of the algorithms is measured using complexity. Not all algorithms are created equal. Space complexity - How much memory does the algorithm use Time complexity - How much time does the algorithm take Balancing these 2 complexities is what programmers strive for. These are not numbers (like 2GB or 10s) but are expressed in the relation of the input size of N. A 2N space complexity algorithm would use 2 times the input space, while a log(N) time complexity algorithm would use log(N) time to perform the operation.
  21. Advanced Built in libraries - Data Structures and Algorithms Concurrent

    Programming - Threads, Promises, Futures Advanced I/O - native IO, polling, push
  22. Summary Best tool for the job Familiarize yourself with the

    syntax Look for patterns for conditionals, loops, functions Pick a few algorithms to implement consistently