All right, I should start this entry tomorrow, but it's 1:03 a.m. and I feel like continuing with my studying, I'm rehydrated, refreshed, and ready to go. :)
I'm starting with Chapter 15, "What is Pseudocode?" I'm pretty stoked to learn about working with pseudocode. I understand the basics of pseudocode now, and I watched a Khan Academy video on pseudocode. Here's a great example of pseudocode from the chapter!
In the video, the author actually wrote the pseudocode into the text editor, which is something the chapter mentioned we could do, but I've never done it myself. I like it.
Next, I started on Chapter 16, "The Elements of Pseudocode." The chapter started off by stating that we will start referring to our pseudocode as either a "program" or a "script" (or later, a "module"). The chapter mentioned that programs run from top to bottom, which I had learned previously while working with html/css/javascript. Here's a pseudocode example from this chapter:
Then here's the same, but with syntax a bit more formal (closer to actual code):
Neat. And then here's a while loop:
I've used loops before, so I'm familiar with a while loop. Then here's one that's new to me, "TIMES DO," which when preceded by a number, will repeat the code following it as many times as the value of the number.
Then we have this one, "EACH," which is totally new to me:
I want to work with that one more to get some practice with it. So, to sum up, we went over IF, ELSE, IF ELSE, DO, WHILE, EACH, "X" TIMES DO, and WHEN.
I went through a slide presentation on pseudocode with 164 slides, and then I decided to practice by making my own pseudocode for the Floyd Mayweather - Manny Pacquiao fight, just for fun, and to start flexing my pseudocode muscles. Here it is, from Mayweather's perspective (FM is Floyd Mayweather and MP is Manny Pacquiao):
PROGRAM DefeatMannyPacquiao
WHILE (MP is still standing) DO
IF (MP jabs) THEN
FM take a step back and throw a jab
ELSE IF (MP throws an uppercut) THEN
FM take a step back and throw a jab
ELSE IF (MP throws a haymaker) THEN
FM take a step back and throw a jab
ELSE IF (MP takes a step back) THEN
FM take a step back and throw a jab
ELSE
FM take a step back and throw a jab
END
END
Just having some fun with things before I go to bed. :)
O.k., I'm awake now, and I'm going to continue the same blog post, since the earlier content from this post was made in about an hour of work very late last night. Ideally, I can complete up to chapter 22 today and then do the module project and the three "wrap-up" chapters tomorrow. Getting all of that done is a fair amount of work, so let's get going!
Here's how to make a cup of tea in pseudocode (you can remove the PROGRAM and END part if you want to keep it less formal):
This pseudocode is to check if a number is bigger than another:
I learned that iteration is another word for loop. Here's an example of a while loop in pseudocode:
This is the format for the pseudocode above:
I like practicing with pseudocode, it helps me think like a programmer. This code prints out the numbers 1 through 5:
Neat. Here's some pseudocode to look through a phone book!
This is fantastic, I'm really enjoying this. I can see how you can start with these building blocks and build greater things. Here's a complete pseudocode program for making that cup of tea:
I like this. Let's do some more examples, below, let's say we want to "Read in a number and print it out."
Next, below, let's say we want to "Read in a number and print it out double the number."
Next, below, let's say we want to "Read in a number, then check if it is odd or even."
Next, below, let's say we want to "Read in two numbers, call them A and B. If A is bigger than B, print out A, otherwise, print out B."
Some more! This is great, I like getting in all these examples, I'm going to be re-writing them on my dry erase board! Next, it gets a little more complicated, here's the goal:
And then here's the pseudocode below:
Ok. Then let's say, below, we want to "Print out the numbers from one to 5."
Or, below, if we want to "Add up the numbers from 1 to 5 and print out the results."
Next, below, is this one, "Read in a number and check if it's a prime number." As an additional explanation, a prime number is a number that is only divisible by itself and 1, for example, 7 is a prime number. From the slide:
Another way to put it is that every number other than itself and 1 gives a remainder, for example, for 7, if 6, 5, 4, 3, and 2 give a remainder, then 7 is prime. So, all we need to do is divide 7 by all numbers less than it, but greater than one, and if any of them have no remainder, then we know it's not a prime.
Now, before I post this one, the code that follows will help me solve that third Euler problem I was stuck on a while back, so that's pretty awesome...
And then here's the code below...this is great...I'll have to go over this again several times until I can write it from memory, it will help me solve Euler Problem 3.
O.k., I'll have to save that and work on it when I get into the coding module, because I don't want to get sidetracked, I want to move on to the next chapter, so, moving on to Chapter 17, "Practice with Pseudo-coding."
For chapter 17, the first assignment is to write the instructions for making a grilled cheese sandwich in pseudocode (it should be at least 20-30 steps). Here's my work:
PROGRAM MakeGrilledCheeseSandwich:
Retrieve a tomato from the refridgerator;
Retrieve a jalapeno from the refridgerator;
Retrieve an onion from the refridgerator;
Retrieve a bottle of mustard from the refridgerator;
Retrieve a bottle of mayonnaise from the refridgerator;
Retrieve a loaf of bread from the pantry;
Retrieve a cutting board from a kitchen cabinet;
Retrieve a blade from a kitchen drawer;
Organize all the above items on the kitchen island;
Cut two big slices off of the tomato;
Cut a small slice off of the onion;
Cut the jalapeno into small pieces;
Take two slices of bread and lay them on a plate next to each other;
Put mustard on what will be the bottom slice of bread;
Put mayonnaise on what will be the top slice of bread;
Put two slices of cheese on what will be the bottom slice of bread;
Put the jalapeno pieces on top of the cheese;
Put the tomato slices on top of the cheese;
Put the onion slices on top of the cheese;
Put the top slice of bread on top of the slice with most of the ingredients on it, with the mayonnaise side facing down;
Plug in your George Foreman grill;
Place the grilled cheese sandwich in the grill;
Grill for two minutes or until bread crisps and cheese melts;
Turn off George Foreman Grill;
Eat sandwich;
END
The next assignment is to write a program which will acquire a variable number of items from a grocery store with 10 unlabeled aisles, and which will then check out with all the items (it should be more than 50 steps).
So, I went with a WHILE loop for this one instead of doing 50 plus lines, like so:
PROGRAM Shopping:
READ list of items;
DO grab a shopping cart;
DO walk through the aisles, from the first to the tenth, viewing every item;
WHILE (item that you are looking at does not equal any of the items in the list AND there are still items in the list)
DO keep walking down the aisle looking at items;
IF (item you are looking at matches an item on the list)
DO remove the item from the list;
DO place item in your shopping cart;
ELSE IF (there are no more items in the list)
DO take shopping cart to checkout counter;
DO pay for items in shopping cart;
ELSE IF (item in list of items has not been found after searching entire store)
DO remove item from the list;
DO take shopping cart to checkout counter;
DO pay for items in shopping cart;
ENDWHILE
END
It took me 18 lines, and I could have taken many more lines and not used a WHILE loop, but I was a bit out of practice with loops, so I thought it would be good for me to work on a loop.
The next assignment involves a logic game with these rules:
And this is the pseudocode I came up with:
PROGRAM LogicGame:
NumberWeAreOn = 1;
PersonWeAreOn = 1;
WHILE (NumberWeAreOn <= 100)
NumberWeAreOn = NumberWeAreOn + 1;
PersonWeAreOn advances one person in the current direction (begin by going clockwise around the table);
IF (NumberWeAreOn / 7 = No Remainder)
DO PersonWeAreOn advances in the opposite of the current direction;
ELSE IF (NumberWeAreOn / 11 = No Remainder)
DO PersonWeAreOn advances two people instead of one;
ELSE IF (NumberWeAreOn = 100)
THEN print PersonWeAreOn;
END
I really want to be able to solve that problem now using actual code. I'm curious as to how the "switch direction" feature would be handled. So, I'm done with that chapter, and now I'm moving on to Chapter 18, "Solve Complex Problems Modularly."
We discussed modularity, which is the degree to which a system can be broken into its components. The best solution to our design challenge isn't one giant task but a system of separate and mostly independent sub-tasks working together towards a common goal. Viewed another way, modularity is separating and delegating. Wikipedia defines modularity as the degree to which a system's components may be separated and recombined.
Next was Chapter 18, "Amazon.com: A Modularity Case Study." The term Service Oriented Architecture (SOA) was introduced, which is a high level architectural pattern used by many top software companies today which basically embodies the idea of modularity on a large scale. In SOA, each separate sub-section of the overall architecture is designed to be completely independent from every other and they communicate using specified interfaces (called Application programming Interfaces (API's)).
I saw a video about SOA, which mentioned that SOA does affect performance (slows it somewhat), but at the same time, makes a system easier to fix when it breaks, due to the modularity. I read an interesting email by Jeff Bezos.
O.k., it's late, time to call it a night, I'll pick up on Chapter 20, "Characteristics of Good Systems" tomorrow.
SUMMARY OF CODING SKILLS
I'm starting with Chapter 15, "What is Pseudocode?" I'm pretty stoked to learn about working with pseudocode. I understand the basics of pseudocode now, and I watched a Khan Academy video on pseudocode. Here's a great example of pseudocode from the chapter!
In the video, the author actually wrote the pseudocode into the text editor, which is something the chapter mentioned we could do, but I've never done it myself. I like it.
Next, I started on Chapter 16, "The Elements of Pseudocode." The chapter started off by stating that we will start referring to our pseudocode as either a "program" or a "script" (or later, a "module"). The chapter mentioned that programs run from top to bottom, which I had learned previously while working with html/css/javascript. Here's a pseudocode example from this chapter:
Then here's the same, but with syntax a bit more formal (closer to actual code):
Neat. And then here's a while loop:
I've used loops before, so I'm familiar with a while loop. Then here's one that's new to me, "TIMES DO," which when preceded by a number, will repeat the code following it as many times as the value of the number.
Then we have this one, "EACH," which is totally new to me:
I want to work with that one more to get some practice with it. So, to sum up, we went over IF, ELSE, IF ELSE, DO, WHILE, EACH, "X" TIMES DO, and WHEN.
I went through a slide presentation on pseudocode with 164 slides, and then I decided to practice by making my own pseudocode for the Floyd Mayweather - Manny Pacquiao fight, just for fun, and to start flexing my pseudocode muscles. Here it is, from Mayweather's perspective (FM is Floyd Mayweather and MP is Manny Pacquiao):
PROGRAM DefeatMannyPacquiao
WHILE (MP is still standing) DO
IF (MP jabs) THEN
FM take a step back and throw a jab
ELSE IF (MP throws an uppercut) THEN
FM take a step back and throw a jab
ELSE IF (MP throws a haymaker) THEN
FM take a step back and throw a jab
ELSE IF (MP takes a step back) THEN
FM take a step back and throw a jab
ELSE
FM take a step back and throw a jab
END
END
Just having some fun with things before I go to bed. :)
O.k., I'm awake now, and I'm going to continue the same blog post, since the earlier content from this post was made in about an hour of work very late last night. Ideally, I can complete up to chapter 22 today and then do the module project and the three "wrap-up" chapters tomorrow. Getting all of that done is a fair amount of work, so let's get going!
Here's how to make a cup of tea in pseudocode (you can remove the PROGRAM and END part if you want to keep it less formal):
I learned that iteration is another word for loop. Here's an example of a while loop in pseudocode:
This is the format for the pseudocode above:
I like practicing with pseudocode, it helps me think like a programmer. This code prints out the numbers 1 through 5:
Neat. Here's some pseudocode to look through a phone book!
This is fantastic, I'm really enjoying this. I can see how you can start with these building blocks and build greater things. Here's a complete pseudocode program for making that cup of tea:
I like this. Let's do some more examples, below, let's say we want to "Read in a number and print it out."
Next, below, let's say we want to "Read in a number and print it out double the number."
Next, below, let's say we want to "Read in a number, then check if it is odd or even."
Next, below, let's say we want to "Read in two numbers, call them A and B. If A is bigger than B, print out A, otherwise, print out B."
Some more! This is great, I like getting in all these examples, I'm going to be re-writing them on my dry erase board! Next, it gets a little more complicated, here's the goal:
And then here's the pseudocode below:
Ok. Then let's say, below, we want to "Print out the numbers from one to 5."
Or, below, if we want to "Add up the numbers from 1 to 5 and print out the results."
Next, below, is this one, "Read in a number and check if it's a prime number." As an additional explanation, a prime number is a number that is only divisible by itself and 1, for example, 7 is a prime number. From the slide:
Another way to put it is that every number other than itself and 1 gives a remainder, for example, for 7, if 6, 5, 4, 3, and 2 give a remainder, then 7 is prime. So, all we need to do is divide 7 by all numbers less than it, but greater than one, and if any of them have no remainder, then we know it's not a prime.
Now, before I post this one, the code that follows will help me solve that third Euler problem I was stuck on a while back, so that's pretty awesome...
And then here's the code below...this is great...I'll have to go over this again several times until I can write it from memory, it will help me solve Euler Problem 3.
O.k., I'll have to save that and work on it when I get into the coding module, because I don't want to get sidetracked, I want to move on to the next chapter, so, moving on to Chapter 17, "Practice with Pseudo-coding."
For chapter 17, the first assignment is to write the instructions for making a grilled cheese sandwich in pseudocode (it should be at least 20-30 steps). Here's my work:
PROGRAM MakeGrilledCheeseSandwich:
Retrieve a tomato from the refridgerator;
Retrieve a jalapeno from the refridgerator;
Retrieve an onion from the refridgerator;
Retrieve a bottle of mustard from the refridgerator;
Retrieve a bottle of mayonnaise from the refridgerator;
Retrieve a loaf of bread from the pantry;
Retrieve a cutting board from a kitchen cabinet;
Retrieve a blade from a kitchen drawer;
Organize all the above items on the kitchen island;
Cut two big slices off of the tomato;
Cut a small slice off of the onion;
Cut the jalapeno into small pieces;
Take two slices of bread and lay them on a plate next to each other;
Put mustard on what will be the bottom slice of bread;
Put mayonnaise on what will be the top slice of bread;
Put two slices of cheese on what will be the bottom slice of bread;
Put the jalapeno pieces on top of the cheese;
Put the tomato slices on top of the cheese;
Put the onion slices on top of the cheese;
Put the top slice of bread on top of the slice with most of the ingredients on it, with the mayonnaise side facing down;
Plug in your George Foreman grill;
Place the grilled cheese sandwich in the grill;
Grill for two minutes or until bread crisps and cheese melts;
Turn off George Foreman Grill;
Eat sandwich;
END
The next assignment is to write a program which will acquire a variable number of items from a grocery store with 10 unlabeled aisles, and which will then check out with all the items (it should be more than 50 steps).
So, I went with a WHILE loop for this one instead of doing 50 plus lines, like so:
PROGRAM Shopping:
READ list of items;
DO grab a shopping cart;
DO walk through the aisles, from the first to the tenth, viewing every item;
WHILE (item that you are looking at does not equal any of the items in the list AND there are still items in the list)
DO keep walking down the aisle looking at items;
IF (item you are looking at matches an item on the list)
DO remove the item from the list;
DO place item in your shopping cart;
ELSE IF (there are no more items in the list)
DO take shopping cart to checkout counter;
DO pay for items in shopping cart;
ELSE IF (item in list of items has not been found after searching entire store)
DO remove item from the list;
DO take shopping cart to checkout counter;
DO pay for items in shopping cart;
ENDWHILE
END
It took me 18 lines, and I could have taken many more lines and not used a WHILE loop, but I was a bit out of practice with loops, so I thought it would be good for me to work on a loop.
The next assignment involves a logic game with these rules:
And this is the pseudocode I came up with:
PROGRAM LogicGame:
NumberWeAreOn = 1;
PersonWeAreOn = 1;
WHILE (NumberWeAreOn <= 100)
NumberWeAreOn = NumberWeAreOn + 1;
PersonWeAreOn advances one person in the current direction (begin by going clockwise around the table);
IF (NumberWeAreOn / 7 = No Remainder)
DO PersonWeAreOn advances in the opposite of the current direction;
ELSE IF (NumberWeAreOn / 11 = No Remainder)
DO PersonWeAreOn advances two people instead of one;
ELSE IF (NumberWeAreOn = 100)
THEN print PersonWeAreOn;
END
I really want to be able to solve that problem now using actual code. I'm curious as to how the "switch direction" feature would be handled. So, I'm done with that chapter, and now I'm moving on to Chapter 18, "Solve Complex Problems Modularly."
We discussed modularity, which is the degree to which a system can be broken into its components. The best solution to our design challenge isn't one giant task but a system of separate and mostly independent sub-tasks working together towards a common goal. Viewed another way, modularity is separating and delegating. Wikipedia defines modularity as the degree to which a system's components may be separated and recombined.
Next was Chapter 18, "Amazon.com: A Modularity Case Study." The term Service Oriented Architecture (SOA) was introduced, which is a high level architectural pattern used by many top software companies today which basically embodies the idea of modularity on a large scale. In SOA, each separate sub-section of the overall architecture is designed to be completely independent from every other and they communicate using specified interfaces (called Application programming Interfaces (API's)).
I saw a video about SOA, which mentioned that SOA does affect performance (slows it somewhat), but at the same time, makes a system easier to fix when it breaks, due to the modularity. I read an interesting email by Jeff Bezos.
O.k., it's late, time to call it a night, I'll pick up on Chapter 20, "Characteristics of Good Systems" tomorrow.
SUMMARY OF CODING SKILLS
Total Treehouse Points: 5,385
Treehouse Points by Subject Matter (Miscellaneous not included):
HTML: 663
CSS: 1,599
Design: 1,193
Development Tools: 747
Javascript: 1,120
Treehouse Ranking (%): "You have more total points than 94% of all students."
Treehouse Badge(s) Earned Today:
Treehouse Courses Completed:
How to Make a Website
HTML
CSS Foundations
CSS Layout Techniques
Aesthetic Foundations
Design Foundations
Adobe Photoshop Foundations
Adobe Illustrator Foundations (66% complete, switched focus from web design to web dev)
Git Basics
Introduction to Programming
Javascript Basics
Codecademy (& other) Courses Completed:
HTML and CSS (Codecademy)
Design Foundations
Adobe Photoshop Foundations
Adobe Illustrator Foundations (66% complete, switched focus from web design to web dev)
Git Basics
Introduction to Programming
Javascript Basics
Codecademy (& other) Courses Completed:
HTML and CSS (Codecademy)
Books Read or in Progress:
Completed: "Head First HTML and CSS," by E. Robson & E. Freeman
In Progress: "Eloquent JavaScript," by Marijn Haverbeke (On pg 27)
In Progress: "Head First Javascript," by Eric Freeman and Elisabeth Robson (On pg 56)
In Progress: "A Smarter Way to Learn Javascript," by Mark Myers (on pg 72)
My Progress on The Odin Project:
1. Introduction to Web Development 100% Complete
2. Web Development 101 29% Complete
3. Ruby Programming 0% Complete
4. Ruby on Rails 0% Complete
5. HTML5 and CSS3 0% Complete
6. Javascript and JQuery 0% Complete
7. Getting Hired as a Web Developer 0% Complete
Hours Spent Coding Today: 9
Total Hours Coding: 527
This comment has been removed by the author.
ReplyDelete