
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
16 questions
HOSPITALITY AND INFORMATION SYSTEM
Presentation
•
University
18 questions
Bài học Giới thiệu gôn ngữ lập trình
Presentation
•
University
16 questions
Soccer Ball game scratch 1
Presentation
•
University
17 questions
Prentasi Tim Bakase
Presentation
•
University
18 questions
Computing Facts & Knowledge
Presentation
•
University
19 questions
INGLES 1 - Sesión 2 Greetings and Farewells
Presentation
•
University
19 questions
General Interview Question
Presentation
•
University
16 questions
Subject, object, possessive pronouns & possesive adjectives
Presentation
•
University
Popular Resources on Wayground
24 questions
PBIS-HGMS Day 10
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Review 3
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
15 questions
HCS SCI 05 Summer School Assessment 3 Review
Quiz
•
5th Grade
35 questions
Lufkin Road Middle School Student Handbook & Policies Assessment
Quiz
•
7th Grade
18 questions
Geo 11.3 Area of Circles and Sectors
Quiz
•
9th - 11th Grade