Presentation is loading. Please wait.

Presentation is loading. Please wait.

What is an Object Anyway?

Similar presentations


Presentation on theme: "What is an Object Anyway?"— Presentation transcript:

1 What is an Object Anyway?
IMAT1604 Visual Web Development

2 Stuff to memorise this Week
"A function is a named section of code that does one thing well"

3 What is an Object Anyway?
What is a word? Think about the following word… Shop What springs to mind? A Specific Shop? The act of shopping?

4 Creating Instructions
A word on its own isn’t much use to us however when we combine it with other words we can create instructions. “I want you to go to the shop and get me a tin of peas.”

5 Words are Really Just Symbols
What is this?

6 What if we add other symbols?
Traffic lights and words on a page are all the same they are all symbols that we look at and assign meaning.

7 What is Programming? Programming is about using words and symbols to communicate with a Computer As with our example above we use words / symbols to create instructions or functions that the computer will follow and perform some task. Functions are organised into classes – text files

8 Harry Potter What makes Hermione Granger so irritating?
Why is Ron Weasley more relatable? We need to use the right words correctly

9 Fight or Flight? Lots of errors Not sure about the tutor
Class at inconvenient time Not getting it The importance of determination

10 The Importance of Vocabulary
“Shop, street, road, post box, lamp post, post code, house, flat, house number, left, right ahead, distance, time, street sign, landmark.” These words make up the vocabulary of the streets and roads. We are familiar with these words and can easily make up instructions (functions) using these words. “You want to walk down that street for 10 meters then turn left at the post box. You will then see a sign to the railway station. Follow that sign for 5 meters and the shop is on the left.”

11 Computer Programming Introduces a new Vocabulary
“Class, object, assignment, sequence, variable, RAM, parameter, data type, function, method, property, selection, sequence, integer, string.”

12 The Computer Programmer
The person who knows how to write the correct words / symbols to tell the computer what to do Computers copy and process data Data is made of binary numbers Nobody really likes binary We need a set of commands to control data

13 First Look at Some C# Code
What is wrong with this?

14 The Problem Computers are really fussy
Spotting errors can be difficult at first This gets easier with practice Take a look at the following… Int32 Name; - Variable Name(); - Function “Name” - A string of letters .Name - A method or a property (Probably a property) //Name - A comment (Name) - A parameter

15 New Terms to Understand
Function Method Property Class Instantiation Object

16 Functions “A function is a named section of code that does one thing well.”

17 Functions are building blocks in programming
Functions are used to make Methods Properties Unit tests Event handlers Constructors (Like bread makes toast!)

18 Methods and Properties
Tells the object to perform an action E.g. Multiply Property Allows us to get or change the settings of an object E.g. Count (This will be confusing at first!)

19 Classes A class is a text file that contains related functions making them easier to manage Classes are like recipe books Recipe books dedicated to specific regions Classes dedicated to specific sets of functionality A student manager class might contain… Methods .AddStudent .UpdateStudent .DeleteStudent Properties .Count .HighestStudentGrade

20 So what is an Object Anyway?
An object is the name we give to a class file so that we may access its methods and properties The object in this code is MyStudents Made up by the programmer Associates the word with the class file clsStudents Allowing us to access the function/method AddStudent

21 Instantiation Stuff in green called comments
Create an object MyCompter referencing the code in the class file clsComputer Invokes the function/method TurnOff Instantiation is the act of creating an object from a class.

22 Summary Programming is about using words and symbols to communicate with a Computer We need a system for writing lists of instruction for the computer that makes reasonable sense to human beings We also have some key words for you to start getting to grips with… Function A function is a named section of code that does one thing well Property a property allows us to read or change the settings of an object Method A method tells an object to perform an action Class A class file is a text file that stores functions for a specific task Object An object is the name we give to a class file so that we may access its methods and properties Instantiation Instantiation is the act of creating an object from a class


Download ppt "What is an Object Anyway?"

Similar presentations


Ads by Google