
OOP Lesson 1
Presentation
•
Computers
•
University
•
Practice Problem
•
Easy
Karen Ahmed
Used 5+ times
FREE Resource
16 Slides • 7 Questions
1
Object-Oriented Programming
Lesson 1: Introduction to OOP
2
What is Object-Oriented Programming?
3
OOP in Action
The OOP paradigm is focussed on objects which represent parts of a computer program.
You can create objects to represent physical things, like a human being.
They can also be used for small parts of a larger program, like a widget in a user interface.
4
Classes
To create objects, you must first define a class.
A class is like a blueprint, it contains the plans for the data and behaviours an object should possess.
You can create many objects from a single class.
Just like you can make many houses from the same blueprint.
5
Objects
You can use a class to create enemies in a video game.
One class details what information the enemies can hold and the behaviour it has.
Objects would be the actual enemies in the game.
Each ghost is an object in the game with a slightly different behaviour.
6

PACMAN with Turtle - Replit
You can open this webpage in a new tab.
7
Object Behaviour
Ghost objects can choose their own behaviour based a the set of defined rules.
Each ghost has its own attributes: colour, speed, name.
They all move independently of each other.
8
Classes and Objects
One of the classes used in this program is called turtle.
We import the class so that it can be used to make objects.
The objects created are: blinky, pinky, inky and clyde.
These are actually the variables used to store the objects.
9
Multiple Choice
A template used to create objects...
Subroutine
Function
Class
10
Multiple Choice
An instance of a class...
Object
Function
Variable
11
Introduction to C#
12
C#
This programming language can be used to make interactive websites, mobile apps, video games, augmented reality (AR), virtual reality (VR), desktop applications, and back-end services – just to name a few.
For example, the mobile game Pokemon Go and the Stack Overflow website were built with frameworks that can be run with C# (Unity and ASP.NET, respectively).
13
Unlike languages like Ruby and JavaScript, C# has you define the type of each data in a program.
Assigning a type essentially tells a computer what operations can and cannot be performed on a piece of data.
This style of coding helps programmers avoid a large class of errors that are common to Ruby and JavaScript.
C# Data Types
14
Hello World
Console.WriteLine() is a command that prints text to a console.
Whatever is in between the parentheses will be printed to the console!
In this case it’s Hello World!
Task: Start a new project in Visual Studio and change the code so that your own name is printed to the console!
15

HelloWorld - Replit
You can open this webpage in a new tab.
16
Getting Input
We can also read input from a user. The command Console.ReadLine() captures text that a user types into the console.
In this example, the program writes a question to the console and waits for user input. Once the user types something and presses Enter (or Return), the input is printed back out to the user.
17
Comments
Text written in a program but not run by the computer is called a comment.
In C#, anything after a // or between /* and */ is a comment.
Comments can:
Provide context for why something is written the way it is:
Help other people reading the code understand it faster:
Ignore a line of code and see how a program will run without it:
18
Multiple Choice
In C#, what are these lines of code called?
Output
Comments
Inputs
Commands
19
Multiple Choice
What is the outcome of these lines of code?
The text "Let's get started" is printed
No text is printed until the user types into the console
The text "Press Enter to begin..." and the computer waits for the user to press Enter
The texts "Press Enter to begin..." and "Let's get started!" are printed
20
Multiple Choice
What is the outcome of this line of code?
The computer waits for the user to type something
The computer outputs whatever the user last entered
The computer outputs "Console.ReadLine()"
The computer copies all of the text in the console
21
Multiple Choice
What is the outcome of this line of code?
The text WriteLine is printed
The text Console.WriteLine("Open Sesame!") is printed
The text "Open Sesame" is printed
No text is printed
22
Multiple Choice
What is NOT a good reason to use comments in your code?
Ignore a line of code to see how a program will run without it
Provide context why something is written the way it is
Help other people reading the code to understand it faster
To instruct a computer to execute a block of code
23

ConsoleCreatures - Replit
You can open this webpage in a new tab.
Object-Oriented Programming
Lesson 1: Introduction to OOP
Show answer
Auto Play
Slide 1 / 23
SLIDE
Similar Resources on Wayground
17 questions
Java GUI Unit 10
Presentation
•
University
16 questions
SAD-Chapter 2- PM
Presentation
•
University
16 questions
Simple Present
Presentation
•
University
18 questions
AI for Teach session 2
Presentation
•
University
21 questions
INput / OUTput Devices
Presentation
•
12th Grade
19 questions
GE STS- SCIENCE, TECHNOLOGY AND SOCIETY
Presentation
•
University
17 questions
ITOM Topic 10 & 11
Presentation
•
University
18 questions
going to
Presentation
•
University - Professi...
Popular Resources on Wayground
6 questions
Secondary Safety Quiz
Presentation
•
9th - 12th Grade
10 questions
MyPath Diagnostic Overview
Presentation
•
6th - 8th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Adding and Subtracting Decimals
Quiz
•
5th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
21 questions
Lab Safety
Quiz
•
10th Grade
Discover more resources for Computers
20 questions
Disney Trivia
Quiz
•
University
20 questions
Brand Trivia
Quiz
•
9th Grade - University
10 questions
Would you rather...
Quiz
•
KG - University
21 questions
Mapa países hispanohablantes
Quiz
•
1st Grade - University
10 questions
Spanish Greetings and Goodbyes!
Presentation
•
6th Grade - University
12 questions
CE 2b Early Documents Review
Quiz
•
7th Grade - University
30 questions
Multiplying and Dividing Integers
Quiz
•
6th Grade - University
13 questions
Back to School
Quiz
•
KG - University