Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Language Introduction and Resources to get started

Slide 3

Slide 3 text

A few things before we get started Software development is a craft

Slide 4

Slide 4 text

A few things before we get started Software development is a craft ● The basics can be explained

Slide 5

Slide 5 text

A few things before we get started Software development is a craft ● The basics can be explained ● But it requires practice

Slide 6

Slide 6 text

A few things before we get started Software development is a craft ● The basics can be explained ● But it requires practice ● A lot of practice

Slide 7

Slide 7 text

A few things before we get started Software development is a craft ● The basics can be explained ● But it requires practice ● A lot of practice ● For a very long time

Slide 8

Slide 8 text

http://norvig.com/21-days.html

Slide 9

Slide 9 text

Define the defines Programming language: “A programming language is a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks.” - https://www.webopedia.com/TERM/P/programming_language.html

Slide 10

Slide 10 text

Define the defines Programming language: “A programming language is a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks.” - https://www.webopedia.com/TERM/P/programming_language.html Programming: “The process of writing computer programs.” - https://www.webopedia.com/Programming

Slide 11

Slide 11 text

Define the defines Programming language: “A programming language is a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks.” - https://www.webopedia.com/TERM/P/programming_language.html Programming: “The process of writing computer programs.” - https://www.webopedia.com/Programming Programmer: “The poor soul that has to do all of this work” - me

Slide 12

Slide 12 text

Highest of levels Sometimes programming languages are called either high or low level languages.

Slide 13

Slide 13 text

Highest of levels Sometimes programming languages are called either high or low level languages. I want to call all of them “High Level Languages”, it’s just how high it is, because no language (not even assembly) perfectly describes what is happening on your processor.

Slide 14

Slide 14 text

Highest of levels Sometimes programming languages are called either high or low level languages. I want to call all of them “High Level Languages”, it’s just how high it is, because no language (not even assembly) perfectly describes what is happening on your processor. But that’s just me.

Slide 15

Slide 15 text

Different approaches There are a few ways to approach learning software development.

Slide 16

Slide 16 text

Different approaches There are a few ways to approach learning software development. A very high level approach Just start doing stuff, don’t explain the guts. Similar to learning to drive a car, just press the pedal, don’t explain what is going on.

Slide 17

Slide 17 text

Different approaches There are a few ways to approach learning software development. A very high level approach Just start doing stuff, don’t explain the guts. Similar to learning to drive a car, just press the pedal, don’t explain what is going on. A very low level approach Don’t start programming, explain all the nitty gritty details. Similar to learning math, you learn all these methods and types of mathematics before you can start applying them.

Slide 18

Slide 18 text

A little bit different I want to try a little bit of a different approach

Slide 19

Slide 19 text

A little bit different I want to try a little bit of a different approach A constructivist approach We’re going to “create core C++ language features” as soon as we have a problem that this feature solves.

Slide 20

Slide 20 text

Features The reason is, all features have a purpose. That purpose is to solve a problem.

Slide 21

Slide 21 text

Features The reason is, all features have a purpose. That purpose is to solve a problem. So let’s look at the language and we will ONLY introduce a feature when we stumble upon a problem.

Slide 22

Slide 22 text

Features The reason is, all features have a purpose. That purpose is to solve a problem. So let’s look at the language and we will ONLY introduce a feature when we stumble upon a problem. And since I don’t have that much time, I’m going to focus on the core language.

Slide 23

Slide 23 text

Let’s go!

Slide 24

Slide 24 text

Numbers Every single thing in a computer, is represented by a number.

Slide 25

Slide 25 text

Numbers Every single thing in a computer, is represented by a number. Everything. Even text. So we will start with focusing on numbers.

Slide 26

Slide 26 text

Numbers Every single thing in a computer, is represented by a number. Everything. Even text. So we will start with focusing on numbers. You might have heard that numbers in computers are stored as binary (0101010) but let’s focus on normal whole numbers. Called integers. No fractions, just simple positive or negative numbers.

Slide 27

Slide 27 text

What can we do with a number? The number is the value of itself. So we can represent the number.

Slide 28

Slide 28 text

What can we do with a number? The number is the value of itself. So we can represent the number. 5

Slide 29

Slide 29 text

What can we do with a number? The number is the value of itself. So we can represent the number. 5 We can add a number with another number

Slide 30

Slide 30 text

What can we do with a number? The number is the value of itself. So we can represent the number. 5 We can add a number with another number 5 + 2

Slide 31

Slide 31 text

What can we do with a number? The number is the value of itself. So we can represent the number. 5 We can add a number with another number 5 + 2 We can subtract, multiply and divide (division will round down)

Slide 32

Slide 32 text

Ok, but then what? 5 + 2 This is 7 when the addition is done, but then what, now we’re just left with the number 7. What if I want to add 3 to the number 7?

Slide 33

Slide 33 text

Ok, but then what? 5 + 2 This is 7 when the addition is done, but then what, now we’re just left with the number 7. What if I want to add 3 to the number 7? (5 + 2) + 3 Ok, but this can get out of hand quick.

Slide 34

Slide 34 text

Ok, but then what? 5 + 2 This is 7 when the addition is done, but then what, now we’re just left with the number 7. What if I want to add 3 to the number 7? (5 + 2) + 3 Ok, but this can get out of hand quick. Problem: What if I want to add some numbers together and then later on add some more numbers?

Slide 35

Slide 35 text

Memory Computers have memory. And they store numbers in that memory. Seems like a perfect fit.

Slide 36

Slide 36 text

Memory Computers have memory. And they store numbers in that memory. Seems like a perfect fit. But how do I put a number into memory?

Slide 37

Slide 37 text

Variables A variable is a programming language feature focused on storing data (numbers) to be used later.

Slide 38

Slide 38 text

Variables A variable is a programming language feature focused on storing data (numbers) to be used later. They need to have a name so you can reference them later. The name is given by you.

Slide 39

Slide 39 text

Variables A variable is a programming language feature focused on storing data (numbers) to be used later. They need to have a name so you can reference them later. The name is given by you. numberOfStudents = 4

Slide 40

Slide 40 text

Variables A variable is a programming language feature focused on storing data (numbers) to be used later. They need to have a name so you can reference them later. The name is given by you. numberOfStudents = 4 numberOfStudents = 5 numberOfStudents = 4 + 2

Slide 41

Slide 41 text

Variables A variable is a programming language feature focused on storing data (numbers) to be used later. They need to have a name so you can reference them later. The name is given by you. numberOfStudents = 4 numberOfStudents = 5 numberOfStudents = 4 + 2 = is not equals but assignment. Think of a variable as a box, you name the box and put stuff in it (a number)

Slide 42

Slide 42 text

Variables continued numberOfStudents = 5

Slide 43

Slide 43 text

Variables continued numberOfStudents = 5 numberOfTeachers = 2

Slide 44

Slide 44 text

Variables continued numberOfStudents = 5 numberOfTeachers = 2 totalClassSize = numberOfStudents + numberOfTeachers

Slide 45

Slide 45 text

Variables continued numberOfStudents = 5 numberOfTeachers = 2 totalClassSize = numberOfStudents + numberOfTeachers The calculation on the right hand side of totalClassSize is done first. Think of it like this.

Slide 46

Slide 46 text

Variables continued numberOfStudents = 5 numberOfTeachers = 2 totalClassSize = numberOfStudents + numberOfTeachers The calculation on the right hand side of totalClassSize is done first. Think of it like this. totalClassSize = numberOfStudents + numberOfTeachers

Slide 47

Slide 47 text

Variables continued numberOfStudents = 5 numberOfTeachers = 2 totalClassSize = numberOfStudents + numberOfTeachers The calculation on the right hand side of totalClassSize is done first. Think of it like this. totalClassSize = numberOfStudents + numberOfTeachers totalClassSize = 5 + 2

Slide 48

Slide 48 text

Variables continued numberOfStudents = 5 numberOfTeachers = 2 totalClassSize = numberOfStudents + numberOfTeachers The calculation on the right hand side of totalClassSize is done first. Think of it like this. totalClassSize = numberOfStudents + numberOfTeachers totalClassSize = 5 + 2 totalClassSize = 7

Slide 49

Slide 49 text

What numbers? Can we store zero? Yes

Slide 50

Slide 50 text

What numbers? Can we store zero? Yes What is the biggest/smallest number we can store? Depends on your computer

Slide 51

Slide 51 text

What numbers? Can we store zero? Yes What is the biggest/smallest number we can store? Depends on your computer What do you mean depends on your computer? Is it 8bit, 16bit, 32bit, 64bit?

Slide 52

Slide 52 text

What numbers? Can we store zero? Yes What is the biggest/smallest number we can store? Depends on your computer What do you mean depends on your computer? Is it 8bit, 16bit, 32bit, 64bit? Problem: What a number is depends on your computer. How can we be more specific so there is no confusion?

Slide 53

Slide 53 text

Types A type is a way to tell the programming language what you are going to put into the variable. (For these cases, we are going to assume you are using a 32 or 64bit computer)

Slide 54

Slide 54 text

from -2147483648 to 2147483647 from -32768 to 32767 from -128 to 127 either true or false nothing Types A type is a way to tell the programming language what you are going to put into the variable. (For these cases, we are going to assume you are using a 32 or 64bit computer) int short char bool void

Slide 55

Slide 55 text

Using types Types come before you create any variable, not when you use it. Only when you want to make a new variable.

Slide 56

Slide 56 text

Using types Types come before you create any variable, not when you use it. Only when you want to make a new variable. int numberOfStudents = 5 int numberOfTeachers = 2 int totalClassSize = numberOfStudents + numberOfTeachers

Slide 57

Slide 57 text

Using types Types come before you create any variable, not when you use it. Only when you want to make a new variable. int numberOfStudents = 5 int numberOfTeachers = 2 int totalClassSize = numberOfStudents + numberOfTeachers Now we know what the biggest number we can store, no confusion there.

Slide 58

Slide 58 text

These are too many lines! I want to be able to cram all the code I can into as few lines as I can, so I can read it like a book!

Slide 59

Slide 59 text

These are too many lines! I want to be able to cram all the code I can into as few lines as I can, so I can read it like a book! int numberOfStudents = 5 int numberOfTeachers = 2 int totalClassSize = numberOfStudents + numberOfTeachers

Slide 60

Slide 60 text

These are too many lines! I want to be able to cram all the code I can into as few lines as I can, so I can read it like a book! int numberOfStudents = 5 int numberOfTeachers = 2 int totalClassSize = numberOfStudents + numberOfTeachers Problem: How can the programming language know where one statement ends and another begins

Slide 61

Slide 61 text

Almost a colon In C++ a semicolon is used to mark when a statement ends.

Slide 62

Slide 62 text

Almost a colon In C++ a semicolon is used to mark when a statement ends. int numberOfStudents = 5; int numberOfTeachers = 2; int totalClassSize = numberOfStudents + numberOfTeachers;

Slide 63

Slide 63 text

Almost a colon In C++ a semicolon is used to mark when a statement ends. int numberOfStudents = 5; int numberOfTeachers = 2; int totalClassSize = numberOfStudents + numberOfTeachers; Now you can remove all newlines if you want, but remember, code is for you to read, the computer does not read it like you do.

Slide 64

Slide 64 text

I have my personal preferences The code I have now is great and all. But it’s kinda linear.

Slide 65

Slide 65 text

I have my personal preferences The code I have now is great and all. But it’s kinda linear. I want to add another teacher to the classroom if the number of students is over 10. But there is no way for me to do this with only variables.

Slide 66

Slide 66 text

I have my personal preferences The code I have now is great and all. But it’s kinda linear. I want to add another teacher to the classroom if the number of students is over 10. But there is no way for me to do this with only variables. Problem: How can we run code only if a specific criteria is met?

Slide 67

Slide 67 text

Conditional statements We can ask questions about the contents of variables with an if statement.

Slide 68

Slide 68 text

Conditional statements We can ask questions about the contents of variables with an if statement. int numberOfStudents = 11;

Slide 69

Slide 69 text

Conditional statements We can ask questions about the contents of variables with an if statement. int numberOfStudents = 11; int numberOfTeachers = 2;

Slide 70

Slide 70 text

Conditional statements We can ask questions about the contents of variables with an if statement. int numberOfStudents = 11; int numberOfTeachers = 2; if(numberOfStudents > 10)

Slide 71

Slide 71 text

Conditional statements We can ask questions about the contents of variables with an if statement. int numberOfStudents = 11; int numberOfTeachers = 2; if(numberOfStudents > 10) { }

Slide 72

Slide 72 text

Conditional statements We can ask questions about the contents of variables with an if statement. int numberOfStudents = 11; int numberOfTeachers = 2; if(numberOfStudents > 10) { numberOfTeachers = numberOfTeachers + 1; }

Slide 73

Slide 73 text

Conditional statements We can ask questions about the contents of variables with an if statement. int numberOfStudents = 11; int numberOfTeachers = 2; if(numberOfStudents > 10) { numberOfTeachers = numberOfTeachers + 1; } If the question inside the ( ) is true, then the statement (or statements) between the { } is executed. Otherwise we skip over it.

Slide 74

Slide 74 text

Other conditional statements If you want to keep running the statements between the { } until the question becomes false, you can use while instead of if

Slide 75

Slide 75 text

Other conditional statements If you want to keep running the statements between the { } until the question becomes false, you can use while instead of if int sum = 0;

Slide 76

Slide 76 text

Other conditional statements If you want to keep running the statements between the { } until the question becomes false, you can use while instead of if int sum = 0; int valueToAdd = 3;

Slide 77

Slide 77 text

Other conditional statements If you want to keep running the statements between the { } until the question becomes false, you can use while instead of if int sum = 0; int valueToAdd = 3; while(sum < 10) { }

Slide 78

Slide 78 text

Other conditional statements If you want to keep running the statements between the { } until the question becomes false, you can use while instead of if int sum = 0; int valueToAdd = 3; while(sum < 10) { sum = sum + valueToAdd; }

Slide 79

Slide 79 text

Other conditional statements If you want to keep running the statements between the { } until the question becomes false, you can use while instead of if int sum = 0; int valueToAdd = 3; while(sum < 10) { sum = sum + valueToAdd; } When we reach the bottom of the }, we jump back up to the while and ask the question again. Forever, until it is false. Then we jump over it.

Slide 80

Slide 80 text

Great, now I can make my classroom int numberOfStudentsA = 5;

Slide 81

Slide 81 text

Great, now I can make my classroom int numberOfStudentsA = 5; int numberOfTeachersA = 2;

Slide 82

Slide 82 text

Great, now I can make my classroom int numberOfStudentsA = 5; int numberOfTeachersA = 2; if(numberOfStudentsA > 10) { }

Slide 83

Slide 83 text

Great, now I can make my classroom int numberOfStudentsA = 5; int numberOfTeachersA = 2; if(numberOfStudentsA > 10) { numberOfTeachersA = numberOfTeachersA + 1; }

Slide 84

Slide 84 text

Great, now I can make my classroom int numberOfStudentsA = 5; int numberOfTeachersA = 2; if(numberOfStudentsA > 10) { numberOfTeachersA = numberOfTeachersA + 1; } int numberOfStudentsB = 11;

Slide 85

Slide 85 text

Great, now I can make my classroom int numberOfStudentsA = 5; int numberOfTeachersA = 2; if(numberOfStudentsA > 10) { numberOfTeachersA = numberOfTeachersA + 1; } int numberOfStudentsB = 11; int numberOfTeachersB = 2;

Slide 86

Slide 86 text

Great, now I can make my classroom int numberOfStudentsA = 5; int numberOfTeachersA = 2; if(numberOfStudentsA > 10) { numberOfTeachersA = numberOfTeachersA + 1; } int numberOfStudentsB = 11; int numberOfTeachersB = 2; if(numberOfStudentsB > 10) { }

Slide 87

Slide 87 text

Great, now I can make my classroom int numberOfStudentsA = 5; int numberOfTeachersA = 2; if(numberOfStudentsA > 10) { numberOfTeachersA = numberOfTeachersA + 1; } int numberOfStudentsB = 11; int numberOfTeachersB = 2; if(numberOfStudentsB > 10) { numberOfTeachersB = numberOfTeachersB + 1; }

Slide 88

Slide 88 text

This is tedious Problem: Why do I have to keep writing the same code again and again for each classroom?

Slide 89

Slide 89 text

This is tedious Problem: Why do I have to keep writing the same code again and again for each classroom? I’m going to make a mistake somewhere in this mess, I have 10 classrooms and all sorts of other conditions I have to uphold.

Slide 90

Slide 90 text

This doesn’t function. A function is a programming language feature where you can define a set of statements and wrap them in a nice little package and give it a name.

Slide 91

Slide 91 text

This doesn’t function. A function is a programming language feature where you can define a set of statements and wrap them in a nice little package and give it a name. int add(int numberA, int numberB) { }

Slide 92

Slide 92 text

This doesn’t function. A function is a programming language feature where you can define a set of statements and wrap them in a nice little package and give it a name. int add(int numberA, int numberB) { return numberA + numberB; }

Slide 93

Slide 93 text

This doesn’t function. A function is a programming language feature where you can define a set of statements and wrap them in a nice little package and give it a name. int add(int numberA, int numberB) { return numberA + numberB; } A function can then be used anywhere in the program (after it has been defined) to perform the action and then store it in a variable.

Slide 94

Slide 94 text

It does function So let’s take the logic we had before, for the teacher and place it in a function.

Slide 95

Slide 95 text

It does function So let’s take the logic we had before, for the teacher and place it in a function. int GetTeacherCount(int studentCount) { }

Slide 96

Slide 96 text

It does function So let’s take the logic we had before, for the teacher and place it in a function. int GetTeacherCount(int studentCount) { int numberOfTeachers = 2; }

Slide 97

Slide 97 text

It does function So let’s take the logic we had before, for the teacher and place it in a function. int GetTeacherCount(int studentCount) { int numberOfTeachers = 2; if(studentCount > 10) { } }

Slide 98

Slide 98 text

It does function So let’s take the logic we had before, for the teacher and place it in a function. int GetTeacherCount(int studentCount) { int numberOfTeachers = 2; if(studentCount > 10) { numberOfTeachers = numberOfTeachers + 1; } }

Slide 99

Slide 99 text

It does function So let’s take the logic we had before, for the teacher and place it in a function. int GetTeacherCount(int studentCount) { int numberOfTeachers = 2; if(studentCount > 10) { numberOfTeachers = numberOfTeachers + 1; } return numberOfTeachers; }

Slide 100

Slide 100 text

A bit simpler int GetTeacherCount(int studentCount) { int numberOfTeachers = 2; if(studentCount > 10) { numberOfTeachers = numberOfTeachers + 1; } return numberOfTeachers; }

Slide 101

Slide 101 text

A bit simpler int GetTeacherCount(int studentCount) { int numberOfTeachers = 2; if(studentCount > 10) { numberOfTeachers = numberOfTeachers + 1; } return numberOfTeachers; } int numberOfStudentsA = 5;

Slide 102

Slide 102 text

A bit simpler int GetTeacherCount(int studentCount) { int numberOfTeachers = 2; if(studentCount > 10) { numberOfTeachers = numberOfTeachers + 1; } return numberOfTeachers; } int numberOfStudentsA = 5; int numberOfTeachersA = GetTeacherCount(numberOfStudentsA);

Slide 103

Slide 103 text

A bit simpler int GetTeacherCount(int studentCount) { int numberOfTeachers = 2; if(studentCount > 10) { numberOfTeachers = numberOfTeachers + 1; } return numberOfTeachers; } int numberOfStudentsA = 5; int numberOfTeachersA = GetTeacherCount(numberOfStudentsA); int numberOfStudentsB = 11;

Slide 104

Slide 104 text

A bit simpler int GetTeacherCount(int studentCount) { int numberOfTeachers = 2; if(studentCount > 10) { numberOfTeachers = numberOfTeachers + 1; } return numberOfTeachers; } int numberOfStudentsA = 5; int numberOfTeachersA = GetTeacherCount(numberOfStudentsA); int numberOfStudentsB = 11; int numberOfTeachersB = GetTeacherCount(numberOfStudentsB);

Slide 105

Slide 105 text

There are more problems. Problem: Why do I have to always have 2 variables, one for the teacher count and one for the student count, can’t I just group them together somehow?

Slide 106

Slide 106 text

There are more problems. Problem: Why do I have to always have 2 variables, one for the teacher count and one for the student count, can’t I just group them together somehow? Problem: What if I want to have 100 classes, is this then going to turn into a very long file? I don’t want to write all that!

Slide 107

Slide 107 text

Now it’s your turn There are countless locations to learn this language

Slide 108

Slide 108 text

Now it’s your turn There are countless locations to learn this language https://www.learncpp.com/ https://www.learn-cpp.org/

Slide 109

Slide 109 text

Now it’s your turn There are countless locations to learn this language https://www.learncpp.com/ https://www.learn-cpp.org/ https://www.udemy.com/free-learn-c-tutorial-beginners/

Slide 110

Slide 110 text

Now it’s your turn There are countless locations to learn this language https://www.learncpp.com/ https://www.learn-cpp.org/ https://www.udemy.com/free-learn-c-tutorial-beginners/ And not only for C++, many of the concepts we have talked about apply to many other programming languages. The idea is usually the same but it might be written differently.

Slide 111

Slide 111 text

Tools of the trade So what do I need to write code? Well, to get started you need just a computer and internet. There are so many online tools you can use as a way to kickstart your education. http://www.cpp.sh https://www.onlinegdb.com/online_c++_compiler https://wandbox.org/ http://coliru.stacked-crooked.com/

Slide 112

Slide 112 text

I want bigger and better For windows you have Visual Studio: https://visualstudio.microsoft.com/vs/ For mac you have Xcode: https://developer.apple.com/xcode/ And cross platform you have VSCode: https://code.visualstudio.com/ CLion: https://www.jetbrains.com/clion/ Code::Blocks: http://codeblocks.org/

Slide 113

Slide 113 text

A bolt from god And for those who are a little bit further in their journey to learn C++ you have Compiler Explorer: https://godbolt.org

Slide 114

Slide 114 text

More content There are a lot of C++ conferences around the world. Many have wonderful YouTube channels full of lectures, everything from talks like this one to very advanced topics.

Slide 115

Slide 115 text

Conferences CppCon: https://cppcon.org/ September 23rd in Seattle, Washington

Slide 116

Slide 116 text

Conferences CppCon: https://cppcon.org/ September 23rd in Seattle, Washington Meeting C++: http://meetingcpp.com/ November 15th 2018 in Berlin, DE

Slide 117

Slide 117 text

Conferences CppCon: https://cppcon.org/ September 23rd in Seattle, Washington Meeting C++: http://meetingcpp.com/ November 15th 2018 in Berlin, DE C++ on Sea: https://cpponsea.uk/ February 4th 2019 in Kent, UK

Slide 118

Slide 118 text

Conferences CppCon: https://cppcon.org/ September 23rd in Seattle, Washington Meeting C++: http://meetingcpp.com/ November 15th 2018 in Berlin, DE C++ on Sea: https://cpponsea.uk/ February 4th 2019 in Kent, UK ACCU: https://accu.org April 10th 2019 in Bristol, UK

Slide 119

Slide 119 text

Conferences CppCon: https://cppcon.org/ September 23rd in Seattle, Washington Meeting C++: http://meetingcpp.com/ November 15th 2018 in Berlin, DE C++ on Sea: https://cpponsea.uk/ February 4th 2019 in Kent, UK ACCU: https://accu.org April 10th 2019 in Bristol, UK C++Now: http://cppnow.org/ May 5th 2019 in Aspen, Colorado

Slide 120

Slide 120 text

The next steps are up to you It is YOU that needs to put in the practice

Slide 121

Slide 121 text

The next steps are up to you It is YOU that needs to put in the practice It is YOU that needs to try and most likely struggle trying to find a solution to your problem

Slide 122

Slide 122 text

The next steps are up to you It is YOU that needs to put in the practice It is YOU that needs to try and most likely struggle trying to find a solution to your problem YOU are the driving force here.

Slide 123

Slide 123 text

The next steps are up to you It is YOU that needs to put in the practice It is YOU that needs to try and most likely struggle trying to find a solution to your problem YOU are the driving force here. Programming can be a wonderful craft that empowers you to no end.

Slide 124

Slide 124 text

Thank you!