In this episode, you will walk through how to express the solution in steps. Remember that the computer requires the exact steps and conditions in order to execute the code. You’ll do various exercises to identify the exact steps. Expressions must be explicit, step-by-step, repeatable, and absolute.
Oh, and you get to learn about algorithms too.
The Join steps mentioned in the video are for joining WP Developers’ Club.
Your key takeaways are:
- Software tells the calculator (computer) how to solve the problem
- The solution is expressed in a language
- The expression attributes are:
- An algorithm is a recipe. It is a set of explicit, step-by-step, repeatable, and absolute instructions
What are the steps for registering on our website?
Steps to Join
- Click the Join button
- Then fill out the form
- Activate your account
Could your grandmother follow those steps and successfully register for an account without asking you for help?
Are the steps explicit enough that any user could complete the task?
Probably not. Steps are missing. The steps that are listed need more detail.
Problems with Those Instructions
A computer needs the exact steps and conditions in order to complete a task.
- What if you’re not on the home page?
- Where is the Join button?
- What do you put in the form?
- How does my information get into the computer?
- How do I activate my account?
A computer needs the exact steps and conditions necessary to complete a task.
How do you compute 149 + 537?
How does your calculator compute that answer? What is the recipe?
- Add the digits in the right most column (least significant digit – LSD)
- Save the sum
- Place the sum’s LSD into the column
- If the sum > 9, then carry the remaining digit to the next column
- If the next column is > 0 (if there are digits to add)
- Then move to the next column
- Else, stop and display the number
- Add the digits
- Go to Step 2
What did you just do?
You wrote an expression of how to add two positive integers.
Do you see how the recipe above is very specific in its instructions, and still general enough to be reused on other problem sets? This is because the solutions are decoupled from the specific implementation.
Watch the video again to see this process broken down step-by-step.
The four (4) key attributes of an expression are:
What are the Benefits of Writing Expressions?
Any person or device running the sequence will arrive at the same result or behavior.
This means you just developed an algorithm!
What is an Algorithm?
An algorithm is a recipe. It’s a set of explicit, step-by-step, repeatable, and absolute instructions.
Hands off the keyboard. Web development starts by thinking first, then planning it out, and then coding it.
Total Lab Runtime: 01:07:15