PHP-Einführung - Lesson 4 - Object Oriented Programming. Alexander Lichter June 27, 2017
|
|
- Randolph Chase
- 6 years ago
- Views:
Transcription
1 PHP-Einführung - Lesson 4 - Object Oriented Programming Alexander Lichter June 27, 2017
2 Content of this lesson 1. Recap 2. Why OOP? 3. Git gud - PHPStorm 4. Include and Require 5. Classes and objects 6. Method chaining 7. Magic methods 1
3 Recap
4 A short recap (again) Last lesson we learned a lot about form handling, sanitizing, validating input and about the HTTP protocol. 2
5 A short recap (again) Last lesson we learned a lot about form handling, sanitizing, validating input and about the HTTP protocol. A note on form validation itself: What we did was only server-side validation. You can do a client-side form validation with HTML5 and JS, but that s not part of this course. 2
6 A short recap (again) Last lesson we learned a lot about form handling, sanitizing, validating input and about the HTTP protocol. A note on form validation itself: What we did was only server-side validation. You can do a client-side form validation with HTML5 and JS, but that s not part of this course. We now can handle user input and are almost ready to build huge applications. But when we have a lot of code (30k+ Lines of Code), we should structure it well. We will learn how to program object oriented therefore! 2
7 Why OOP?
8 Why we need OOP As you may know from the SWT lecture, OOP is mainly used while programming high-level-languages (exceptions are there [Haskell]). Your future code should be: 3
9 Why we need OOP As you may know from the SWT lecture, OOP is mainly used while programming high-level-languages (exceptions are there [Haskell]). Your future code should be: Well-structured 3
10 Why we need OOP As you may know from the SWT lecture, OOP is mainly used while programming high-level-languages (exceptions are there [Haskell]). Your future code should be: Well-structured Without duplicates [DRY] 3
11 Why we need OOP As you may know from the SWT lecture, OOP is mainly used while programming high-level-languages (exceptions are there [Haskell]). Your future code should be: Well-structured Without duplicates [DRY] Flexible, maintainable and changeable with ease 3
12 Why we need OOP As you may know from the SWT lecture, OOP is mainly used while programming high-level-languages (exceptions are there [Haskell]). Your future code should be: Well-structured Without duplicates [DRY] Flexible, maintainable and changeable with ease Modularized 3
13 Why we need OOP As you may know from the SWT lecture, OOP is mainly used while programming high-level-languages (exceptions are there [Haskell]). Your future code should be: Well-structured Without duplicates [DRY] Flexible, maintainable and changeable with ease Modularized And OOP gives us all those points when used correctly. 3
14 Git gud - PHPStorm
15 Why we need OOP In the next weeks we will develop more and more complex programs. 4
16 Why we need OOP In the next weeks we will develop more and more complex programs. To have some QoL features on your side (Autocomplete, Error hinting and more), you should get yourself an IDE. I already mentioned that in the 1st lesson. 4
17 Why we need OOP In the next weeks we will develop more and more complex programs. To have some QoL features on your side (Autocomplete, Error hinting and more), you should get yourself an IDE. I already mentioned that in the 1st lesson. My IDE of choice is PHPStorm You can get a free copy with your TU Dresden mail on Download it now and we will set the IDE up together! 4
18 Include and Require
19 Include/Require To structure your PHP code even better, you can (and should!) put it in different files. There are two methods to include these files in your main file, called include and require. Imagine you want to welcome every user when the opens a page of your website. You d declare a welcome function/text in the welcome.php and can include it on every page like that: 5
20 Include/Require To structure your PHP code even better, you can (and should!) put it in different files. There are two methods to include these files in your main file, called include and require. Imagine you want to welcome every user when the opens a page of your website. You d declare a welcome function/text in the welcome.php and can include it on every page like that: 1 <?php 2 i n c l u d e r e l a t e / path / to / welcome. php ; 3 // i n c l u d e welcome. php ; when i n same f o l d e r 4 // Page c o n t e n t h e r e 5 5
21 Include/Require - Difference and once When the file you want to include couldn t be found, include will throw a warning (but the script continues working). Require would throw a fatal error instead, making the script halt instantly. This is the only difference 6
22 Include/Require - Difference and once When the file you want to include couldn t be found, include will throw a warning (but the script continues working). Require would throw a fatal error instead, making the script halt instantly. This is the only difference That means, require should be used for critical/important files. 6
23 Include/Require - Difference and once When the file you want to include couldn t be found, include will throw a warning (but the script continues working). Require would throw a fatal error instead, making the script halt instantly. This is the only difference That means, require should be used for critical/important files. There are also two methods called include once and require once. They work like include/require but only include a file once. When it should be included again, the methods won t do that. That s good for including functions/modularized code, but bad for templating. 6
24 Classes and objects
25 Classes and objects - theory Before we go deeper into the practical OOP part, let s talk about some terms everyone of you should know: Classes and Objects. 7
26 Classes and objects - theory Before we go deeper into the practical OOP part, let s talk about some terms everyone of you should know: Classes and Objects. To avoid complex explanations and abstractions, here is a simple explanation for both terms: 7
27 Classes and objects - theory Before we go deeper into the practical OOP part, let s talk about some terms everyone of you should know: Classes and Objects. To avoid complex explanations and abstractions, here is a simple explanation for both terms: You can imagine a class as a blueprint, for a house for example. It defines the structure, the shape, hold relationships between the parts (for example that the living room is connected to the bath) and is defined, even when the house isn t built up. 7
28 Classes and objects - theory Before we go deeper into the practical OOP part, let s talk about some terms everyone of you should know: Classes and Objects. To avoid complex explanations and abstractions, here is a simple explanation for both terms: You can imagine a class as a blueprint, for a house for example. It defines the structure, the shape, hold relationships between the parts (for example that the living room is connected to the bath) and is defined, even when the house isn t built up. An object can be understood as the real house then! It stores all the data that is needed for the house, like the floor type or the wall colors. 7
29 Classes and objects - theory Before we go deeper into the practical OOP part, let s talk about some terms everyone of you should know: Classes and Objects. To avoid complex explanations and abstractions, here is a simple explanation for both terms: You can imagine a class as a blueprint, for a house for example. It defines the structure, the shape, hold relationships between the parts (for example that the living room is connected to the bath) and is defined, even when the house isn t built up. An object can be understood as the real house then! It stores all the data that is needed for the house, like the floor type or the wall colors. 7
30 Classes and objects - questions Now some questions for you. In case you don t understand something or anything seems not logical, do not hesitate to tell it! 1. Can an object exist without a class? 8
31 Classes and objects - questions Now some questions for you. In case you don t understand something or anything seems not logical, do not hesitate to tell it! 1. Can an object exist without a class? No! 2. Can a class exist without an object? 8
32 Classes and objects - questions Now some questions for you. In case you don t understand something or anything seems not logical, do not hesitate to tell it! 1. Can an object exist without a class? No! 2. Can a class exist without an object? Yes, that works! 3. Can there be more than one object of a specific class? 8
33 Classes and objects - questions Now some questions for you. In case you don t understand something or anything seems not logical, do not hesitate to tell it! 1. Can an object exist without a class? No! 2. Can a class exist without an object? Yes, that works! 3. Can there be more than one object of a specific class? Yup, that s no problem! 4. Can an object have multiple classes? 8
34 Classes and objects - questions Now some questions for you. In case you don t understand something or anything seems not logical, do not hesitate to tell it! 1. Can an object exist without a class? No! 2. Can a class exist without an object? Yes, that works! 3. Can there be more than one object of a specific class? Yup, that s no problem! 4. Can an object have multiple classes? Nope, that s not possible like this. The only way is Inheritance, but more about it later 8
35 Classes and objects - questions Now some questions for you. In case you don t understand something or anything seems not logical, do not hesitate to tell it! 1. Can an object exist without a class? No! 2. Can a class exist without an object? Yes, that works! 3. Can there be more than one object of a specific class? Yup, that s no problem! 4. Can an object have multiple classes? Nope, that s not possible like this. The only way is Inheritance, but more about it later Alright, I think you catched the drift! 8
36 Classes and objects - basic class So, how does classes and objects look in PHP: 9
37 Classes and objects - basic class So, how does classes and objects look in PHP: 1 <?php 2 3 c l a s s House 4 { 5 p u b l i c $rooms = 4 ; 6 p u b l i c $ s t r e e t = Am K l e i n e n Anger 13 ; 7 } $ o b j = new House ; 11 echo <pre> ; 12 var dump ( $ o b j ) ; 13 echo <br> ; 14 echo $obj >rooms ; // Output t h e room number 9
38 Classes and objects - basic class So, how does classes and objects look in PHP: 1 <?php 2 3 c l a s s House 4 { 5 p u b l i c $rooms = 4 ; 6 p u b l i c $ s t r e e t = Am K l e i n e n Anger 13 ; 7 } $ o b j = new House ; 11 echo <pre> ; 12 var dump ( $ o b j ) ; 13 echo <br> ; 14 echo $obj >rooms ; // Output t h e room number As you see, var dump shows the class and the properties of the object 9
39 Classes and objects - getter and setter It is a bad practice to access variables directly. We use getter and setter to access them. 10
40 Classes and objects - getter and setter It is a bad practice to access variables directly. We use getter and setter to access them. 1 <?php 2 c l a s s House 3 { 4 p u b l i c $rooms = 4 ; // C l a s s p r o p e r t y 5 p u b l i c $ s t r e e t = Am K l e i n e n Anger 13 ; 6 7 p u b l i c f u n c t i o n getrooms ( ) { 8 r e t u r n $ t h i s >rooms ; // To r e f e r to t h e c l a s s i t s e l f i n t h e c l a s s, use $ t h i s 9 } p u b l i c f u n c t i o n s setrooms ( $rooms ) { 12 $ t h i s >rooms = ( i n t ) $rooms ; // V a l i d a t i o n! 13 } 14 } $h = new House ( ) ; // same as new House ;, but t h i s one i s b e t t e r! 10
41 Classes and objects - getter and setter #2 Now we can alter the property rooms through it s get and set methods: 11
42 Classes and objects - getter and setter #2 Now we can alter the property rooms through it s get and set methods: 1 echo $h >getrooms ( ) ; //4 2 $h >setrooms ( 1 0 ) ; 3 echo $h >getrooms ( ) ; // 10 11
43 Classes and objects - getter and setter #2 Now we can alter the property rooms through it s get and set methods: 1 echo $h >getrooms ( ) ; //4 2 $h >setrooms ( 1 0 ) ; 3 echo $h >getrooms ( ) ; // 10 Furthermore it is no problem to create objects from the same class with different properties/attributes: 11
44 Classes and objects - getter and setter #2 Now we can alter the property rooms through it s get and set methods: 1 echo $h >getrooms ( ) ; //4 2 $h >setrooms ( 1 0 ) ; 3 echo $h >getrooms ( ) ; // 10 Furthermore it is no problem to create objects from the same class with different properties/attributes: 1 $house = new House ( ) ; 2 $ v i l l a = new House ( ) ; 3 $house >setrooms ( 5 ) ; 4 $ v i l l a >setrooms ( 1 0 ) ; 5 echo $ v i l l a >getrooms ( ). <br> 6. $house >getrooms ( ) ; 7 11
45 A simple task for the beginning Are you ready to program some OOP things? Great! 12
46 A simple task for the beginning Are you ready to program some OOP things? Great! Your first task is to create a class of the type PC. Think about (but not only about): PC-Type [Laptop, Tower, Server] 12
47 A simple task for the beginning Are you ready to program some OOP things? Great! Your first task is to create a class of the type PC. Think about (but not only about): PC-Type [Laptop, Tower, Server] CPU 12
48 A simple task for the beginning Are you ready to program some OOP things? Great! Your first task is to create a class of the type PC. Think about (but not only about): PC-Type [Laptop, Tower, Server] CPU CPU cores 12
49 A simple task for the beginning Are you ready to program some OOP things? Great! Your first task is to create a class of the type PC. Think about (but not only about): PC-Type [Laptop, Tower, Server] CPU CPU cores GPU 12
50 A simple task for the beginning Are you ready to program some OOP things? Great! Your first task is to create a class of the type PC. Think about (but not only about): PC-Type [Laptop, Tower, Server] CPU CPU cores GPU RAM size (in GB) 12
51 A simple task for the beginning Are you ready to program some OOP things? Great! Your first task is to create a class of the type PC. Think about (but not only about): PC-Type [Laptop, Tower, Server] CPU CPU cores GPU RAM size (in GB) OS 12
52 A simple task for the beginning Are you ready to program some OOP things? Great! Your first task is to create a class of the type PC. Think about (but not only about): PC-Type [Laptop, Tower, Server] CPU CPU cores GPU RAM size (in GB) OS Use getter and setter and keep DRY. 12
53 A simple task for the beginning Are you ready to program some OOP things? Great! Your first task is to create a class of the type PC. Think about (but not only about): PC-Type [Laptop, Tower, Server] CPU CPU cores GPU RAM size (in GB) OS Use getter and setter and keep DRY. Furthermore, create a form where the user can input those information. Don t forget to validate and sanitize those! 12
54 A simple task for the beginning Are you ready to program some OOP things? Great! Your first task is to create a class of the type PC. Think about (but not only about): PC-Type [Laptop, Tower, Server] CPU CPU cores GPU RAM size (in GB) OS Use getter and setter and keep DRY. Furthermore, create a form where the user can input those information. Don t forget to validate and sanitize those! BONUS: Use server- and client-side validation ;) 12
55 Method chaining
56 Method chaining Method chaining is a great concept to reduce your code to a minimum by.. chaining methods. But how does it work? 13
57 Method chaining Method chaining is a great concept to reduce your code to a minimum by.. chaining methods. But how does it work? 1 c l a s s Gameboy { 2 p u b l i c $ b a t t e r y ; 3 p u b l i c l o a d P e r M i n u t e = ; 4 p u b l i c d r a i n P e r M i n u t e = 0. 2 ; 5 6 p u b l i c f u n c t i o n l o a d ( $minutes ) 7 { 8 $ t h i s >b a t t e r y += $minutes $ t h i s >l o a d P e r M i n u t e ; 9 //Don t use g e t t e r s / s e t t e r s i n s i d e t h e c l a s s 10 i f ( $ t h i s >b a t t e r y > 100) { $ t h i s >b a t t e r y = ; } 11 r e t u r n $ t h i s ; // I m p o r t a n t f o r c h a i n i n g! 12 } 13 p u b l i c f u n c t i o n p l a y ( $minutes ) 14 { 15 $ t h i s >b a t e r y = $minutes $ t h i s >d r a i n P e r M i n u t e ; 16 r e t u r n $ t h i s ; // Implement v a l i d a t i o n as i n l o a d! 17 } 18 // G e t t e r and s e t t e r h e r e ; ) 19 } 13
58 Method chaining continued Now we can easily find out how much battery is left: 14
59 Method chaining continued Now we can easily find out how much battery is left: 1 $ g b C o l o r = new Gameboy ( ) ; 2 3 echo $gbcolor >l o a d (10 60) >p l a y ( ) >g e t B a t t e r y ( ) ; 4 // Load f o r 10 hours, then p l a y f o r 140 m i n u t e s 14
60 Method chaining continued Now we can easily find out how much battery is left: 1 $ g b C o l o r = new Gameboy ( ) ; 2 3 echo $gbcolor >l o a d (10 60) >p l a y ( ) >g e t B a t t e r y ( ) ; 4 // Load f o r 10 hours, then p l a y f o r 140 m i n u t e s How it works: By returning this (the object itself) in every method, you can use the return value of each method to issue the next one on the (now altered) object. 14
61 Method chaining continued Now we can easily find out how much battery is left: 1 $ g b C o l o r = new Gameboy ( ) ; 2 3 echo $gbcolor >l o a d (10 60) >p l a y ( ) >g e t B a t t e r y ( ) ; 4 // Load f o r 10 hours, then p l a y f o r 140 m i n u t e s How it works: By returning this (the object itself) in every method, you can use the return value of each method to issue the next one on the (now altered) object. This does not work for all methods! 14
62 Magic methods
63 Magic methods - General So, you may ask yourselves: What are magic methods? 15
64 Magic methods - General So, you may ask yourselves: What are magic methods? Well, they behave a bit like superglobals: You do not need to declare them by yourself and they are available almost everywhere. 15
65 Magic methods - General So, you may ask yourselves: What are magic methods? Well, they behave a bit like superglobals: You do not need to declare them by yourself and they are available almost everywhere. The difference is, that you can only use them in classes! We will learn more about three more or less important magic methods: 15
66 Magic methods - General So, you may ask yourselves: What are magic methods? Well, they behave a bit like superglobals: You do not need to declare them by yourself and they are available almost everywhere. The difference is, that you can only use them in classes! We will learn more about three more or less important magic methods: construct() destruct() tostring() 15
67 Magic methods - Constructor 1 <?php 2 c l a s s Person 3 { 4 p u b l i c $name ; 5 p u b l i c $age ; 6 p u b l i c $ s e x ; // bool, t r u e = male 7 8 // C a l l e d on c l a s s c o n s t r u c t i o n 9 //Can be used to s e t p r o p e r t i e s 10 p u b l i c f u n c t i o n c o n s t r u c t ( $name, $age, $ s e x ) { 11 $ t h i s >name = $name ; 12 $ t h i s >age = $age ; 13 $ t h i s >s e x = $ s e x ; 14 } 15 } $ s i e g f r i e d = new Person ( S i e g f r i e d, 35, t r u e ) ; 18 $ l i n d a = new Person ( Linda, 19, f a l s e ) ; 19 var dump ( $ s i e g f r i e d, $ l i n d a ) ; 16
68 Magic methods - Destructor 1 <?php 2 c l a s s D e s t r u c t i o n { 3 f u n c t i o n c o n s t r u c t ( ) { 4 p r i n t We a r e i n t h e c o n s t r u c t o r now <br> ; 5 } 6 7 f u n c t i o n d e s t r u c t ( ) { 8 p r i n t D e s t r o y i n g t h e c l a s s now <br> ; 9 } 10 } $ o b j = new D e s t r u c t i o n ( ) ; 13 $ a n o t h e r = new D e s t r u c t i o n ( ) ; 14 u n s e t ( $ a n o t h e r ) ; // D e s t r o y s o b j. 15 echo EOF ; 16?> The destructor is the opposite of the constructor and is executed when the object is destroyed (EOF or unset eg.) 17
69 Magic methods - tostring 1 <?php 2 c l a s s Person 3 { 4 p u b l i c $name ; 5 p u b l i c $age ; 6 p u b l i c $ s e x ; // bool, t r u e = male 7 8 p u b l i c f u n c t i o n t o S t r i n g ( ) { 9 $ s e x S t r i n g = $ s e x? Male : Female ; // Ternary o p e r a t o r 10 r e t u r n $name i s $age y e a r s o l d and $ s e x S t r i n g ; 11 } 12 } $randomperson = new Person ( ) ; 15 $randomperson >name = Randy ; 16 $randomperson >age = 1 9 ; 17 $randomperson >s e x = t r u e ; echo $randomperson ; 18
70 Your turn again! Alright! You got a new IDE and some more knowledges. Now it s time to prove it 19
71 Your turn again! Alright! You got a new IDE and some more knowledges. Now it s time to prove it Write a class Car that models the car itself (seat count, steering wheel side, type, tank). It should be possible fill the tank and to ride the car. Use method chaining when possible. Print out all important information when you use echo $object (while $object has the type Car) Good Luck 19
Fog Chamber Testing the Label: Photo of Fog. Joshua Gutwill 10/29/1999
Fog Chamber Testing the Label: Photo of Fog Joshua Gutwill 10/29/1999 Keywords: < > formative heat&temp exhibit interview 1 Goals/Context Fog Chamber Interview Results Testing Label: Photo of fog on Golden
More informationInteresting Integers!
Interesting Integers! What You Will Learn n Some definitions related to integers. n Rules for adding and subtracting integers. n A method for proving that a rule is true. Are you ready?? Definition n Positive
More informationGuide to Proofs on Sets
CS103 Winter 2019 Guide to Proofs on Sets Cynthia Lee Keith Schwarz I would argue that if you have a single guiding principle for how to mathematically reason about sets, it would be this one: All sets
More informationNonregular Languages
Nonregular Languages Recap from Last Time Theorem: The following are all equivalent: L is a regular language. There is a DFA D such that L( D) = L. There is an NFA N such that L( N) = L. There is a regular
More informationSUN SIGNS & PAST LIVES: YOUR SOUL'S EVOLUTIONARY PATH BY BERNIE ASHMAN
SUN SIGNS & PAST LIVES: YOUR SOUL'S EVOLUTIONARY PATH BY BERNIE ASHMAN DOWNLOAD EBOOK : SUN SIGNS & PAST LIVES: YOUR SOUL'S EVOLUTIONARY Click link bellow and free register to download ebook: SUN SIGNS
More informationMath 31 Lesson Plan. Day 2: Sets; Binary Operations. Elizabeth Gillaspy. September 23, 2011
Math 31 Lesson Plan Day 2: Sets; Binary Operations Elizabeth Gillaspy September 23, 2011 Supplies needed: 30 worksheets. Scratch paper? Sign in sheet Goals for myself: Tell them what you re going to tell
More information3PK. February 13-14, Matt s friends bring him to Jesus. Luke 5: We can share Jesus with our friends.
3PK February 13-14, 2016 Luke 5:17-26 First 10 minutes of the service hour: Engage kids in cooperative play activities to help them connect to other kids Next 5 minutes: Connect Time Next 25 minutes: Large
More informationAlex s Guide to Word Problems and Linear Equations Following Glencoe Algebra 1
Alex s Guide to Word Problems and Linear Equations Following Glencoe Algebra 1 What is a linear equation? It sounds fancy, but linear equation means the same thing as a line. In other words, it s an equation
More informationComp 11 Lectures. Mike Shah. July 26, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 26, / 40
Comp 11 Lectures Mike Shah Tufts University July 26, 2017 Mike Shah (Tufts University) Comp 11 Lectures July 26, 2017 1 / 40 Please do not distribute or host these slides without prior permission. Mike
More informationSquaring and Unsquaring
PROBLEM STRINGS LESSON 8.1 Squaring and Unsquaring At a Glance (6 6)* ( 6 6)* (1 1)* ( 1 1)* = 64 17 = 64 + 15 = 64 ( + 3) = 49 ( 7) = 5 ( + ) + 1= 8 *optional problems Objectives The goal of this string
More information- a value calculated or derived from the data.
Descriptive statistics: Note: I'm assuming you know some basics. If you don't, please read chapter 1 on your own. It's pretty easy material, and it gives you a good background as to why we need statistics.
More informationChapter 2. Mathematical Reasoning. 2.1 Mathematical Models
Contents Mathematical Reasoning 3.1 Mathematical Models........................... 3. Mathematical Proof............................ 4..1 Structure of Proofs........................ 4.. Direct Method..........................
More informationGrades 7 & 8, Math Circles 10/11/12 October, Series & Polygonal Numbers
Faculty of Mathematics Waterloo, Ontario N2L G Centre for Education in Mathematics and Computing Introduction Grades 7 & 8, Math Circles 0//2 October, 207 Series & Polygonal Numbers Mathematicians are
More informationLesson 1: Forces. Fascinating Education Script Fascinating Intro to Chemistry Lessons. Slide 1: Introduction. Slide 2: Forces
Fascinating Education Script Fascinating Intro to Chemistry Lessons Lesson 1: Forces Slide 1: Introduction Slide 2: Forces Hi. My name is Sheldon Margulies, and we re about to learn what things are made
More informationSTARTING WITH CONFIDENCE
STARTING WITH CONFIDENCE A- Level Maths at Budmouth Name: This booklet has been designed to help you to bridge the gap between GCSE Maths and AS Maths. Good mathematics is not about how many answers you
More informationCS 124 Math Review Section January 29, 2018
CS 124 Math Review Section CS 124 is more math intensive than most of the introductory courses in the department. You re going to need to be able to do two things: 1. Perform some clever calculations to
More informationEdexcel AS and A Level Mathematics Year 1/AS - Pure Mathematics
Year Maths A Level Year - Tet Book Purchase In order to study A Level Maths students are epected to purchase from the school, at a reduced cost, the following tetbooks that will be used throughout their
More informationPhysics Motion Math. (Read objectives on screen.)
Physics 302 - Motion Math (Read objectives on screen.) Welcome back. When we ended the last program, your teacher gave you some motion graphs to interpret. For each section, you were to describe the motion
More informationMITOCW MIT18_02SCF10Rec_61_300k
MITOCW MIT18_02SCF10Rec_61_300k JOEL LEWIS: Hi. Welcome back to recitation. In lecture, you've been learning about the divergence theorem, also known as Gauss's theorem, and flux, and all that good stuff.
More informationMath 308 Midterm Answers and Comments July 18, Part A. Short answer questions
Math 308 Midterm Answers and Comments July 18, 2011 Part A. Short answer questions (1) Compute the determinant of the matrix a 3 3 1 1 2. 1 a 3 The determinant is 2a 2 12. Comments: Everyone seemed to
More informationThe Physics of Boomerangs By Darren Tan
The Physics of Boomerangs By Darren Tan Segment 1 Hi! I m the Science Samurai and glad to have you here with me today. I m going to show you today how to make your own boomerang, how to throw it and even
More informationDiscrete Probability and State Estimation
6.01, Fall Semester, 2007 Lecture 12 Notes 1 MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.01 Introduction to EECS I Fall Semester, 2007 Lecture 12 Notes
More informationHW9 Concepts. Alex Alemi November 1, 2009
HW9 Concepts Alex Alemi November 1, 2009 1 24.28 Capacitor Energy You are told to consider connecting a charged capacitor together with an uncharged one and told to compute (a) the original charge, (b)
More information...but you just watched a huge amount of science taking place! Let s look a little closer at what just happened!
Chapter 2: Page 10 Chapter 2: Page 11 Almost everyone gets into a car every day. Let s think about some of the steps it takes to drive a car. The first thing you should do, of course, is put on your seat
More informationQ: How can quantum computers break ecryption?
Q: How can quantum computers break ecryption? Posted on February 21, 2011 by The Physicist Physicist: What follows is the famous Shor algorithm, which can break any RSA encryption key. The problem: RSA,
More informationVIDEO Intypedia008en LESSON 8: SECRET SHARING PROTOCOL. AUTHOR: Luis Hernández Encinas. Spanish Scientific Research Council in Madrid, Spain
VIDEO Intypedia008en LESSON 8: SECRET SHARING PROTOCOL AUTHOR: Luis Hernández Encinas Spanish Scientific Research Council in Madrid, Spain Hello and welcome to Intypedia. We have learned many things about
More information1.1 Administrative Stuff
601.433 / 601.633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Introduction, Karatsuba/Strassen Date: 9/4/18 1.1 Administrative Stuff Welcome to Algorithms! In this class you will learn the
More informationPart 2: Adaptations and Reproduction
Part 2: Adaptations and Reproduction Review: Plants need 6 things to grow 1. Air (Carbon Dioxide) 2. Water 3. Light 4. Nutrients 5. Proper Temperature 6. Space Adaptations Adaptations are characteristics
More informationLinear algebra and differential equations (Math 54): Lecture 10
Linear algebra and differential equations (Math 54): Lecture 10 Vivek Shende February 24, 2016 Hello and welcome to class! As you may have observed, your usual professor isn t here today. He ll be back
More informationSolar Open House Toolkit
A Solar Open House is an informal meet and greet at a solar homeowner s home. It is an opportunity for homeowners who are considering going solar to see solar energy at work, ask questions about the process
More informationLesson Plan by: Stephanie Miller
Lesson: Pythagorean Theorem and Distance Formula Length: 45 minutes Grade: Geometry Academic Standards: MA.G.1.1 2000 Find the lengths and midpoints of line segments in one- or two-dimensional coordinate
More informationMathematics Enhancement Programme
UNIT 9 Lesson Plan 1 Perimeters Perimeters 1 1A 1B Units of length T: We're going to measure the lengths of the sides of some shapes. Firstly we need to decide what units to use - what length-units do
More informationUnit 5: Energy (Part 2)
SUPERCHARGED SCIENCE Unit 5: Energy (Part 2) www.sciencelearningspace.com Appropriate for Grades: Lesson 1 (K-12), Lesson 2 (K-12) Duration: 6-15 hours, depending on how many activities you do! We covered
More informationLesson 6-1: Relations and Functions
I ll bet you think numbers are pretty boring, don t you? I ll bet you think numbers have no life. For instance, numbers don t have relationships do they? And if you had no relationships, life would be
More informationVoting Systems. High School Circle II. June 4, 2017
Voting Systems High School Circle II June 4, 2017 Today we are going to resume what we started last week. We are going to talk more about voting systems, are we are going to being our discussion by watching
More informationMethods of Mathematics
Methods of Mathematics Kenneth A. Ribet UC Berkeley Math 10B April 19, 2016 There is a new version of the online textbook file Matrix_Algebra.pdf. The next breakfast will be two days from today, April
More informationGuide to Proofs on Discrete Structures
CS103 Handout 17 Spring 2018 Guide to Proofs on Discrete Structures In Problem Set One, you got practice with the art of proofwriting in general (as applied to numbers, sets, puzzles, etc.) Problem Set
More informationClimate Change. Presenter s Script
General Instructions Presenter s Script You will have 15 minutes to present your activity. When you hear the air horn blow, you will begin your presentation (please do not start presenting until the air
More informationQuadratic Equations Part I
Quadratic Equations Part I Before proceeding with this section we should note that the topic of solving quadratic equations will be covered in two sections. This is done for the benefit of those viewing
More informationComp 11 Lectures. Mike Shah. July 12, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 12, / 33
Comp 11 Lectures Mike Shah Tufts University July 12, 2017 Mike Shah (Tufts University) Comp 11 Lectures July 12, 2017 1 / 33 Please do not distribute or host these slides without prior permission. Mike
More informationThe complete lesson plan for this topic is included below.
Home Connection Parent Information: Magnets provide a simple way to explore force with children. The power of a magnet is somewhat like magic to them and requires exploration to understand. When forces
More informationContingency Tables. Safety equipment in use Fatal Non-fatal Total. None 1, , ,128 Seat belt , ,878
Contingency Tables I. Definition & Examples. A) Contingency tables are tables where we are looking at two (or more - but we won t cover three or more way tables, it s way too complicated) factors, each
More informationExperiment 2 Random Error and Basic Statistics
PHY9 Experiment 2: Random Error and Basic Statistics 8/5/2006 Page Experiment 2 Random Error and Basic Statistics Homework 2: Turn in at start of experiment. Readings: Taylor chapter 4: introduction, sections
More informationKey Questions: Where are Alaska s volcanoes? How many volcanoes are found in Alaska?
Key Questions: Where are Alaska s volcanoes? How many volcanoes are found in Alaska? Unit 1 Grade levels: At a basic level, these activities are appropriate for grades 3-6; with suggested extensions for
More informationPlease bring the task to your first physics lesson and hand it to the teacher.
Pre-enrolment task for 2014 entry Physics Why do I need to complete a pre-enrolment task? This bridging pack serves a number of purposes. It gives you practice in some of the important skills you will
More informationObjective: Construct a paper clock by partitioning a circle into halves and quarters, and tell time to the half hour or quarter hour.
Lesson 13 Objective: Suggested Lesson Structure Fluency Practice Concept Development Student Debrief Total Time (10 minutes) (40 minutes) (10 minutes) (60 minutes) Fluency Practice (10 minutes) Rename
More informationMATH 243E Test #3 Solutions
MATH 4E Test # Solutions () Find a recurrence relation for the number of bit strings of length n that contain a pair of consecutive 0s. You do not need to solve this recurrence relation. (Hint: Consider
More informationHow to write maths (well)
How to write maths (well) Dr Euan Spence 29 September 2017 These are the slides from a talk I gave to the new first-year students at Bath, annotated with some of the things I said (which appear in boxes
More informationCounting. 1 Sum Rule. Example 1. Lecture Notes #1 Sept 24, Chris Piech CS 109
1 Chris Piech CS 109 Counting Lecture Notes #1 Sept 24, 2018 Based on a handout by Mehran Sahami with examples by Peter Norvig Although you may have thought you had a pretty good grasp on the notion of
More informationLine Integrals and Path Independence
Line Integrals and Path Independence We get to talk about integrals that are the areas under a line in three (or more) dimensional space. These are called, strangely enough, line integrals. Figure 11.1
More informationNatural Language Processing Prof. Pawan Goyal Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur
Natural Language Processing Prof. Pawan Goyal Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 18 Maximum Entropy Models I Welcome back for the 3rd module
More informationUndecidability and Rice s Theorem. Lecture 26, December 3 CS 374, Fall 2015
Undecidability and Rice s Theorem Lecture 26, December 3 CS 374, Fall 2015 UNDECIDABLE EXP NP P R E RECURSIVE Recap: Universal TM U We saw a TM U such that L(U) = { (z,w) M z accepts w} Thus, U is a stored-program
More informationNP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness
Lecture 19 NP-Completeness I 19.1 Overview In the past few lectures we have looked at increasingly more expressive problems that we were able to solve using efficient algorithms. In this lecture we introduce
More informationLAB 3: VELOCITY AND ACCELERATION
Lab 3 - Velocity & Acceleration 25 Name Date Partners LAB 3: VELOCITY AND ACCELERATION A cheetah can accelerate from to 5 miles per hour in 6.4 seconds. A Jaguar can accelerate from to 5 miles per hour
More information3PK. Jesus Heals a Man. February 7-8, Luke 5: Jesus can do anything!
3PK February 7-8, 2015 Jesus Heals a Man Luke 5:17-26 Jesus can do anything! First 10 minutes of the service hour: Engage kids in cooperative play activities to help them connect to other kids Next 5 minutes:
More information1 Reductions and Expressiveness
15-451/651: Design & Analysis of Algorithms November 3, 2015 Lecture #17 last changed: October 30, 2015 In the past few lectures we have looked at increasingly more expressive problems solvable using efficient
More informationHomework Assignment 4 Root Finding Algorithms The Maximum Velocity of a Car Due: Friday, February 19, 2010 at 12noon
ME 2016 A Spring Semester 2010 Computing Techniques 3-0-3 Homework Assignment 4 Root Finding Algorithms The Maximum Velocity of a Car Due: Friday, February 19, 2010 at 12noon Description and Outcomes In
More informationRigid Body Equilibrium. Free Body Diagrams. Equations of Equilibrium
Rigid Body Equilibrium and the Equations of Equilibrium small boy swallowed some coins and was taken to a hospital. When his grandmother telephoned to ask how he was a nurse said 'No change yet'. Objectives
More informationDiscrete Probability and State Estimation
6.01, Spring Semester, 2008 Week 12 Course Notes 1 MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.01 Introduction to EECS I Spring Semester, 2008 Week
More informationCHM 105 & 106 MO1 UNIT TWO, LECTURE THREE 1 IN OUR PREVIOUS LECTURE WE TALKED ABOUT USING CHEMICAL EQUATIONS TO SHOW THE
CHM 105 & 106 MO1 UNIT TWO, LECTURE THREE 1 CHM 105/106 Program 10: Unit 2 Lecture 3 IN OUR PREVIOUS LECTURE WE TALKED ABOUT USING CHEMICAL EQUATIONS TO SHOW THE LAW OF MASS AND THE LAW OF CONSERVATION
More informationGuide to Negating Formulas
Guide to Negating Formulas Hi everybody! We spent a little bit of time in class talking about how to negate formulas in propositional or frst-order logic. This is a really valuable skill! If you ever need
More informationCollege Supervisor: Nancy Cook Date: February 1, OBJECTIVE: The learner will distinguish a $20 bill at 100% accuracy.
Emily Boersma and Jessica Maier Lesson #1: 20 Dollar Bill Length: 30 minutes College Supervisor: Nancy Cook Date: February 1, 2012 OBJECTIVE: The learner will distinguish a $20 bill at 100% accuracy. Grade
More information( )( b + c) = ab + ac, but it can also be ( )( a) = ba + ca. Let s use the distributive property on a couple of
Factoring Review for Algebra II The saddest thing about not doing well in Algebra II is that almost any math teacher can tell you going into it what s going to trip you up. One of the first things they
More informationDiscrete Structures Proofwriting Checklist
CS103 Winter 2019 Discrete Structures Proofwriting Checklist Cynthia Lee Keith Schwarz Now that we re transitioning to writing proofs about discrete structures like binary relations, functions, and graphs,
More informationTäby friskola log. We re eagerly waiting for the results. Will we advance in Sigma? It s silent. WE RE IN THE SEMIFINAL! she yells.
Täby friskola log Jan 28 We re eagerly waiting for the results. Will we advance in Sigma? It s silent. WE RE IN THE SEMIFINAL! she yells. We get the first task and get going. On the worksheet there s a
More informationWelcome back to Physics 211
Welcome back to Physics 211 The room is very full please move toward the center and help others find a seat. Be patient. The registration database is only updated twice per week. Get to know the people
More information20.2 Design Example: Countdown Timer
EECS 16A Designing Information Devices and Systems I Fall 018 Lecture Notes Note 0 0.1 Design Procedure Now that we ve analyzed many circuits, we are ready to focus on designing interesting circuits to
More informationLesson 21 Not So Dramatic Quadratics
STUDENT MANUAL ALGEBRA II / LESSON 21 Lesson 21 Not So Dramatic Quadratics Quadratic equations are probably one of the most popular types of equations that you ll see in algebra. A quadratic equation has
More information1 Continuity and Limits of Functions
Week 4 Summary This week, we will move on from our discussion of sequences and series to functions. Even though sequences and functions seem to be very different things, they very similar. In fact, we
More informationLesson 8: Graphs of Simple Non Linear Functions
Student Outcomes Students examine the average rate of change for non linear functions and learn that, unlike linear functions, non linear functions do not have a constant rate of change. Students determine
More informationCommon models and contrasts. Tuesday, Lecture 5 Jeanette Mumford University of Wisconsin - Madison
ommon models and contrasts Tuesday, Lecture 5 Jeanette Mumford University of Wisconsin - Madison Let s set up some simple models 1-sample t-test -sample t-test With contrasts! 1-sample t-test Y = 0 + 1-sample
More informationLesson 7: Classification of Solutions
Student Outcomes Students know the conditions for which a linear equation will have a unique solution, no solution, or infinitely many solutions. Lesson Notes Part of the discussion on the second page
More informationSolving with Absolute Value
Solving with Absolute Value Who knew two little lines could cause so much trouble? Ask someone to solve the equation 3x 2 = 7 and they ll say No problem! Add just two little lines, and ask them to solve
More informationCHM 105 & 106 UNIT 2, LECTURE SEVEN 1 IN OUR PREVIOUS LECTURE WE WERE TALKING ABOUT THE DYNAMICS OF DISSOLVING AND WE
CHM 105 & 106 UNIT 2, LECTURE SEVEN 1 CHM 105/106 Program 14: Unit 2 Lecture 7 IN OUR PREVIOUS LECTURE WE WERE TALKING ABOUT THE DYNAMICS OF DISSOLVING AND WE WERE TALKING ABOUT PARTICLES GAINING ENERGY
More informationRead the text and then answer the questions.
1 Read the text and then answer The young girl walked on the beach. What did she see in the water? Was it a dolphin, a shark, or a whale? She knew something was out there. It had an interesting fin. She
More information2.4 Solving an Equation
2.4 Solving an Equation Purpose The role this topic plays in quantitative reasoning You can solve some equations that arise in the real world by isolating a variable. You can use this method to solve the
More informationWelcome to Forces an anticipation guide A force is defined as a push or a pull When answering the following true or false statements, offer a
Welcome to Forces an anticipation guide A force is defined as a push or a pull When answering the following true or false statements, offer a real-life example that justifies your answer. You haven t answered
More informationwhere Q is a finite set of states
Space Complexity So far most of our theoretical investigation on the performances of the various algorithms considered has focused on time. Another important dynamic complexity measure that can be associated
More informationPresentation Outline: Haunted Places in North America
Name: Date: Presentation Outline: Haunted Places in North America Grade: / 25 Context & Task Halloween is on it s way! What better way to celebrate Halloween than to do a project on haunted places! There
More informationPark School Mathematics Curriculum Book 9, Lesson 2: Introduction to Logarithms
Park School Mathematics Curriculum Book 9, Lesson : Introduction to Logarithms We re providing this lesson as a sample of the curriculum we use at the Park School of Baltimore in grades 9-11. If you d
More informationLecture Outline. Chapter 7: Energy Pearson Education, Inc.
Lecture Outline Chapter 7: Energy This lecture will help you understand: Energy Work Power Mechanical Energy: Potential and Kinetic Work-Energy Theorem Conservation of Energy Machines Efficiency Recycled
More informationExploring Graphs of Polynomial Functions
Name Period Exploring Graphs of Polynomial Functions Instructions: You will be responsible for completing this packet by the end of the period. You will have to read instructions for this activity. Please
More informationEVENT. the tornado. Made with Love by Dr. Poppy Moon AnyWhere. Any Day
EVENT DATE the tornado Any Day WHERE AnyWhere A Tornado!! A tornado is a violent rotating column of air extending from a thunderstorm to the ground what do tornadoes look like? A picture of a tornado A
More information*Karle Laska s Sections: There is no class tomorrow and Friday! Have a good weekend! Scores will be posted in Compass early Friday morning
STATISTICS 100 EXAM 3 Spring 2016 PRINT NAME (Last name) (First name) *NETID CIRCLE SECTION: Laska MWF L1 Laska Tues/Thurs L2 Robin Tu Write answers in appropriate blanks. When no blanks are provided CIRCLE
More informationLecture Outline. Chapter 7: Energy Pearson Education, Inc.
Lecture Outline Chapter 7: Energy This lecture will help you understand: Energy Work Power Mechanical Energy: Potential and Kinetic Work-Energy Theorem Conservation of Energy Machines Efficiency Recycled
More informationActivity Book Made just for me by the Santa Cruz Consolidated Emergency Communications Center
- - Activity Book Made just for me by the Santa Cruz Consolidated Emergency Communications Center Words In This Book B D F J L M N O W O N K F S W E F A R L F A S K M S V Q R K B I M H N I M M Y Z C I
More informationAnnouncements 23 Sep 2014
Announcements 23 Sep 2014 1. After today, just one more lecture of new material before Exam 1!! a. Exam 1: Oct 2 Oct 7 (2 pm) in the Testing Center, late fee after Oct 6 2 pm b. Exam review sessions by
More informationCS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018
CS 301 Lecture 18 Decidable languages Stephen Checkoway April 2, 2018 1 / 26 Decidable language Recall, a language A is decidable if there is some TM M that 1 recognizes A (i.e., L(M) = A), and 2 halts
More informationChapter 4 - Functions and Relations
Warm Up In your notebook, write down a relationship between two different quantities that could be represented by this graph: Quantity 2 Quantity 1 Sep 21 7:55 AM Chapter 4 - Functions and Relations Vocabulary
More informationD2D SALES WITH SURVEY123, OP DASHBOARD, AND MICROSOFT SSAS
D2D SALES WITH SURVEY123, OP DASHBOARD, AND MICROSOFT SSAS EDWARD GAUSE, GISP DIRECTOR OF INFORMATION SERVICES (ENGINEERING APPS) HTC (HORRY TELEPHONE COOP.) EDWARD GAUSE, GISP DIRECTOR OF INFORMATION
More informationAUGUST homekeeping society CLEAN MAMA, LLC
AUGUST 2018 homekeeping society closets monthly focus + quick tips C L O S E T S C H E C K L I S T O O O O O O O DE-CLUTTER completely empty and clean the space CLEAN SURFACES clean and wipe shelves and
More informationT H E D A Y I R E A L I Z E D I W A S N O T ( Y E T ) A N A G I L E C O A C H
T H E D A Y I R E A L I Z E D I W A S N O T ( Y E T ) A N A G I L E C O A C H T H E J O U R N E Y A N D T H O U G H T S O F A N A G I L E P R A C T I T I O N E R W H O D I S C O V E R E D H I S PA S S
More informationEvaluation Module: Care for the Chronically ill Person Spring 2010 Responsible for the evaluation process: Project manager, Mette Bro Jansen
2010 Evaluation Module: Care for the Chronically ill Person Spring 2010 Responsible for the evaluation process: Project manager, Mette Bro Jansen Table of contents Questions concerning the learning outcome
More informationModule 03 Lecture 14 Inferential Statistics ANOVA and TOI
Introduction of Data Analytics Prof. Nandan Sudarsanam and Prof. B Ravindran Department of Management Studies and Department of Computer Science and Engineering Indian Institute of Technology, Madras Module
More informationPhysics 101 Discussion Week 3 Explanation (2011)
Physics 101 Discussion Week 3 Explanation (2011) D3-1. Velocity and Acceleration A. 1: average velocity. Q1. What is the definition of the average velocity v? Let r(t) be the total displacement vector
More informationNumerical and Algebraic Expressions and Equations
Numerical and Algebraic Expressions and Equations Sometimes it's hard to tell how a person is feeling when you're not talking to them face to face. People use emoticons in emails and chat messages to show
More informationLab 4. Current, Voltage, and the Circuit Construction Kit
Physics 2020, Spring 2009 Lab 4 Page 1 of 8 Your name: Lab section: M Tu Wed Th F TA name: 8 10 12 2 4 Lab 4. Current, Voltage, and the Circuit Construction Kit The Circuit Construction Kit (CCK) is a
More informationName. University of Maryland Department of Physics
Name University of Maryland Department of Physics 4. March. 2011 Instructions: Do not open this examination until the proctor tells you to begin. 1. When the proctor tells you to begin, write your full
More informationAUGUST homekeeping society CLEAN MAMA, LLC
AUGUST 2018 homekeeping society closets monthly focus + quick tips C L O S E T S C H E C K L I S T O O O O O O O DE-CLUTTER completely empty and clean the space CLEAN SURFACES clean and wipe shelves and
More informationLAB 3 - VELOCITY AND ACCELERATION
Name Date Partners L03-1 LAB 3 - VELOCITY AND ACCELERATION OBJECTIVES A cheetah can accelerate from 0 to 50 miles per hour in 6.4 seconds. Encyclopedia of the Animal World A Jaguar can accelerate from
More information