
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
20 questions
One Step Equations
Presentation
•
KG - University
19 questions
Programming Languages. (II)
Presentation
•
University
19 questions
Dangling and misplaced modifiers
Presentation
•
University
19 questions
Future – Will and Going to
Presentation
•
University
18 questions
Chapter 1 Revision
Presentation
•
University
20 questions
SUBJECT/OBJECT QUESTIONS
Presentation
•
University
16 questions
Older or Wiser?
Presentation
•
University
20 questions
Get Smart Plus 3 Topic 8 was/were
Presentation
•
1st - 4th Grade
Popular Resources on Wayground
20 questions
Math Review
Quiz
•
3rd Grade
15 questions
Fast food
Quiz
•
7th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
19 questions
Classifying Quadrilaterals
Quiz
•
3rd Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
10 questions
Identify Fractions, Mixed Numbers & Improper Fractions
Quiz
•
3rd - 4th Grade
Discover more resources for Computers
20 questions
Guess The App
Quiz
•
KG - Professional Dev...
11 questions
NFL Football logos
Quiz
•
KG - Professional Dev...
19 questions
Minecraft
Quiz
•
6th Grade - Professio...
40 questions
8th Grade Math Review
Quiz
•
8th Grade - University
20 questions
Block Buster Movies
Quiz
•
10th Grade - Professi...
10 questions
Would you rather...
Quiz
•
KG - University
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...
14 questions
Superhero
Quiz
•
1st Grade - University