Locked lesson.
About this lesson
Exercise files
Download this lesson’s related exercise files.
Flashcard App Introduction and Setup.docx59.1 KB Flashcard App Introduction and Setup - Solution.docx
59.3 KB
Quick reference
Flashcard App Introduction and Setup
We'll create a math flashcard app!
When to use
This fun little app will allow us to use what we've learned so far.
Instructions
The first step in building anything is to create a plan and write it out.
Here's our broad plan:
- create 4 pages for add, subtract, multiply, divide.
- create 2 random numbers
- create form to answer flashcard
- submit button
- new card button
- code to determine correct answer
- code to determine if our answer equals the correct answer
- output answer to the screen
Hints & tips
- Always create a plan and write it out when building an app.
- 00:04 So congratulations, you've come a long way.
- 00:06 We've learned pretty much the basics of PHP so far.
- 00:09 Now it's time to take everything we've learned, put it together and
- 00:12 make a fun little math flashcard app.
- 00:14 Now we're gonna be using a lot of the things,
- 00:16 as much of the stuff that we've learned so far as we can to make this app.
- 00:20 But it's not gonna be that difficult.
- 00:22 And you can see this is just basically what we're doing.
- 00:24 And this doesn't look flash or anything.
- 00:26 If you know HTML and CSS, you can play around with this and
- 00:29 make it look much nicer.
- 00:30 You can use graphics, you can do whatever you want.
- 00:32 We're just gonna be doing the main functionality to get this thing to work.
- 00:36 And you see we have Addition, Subtraction, Multiplication and Division.
- 00:39 And it's just can be very simple.
- 00:40 We'll create some random numbers, display them on the screen.
- 00:43 What's 8 + 4?
- 00:45 12, submit your answer.
- 00:47 Correct, 8 + 4 = 12.
- 00:48 Get a new card, 1 + 3 equals 4, and we're good to go.
- 00:53 Like I said, we can play around with this.
- 00:55 You can do whatever you want to make it look nicer,
- 00:57 to make it look a little more interesting.
- 00:59 But in the next few videos we're gonna be building this thing out.
- 01:01 So before we get started, we've taken a quick look at what we're gonna build.
- 01:05 Now I wanna talk about sort of the mindset that goes into creating anything,
- 01:10 when you're a computer programmer.
- 01:11 So I'm just gonna come over here, click New File and
- 01:13 just keep this as untitled and open it up here.
- 01:16 So whenever I build something, doesn't matter how complicated or
- 01:19 how simple it's gonna be, I like to map out what I'm doing on a piece of paper.
- 01:24 And a lot of computer programmers,
- 01:26 especially veteran programmers will skip this.
- 01:29 They'll just sort of do it in their head or just gonna wing it, and
- 01:32 I think that's a big mistake.
- 01:33 I think it doesn't matter, this app is gonna be a pretty simple app, but
- 01:37 it's still a good idea to map it out step by step what we're gonna do.
- 01:41 And you'll see, as projects get more complicated, it's really easy to get
- 01:45 lost and you start coding, knowing exactly what you're gonna do.
- 01:49 And you get an hour in to it, two hours, five hours, ten hours, a couple of days,
- 01:54 a couple of weeks.
- 01:55 And suddenly the whole thing seems jumbled,
- 01:57 you lose track of what you're trying to do, you lose track of what
- 02:00 you're supposed to do next, and the project just grinds to a halt.
- 02:03 It happens all the time.
- 02:04 Making a quick little list before you get started will save that from happening most
- 02:09 of the time.
- 02:10 And it's really easy to do, it's really quick.
- 02:12 So what are we gonna do?
- 02:12 Well, we're gonna create a math flashcard app we need four pages.
- 02:17 So step one, create 4 pages as subtract, multiply, divide.
- 02:25 Pretty simple.
- 02:26 What else are we gonna need?
- 02:27 Well, we're gonna need to create two random numbers, okay?
- 02:30 So create 2 random numbers.
- 02:34 And we're gonna need a form to answer flashcard.
- 02:41 And that form's gonna need a submit button and a new card button.
- 02:47 What else do we need?
- 02:47 Well, we need to create some sort of code to make sure our answer is correct or not.
- 02:52 So code to determine correct answer.
- 02:57 Well first of all, we need to know what the correct answer is.
- 03:00 So what is 1 + 3?
- 03:02 Our program needs to know that the answer should be four.
- 03:04 So that code will determine the correct answer.
- 03:07 And we need code to determine if our answer equals the correct answer.
- 03:16 And then finally, we need to output the answer to the screen.
- 03:21 Pretty simple, right?
- 03:22 So what is this, eight steps?
- 03:25 And now this is very rough, right?
- 03:27 This is just, we're not getting into any kind of detail here.
- 03:30 We're just sort of mapping it out in our minds, putting it down on paper.
- 03:34 Just a basic rough outline of what we're gonna do.
- 03:36 Now in the next few videos, we'll go through here and
- 03:38 we'll knock out each of these and misspelled flash card.
- 03:42 And you'll see that this is just a good way to do it.
- 03:44 So I recommend whenever you create any sort of app into the future,
- 03:47 any sort of project, anything you work on ever, just take a couple of minutes and
- 03:51 map it out on a piece of paper.
- 03:53 I like to write it out.
- 03:54 I've got a yellow legal notepad that sits on my desk next to me.
- 03:58 I like to write it out with an actual pen or a pencil.
- 04:00 Or you could do it on a computer like this,
- 04:03 whatever is most comfortable for you.
- 04:05 So in the next video, we're gonna start building this app.
Lesson notes are only available for subscribers.