Basics of Programming
Date 02-10-2023
Resources
Key Concepts
- Computer Science
- Computational Thinking
- Problem Solving
- Inputs, Outputs
- Representation | Unary, Binary, Decimal, ASCII, Unicode, Running Times
- Pseudocode
- Scratch | Functions, Arguments, Return Values, Variables, Boolean Expressions, Conditionals, Loops, Events, Threads
Notes
Binary and Computing
- Computers operate using binary, with bits representing zero or one.
- Zeros signify "off", and ones signify "on"
- Computers consist of millions of transistors that switch on and off.
Lightbulb Analogy
- A single lightbulb can only have two states: off (zero) or on (one).
- Multiple light bulbs offer more options and states.
Binary in Text
- Just as numbers use binary patterns of ones and zeros, letters are also represented in binary.
- The ASCII standard maps specific letters to numbers, e.g., A to 65.
Binary in Text Messages
- Text messages are encoded in binary, representing numbers.
- For instance, a message might be represented as 72, 73, and 33 in binary to signify - Hi!
Problem-Solving in Computing
- Problem-solving is central to computer science and programming.
- Solving problems efficiently is crucial.
Phone Book Analogy
- To find a name in a phone book, different search approaches can be used.
- Strategies include linear search, searching two pages at a time, and binary search by dividing and conquering.
Pseudocoding Importance
- Pseudocoding is crucial for two main reasons.
- It helps in logic planning before writing formal code.
- It provides a clear explanation of coding decisions and functionality to others.
Key Pseudocode Language Features
- Pseudocode often includes unique elements:
- Verbs like "pick up," "open," "look at" that represent functions.
- Statements such as "if" or "else if," known as conditionals.
- Expressions that evaluate as true or false, called boolean expressions.
- Statements like "go back to line 3," referred to as loops.
- pick up phone book
- open to middle of phone book
- look at names
- if "Smith" is among names
- call Mike
- else if "Smith" is earlier in book
- open to middle of left half of book
- go to line 3
- else if "Smith" is later in book
- open to middle of right half of book
- go to line 3
- else
- give up
Abstraction in Computer Programming
- Abstraction is a vital concept in programming, alongside pseudocoding.
- It involves simplifying complex problems by breaking them down into smaller, manageable problems.
Example of Abstraction
- Think of hosting a large dinner; cooking the entire meal might be overwhelming.
- Abstraction involves breaking down cooking tasks into smaller steps, making the overall task less challenging.
If Conditionals in Programming
- "If" conditionals are fundamental in programming.
- They are used to check if a specific condition is met, and based on that, the program performs certain actions.
Problem-Solving in Programming
- Programming often involves trial and error.
- When facing difficulties, it's essential to analyze the specific problem at hand, what's working, and what's not to find solutions.
Challenges and Questions
[None]
Reflection
[Good, interesting session, and the teacher is so engaging. I had covered most of this when I studied computing A-level however it has been a while, and so its very nice to have a refresher.]
Top comments (0)