Walkthrough: Problem Set 7


[Walkthrough Problem Set 7] [Zamyla Chan] [Harvard University] [This is CS50] [CS50.TV] Hello everyone, and welcome to Walkthrough 7, CS50 Finance. Now we are officially done with all of the psets in CS50, and we’re just left with one more which is going to be a fun implementation of a website where users can log in to CS50 Finance and buy and sell stocks. Today, we are going to have a few tools at our disposal. We’re going to be talking about permissions. Whenever you have a web folder, you’re going to want to allow users to execute certain files but also just read other ones, so we’ll look into permissions and how you can set those. Then we’re going to look into PHP, HTML, and SQL code. First, permissions. When you’re in the terminal in a certain directory, then what you want to do is you want to run the chmod command. That’s followed by either letters or numbers corresponding to what you basically want the world to see, you yourself to see, etc. For instance, whenever you have a folder, then you want that folder to be executable by everyone that sees it, so what you would do is you could run the command chmod a+x and then the name of your folder. When you have a file such as CSS files or image files– like JPEGs and bitmaps, things like that, or any JavaScript code– you want that to be readable by everyone, so then what you do is you could use the wildcard– which is an asterisk– to basically indicate in the CSS folder–everything in that folder– I’m going to say that that’s going to be readable by everyone. With permissions, when we use the letters, we can also use numbers instead. So, you see that ultimately when you want something to be executable– that’s represented by the number 1– something to be readable is the number 4 and then– writable is number 2– and so essentially when you want a combination of those, then you add them. If you want something to be readable, writable, and executable, then you would add up 4, 2, and 1 and that would give you 7, then whenever you have a folder you want that to be executable by everyone– as well as readable and writable–then you make that 7, 1, 1. That would be 7 for you, then 1 for the other people. When you have the spec, it’ll actually specify which folders and which files need to be chmod-ed specifically. For instance, when you have folders–those are 7-1-1– when you have images, or HTML, CSS, JavaScript, then those are going to be 6, 0, 4–or 6, 4, 4– and then PHP files are going to be 6, 0, 0. The idea behind that is that users shouldn’t actually see your PHP code, but just be able to see the output. Great! Moving into PHP. Simply, whenever you want a PHP file, the file suffix is .php. You can also mix HTML with PHP code. If you have an HTML file, for instance, then you can enclose it with the left angle, question mark, php– put your php code–and then close that with another question mark and a right angle. Variables in PHP are a lot easier to deal with than variables in C. Any variable just starts with a dollar sign in front of it, and they’re weakly typed. That means that you don’t need to worry about setting something equal to a string or an integer. You can just simply say, this is my name of the variable and then this is its value, so it’s going to be easier to deal with there. Another thing is that PHP allows you to use associative arrays. You can just simply define an array like you would in C by saying, dollar sign-the name of your array-equals, and then in square brackets have basically just the list of values of all the elements in the array. But, in PHP what you can also do is specify basically the– it’s kind of like a hash function. You can specify the index–what you’re going to call it– and then that corresponds to a value. If you actually pass in a=1, b=2, c=3, then your array at index a would give you 1. This pset will warm you up with some PHP in a section of questions, and then we dive into CS50 Finance. We have a couple of–we have some functionality, basically, to implement in this website. We want to allow users to register in our website with a user name and a password. We want to allow them to look up a quote, and then we would print out the name of that quote as well as the current price that it’s at. We want to allow them to see a portfolio of all of the shares that they have bought thus far. We also want to allow them to buy stocks as well as sell them. And then finally, we want to allow them to see the history of all of the transactions that they’ve made. Then, finally, after you’ve implemented all of that, then you’re free to implement one extra feature. We’ll go into those. Those can be either allowing users to get extra cash by depositing extra cash, or you could allow them to change their password, or something like that, email them a receipt when they buy or sell a stock. There’s a limited list of features that you could implement yourself, so that’s the last one there. Since this is a website, you guys also have a lot of freedom to customize it. We do provide some CSS code, but you’re definitely free to tweak it, make it look nicer, but underlying it is a basic functionality so always refer to the spec about what you actually need to include there. Following the spec, we’re going to be using the appliance as also a server. It’s going to be hosting our website for us, on its local server. If you follow these instructions and unzip the pset 7 distribution code into your virtual host/local host folder, then you can just visit http://localhost/ in Google Chrome in the appliance, and then you would reach the code in which you’ve written pset 7. Pset 7 comes with a bunch of distribution code, and hopefully we’ve–through all of the psets before this– accustomed us to reading through distribution code, understanding what functions are already provided, and how we might be able to use those and the other functions that we’re going to be implementing. In this case, we have 3 folders. We have an HTML folder, an includes folder, and a templates folder. What we’re going to be doing with this pset is kind of separating the thinking– the programming thinking–of the PHP code with the actual visual aspect. We’ll have one PHP file that does all of the thinking, reads into the database, prints out things, has if statements–things like that– and then that’ll pass data into our template file–or template.php file. What that will do is read the data and then it will print it out. We can treat templates as “dumb” in that we don’t really want them to be doing a lot of work in calculating things. We want our controllers to do that. A little bit on that–let’s take a look at some of the distribution code. Here we have our index.html file, and it’s pretty empty. Essentially what it does–it says, well, I’m going to require the configuration.php file. We don’t see that right there, but it’s basically calling the configuration.php file, and executing that. After it does that, it’s going to render the portfolio. Rendering is a function, so whenever we’re in a controller, we’ll call render, we’ll give it the file and then the data that we’re passing in, so that it’ll call in portfolio.php–kind of pass in that data so that portfolio can deal with that. And now, here, we have our login.php form. This is the controller that basically takes care of the logging in. Here, it checks if a form was submitted to this file and deals with validating the submission. We’ll look into this apologize function. When we want to print out an error message, we use apologize and that will redirect the user to a specific page that will print out the specific error message that we indicate. Continuing on, it will query the database–we’ll get into more of that later. Then you see that down here if a form wasn’t submitted, then it renders a form. That means that it goes to login_form.php, so let’s look at that. Login.php is actually where we see the HTML dealing with the actual visual aspect. Here we have an input tag for the user name, an input for the password, as well as a submit button. That’s actually where the visual aspect and the HTML form is going to be held. Here, it says that it’s going to be submitted by a certain method, called post. We’ll get into the differences between methods– post versus get, there’s also something called put– we’ll get into those methods later, but for the interest of this pset, I would highly encourage you to use post. We know that basically once this form is submitted– from login_form.php– then it will go to the action–login.php– basically pass in all those parameters from those forms into login.php. The results from that form are contained within this post associative array. The indexes of the different elements in the post array are exactly what you specify here. You say that the name of this input is username. The name of this one is password. Similarly, you see the username as the index of the associative array there. If we go to the includes folder, we have this functions file which is going to be very useful. All of these functions are implemented for you. You don’t need to specifically implement any of these yourself, but they’re going to quite useful. We have apologize, which as I said before, will basically print out an error message for you on a specific page–apology.php. Then we have dump, so if you just call dump and then pass in the variable, then it will bring you to a page that will display that variable for you. Then we have logout, which will basically end a certain user’s session. Lookup is going to be useful. Since we’re dealing with quotes and stocks, we’re going to be able– and it’s essentially real time. We need to know what those stock values are, so we have the lookup function which deals with Yahoo’s documentation of stocks. Once you look up a certain symbol of a stock, it will return to you the stock symbol as well as the name and the current price of that stock. That’s the lookup function. Then we’re dealing with mySQL, so we’re going to be wanting to execute certain queries on our SQL database. We have query to deal–to kind of abstract some of that out. We’re going to be passing in the whole string of our SQL query– and all of the variables that go in it– and what this does is actually execute that for us. Instead of having to write all of this out every time that you want to query– by getting all of the results from that query– then you can just call the query function, and it’ll return to you– depending on what you’re using for your query– probably a row of all of the results that match the query or similar. More on that later though. Finally, we have redirect which, as the name suggests, redirects you to a different page. And then we have render, which we’re going to be calling a couple of times. When you’re in a controller, you call render into the template page and then pass in the values that the template will then deal with. Those values are probably going to be dealing with the type of output that you want to be shown on your template page. Okay. Those are the functions, and there is a lot more to this distribution code. I encourage you to go through this and explore it yourself. Also, the spec will probably walk you through some other elements of the distribution code. Here is a summary of the functions found in functions.php. Okay. The first task is to allow users to register on the website. Right now, there is a login form on the website, and you are provided with a few users with passwords. You can use those usernames and log in, but you want to allow people to make their own usernames and add themselves to the website. The layout for registration is pretty similar to the login form, except the username isn’t pre-existing, and the user also needs to provide a new password, and then typically we have a password confirmation. Once the user inputs all of that information, we want to add them to our database of users. We’re going to have a database–a SQL database– that we’re going to reference. In that database, we’ll have a table with all of the users containing their username, their password, and also how much cash they have. In register, we want to allow them to enter that information. We want to display that form. We want to make sure that their password– that they entered one, and then also that the passwords match when they enter it twice. After all of that is done–assuming that those errors are checked– then we want to add those users to our database. Finally, once you’ve registered, it’s pretty convenient if you don’t need to log in again once you’ve registered, so we’re going to log them in to the website if they’ve registered in successfully. The first task is to display the form, and this is actually going to be– this whole registration process is going to be modeled pretty closely after login except instead of login.php you might have register.php. Instead of login_form.php–which is the template– you’ll have register form. You’ll want to add one more field–a password confirmation field– instead of just the one username and the one password. Next, we want to check whether the passwords match or are blank. We have the controller–register.php–which is going to take care of doing these checks. When a form is submitted via the post method, then all of those variables are contained within the post array. You want to make sure that the post array value at index password matches the confirmation element. You want to make sure that they aren’t blank, and you want to make sure that they’re the same. One convenient thing about PHP is that we don’t need to use string compare anymore. We can use the equals-equals operator to check whether strings are equal to one another. For error handling, you’ll want to apologize. To apologize, you simply call the function and then specify a type of message that you want to output. You then want to add the user to the database. Up until now, all we’ve been doing is just dealing locally with the results of the form. Now, we actually want to add them to our database. For this, we first want to make sure that the username isn’t blank. Understand that on a website, you can’t have multiple users with the same username, so you’ll want to make sure that when you insert something into your database– insert a new user–then you don’t get a collision between a pre-existing username and the username that a user is trying to submit. For this, once you execute a query– inserting a certain user with their password and an initial amount of cash– once you call that query, then mySQL will actually return false if it fails. The structure of users is such that the username is a unique value, so you can’t have more than one. When you try and insert a new row with a username that already exists, that’s going to return false–like a Boolean-value false. A tricky thing here is that you’ll want to check if the result is the result of your query. If it fails, then you’ll want to check with the triple-equals operator. That’s actually going to check whether there is a failure or not, whereas, in just a simple equals-equals, it would be true if the row was empty. The result of a failure if there is a collision between usernames is the actual false value. Here is how you would insert into a database. Here is the query that you would run strictly in SQL. One thing is that you can actually go to the website that manages your SQL database and play around there by entering manually either values or rows. It will output what the SQL output is. You can also run SQL commands within your database and then see what the syntax might be, and then translate that into the query function that we have in pset 7, which is going to be very similar to the queries that you actually run. If I wanted to insert a new row into my users table, then I would specify insert into users, which is the name of my table. Then I would specify the column names. Then I would provide the values along with my password. Passwords in our users table aren’t stored as just the string. They are stored as the encrypted version, so you’ll want to run the function crypt on the actual password, and that will give you the correct type of storage for the users array. Running this will insert a new row into your users table. To deal with the query function, before in C we used the percent sign as a placeholder. Similarly, the same concept of a placeholder applies here. With query, you specify the whole query, except whenever you’re dealing with variables as your input into the query, then instead of actually putting them inside–like when we had printf statements in C. We would put the string and then have a placeholder there, and then after each comma, specify which variable we had. Here, we’re going to use the question mark sign as our placeholder and then pass in each variable, respectively in order, for the placeholders– where those variables should go. So here, the first question mark would be replaced by the actual username then the second question mark by the password. Then finally, once you’ve registered them and added them to the database, then you want to log them into the website. We have kind of a super-global variable called session. Session takes a certain id, and that id corresponds to the user that’s currently logged in. What you’ll want to do is find what their user id is and then set that session id as that particular user’s id. A function that you’ll want to use here is a SQL command that will retrieve the last inserted id number from your table. Then rows will call–it’ll call the id–it’ll assign a name to the number that it returns. It’ll call that id. Now we’ve finished register, and we can move on to quote. Quote allows a user to input the name of a certain stock, and then it’ll return the qualities of that stock. What you’ll want to do here is have a controller and some templates. In this case, we’re going to have a controller which is going to do all of the thinking for us. It’s going to look up the symbol and then pass in values to the templates that will print out. We’re going to have 2 templates here. We’re going to have 1 template that provides the form in which users are going to input the name of the stock–the name of the share. Then we’re also going to want another template that displays those values. You can look into login for an example of how you would have a form that accepts input, except in here, we only want 1 field. We don’t want a username and a password field. We just want 1 text field that allows the user to input the name of a certain stock. Then you want to send that data–once you have looked up that stock– to quote_form.php. Lookup will return the symbol of a stock, the name, and a price. Those are contained within an associative array. Look up the lookup function inside the functions.php for more information on the return types of those. Great! So then finally, you’ll want to display the stock information. You’ll want to probably display–you’ll want to access those variables. Once you have the price in a variable– as well as the name and the symbol– then you’ll want to display those in your template page. That template page could be called show_quote.php or something. Your quote.php page would render show quote and then pass in all of those values. Then in your php page, you actually print out those values to the HTML aspect of the page. You just use the print function and pass in the price. There are 2 ways–you can either concatenate it with the dot operator, or use a placeholder. The users eventually are going to be buying and selling stocks. We want to allow them some way of seeing all of the stocks that they currently have. We’re going to call that their portfolio. Portfolio would, presumably for every user, contain a bunch of rows listing the type of share that they have and then how many of those they have. Our existing table–right now we have a users table in our database. That contains a user’s username as well as their password and how much cash they have. There’s no real way of storing all of their stocks within that. It’s not like we can insert new columns for every stock. That would be a very, very long row because we have an infinite quantity of types of stocks that they could have. So, instead what we’ll do is within the same database, we’ll have a users table, but then we’ll also have a portfolio table. The portfolio table will be definitely linked to the users table, but instead the portfolio table structure will have the stock information, how many shares of that stock the user has, as well as a user’s particular id number. You have the users table which has an id as well as the username, the hash– which is the password, the encrypted password– and then the amount of cash they have. The id number would be linked to the id number from the portfolio. The portfolio would just have the symbol of the stock as well as the shares– the number of shares of that stock that the user has. In that portfolio table you would have basically all shares possessed by all of the users on your site. Later on, to specify only a certain user’s shares–only their portfolio– you would retrieve the values from your portfolio’s table such that the id number is specific to that user. When you display the portfolio, you’ll want to report each of the stocks in a user’s portfolio. You’ll want to report the number of shares and the current value of those shares. That current value of those shares isn’t stored in the portfolio table because that’s going to be updating–at minimum–every day by Yahoo. To get that information, you can’t reference that from your SQL query. What function provides that to us? What function will get the price? That’s lookup, so using lookup on a particular symbol will give you a lot of information. It’ll give you 3 pieces of information–the name, the symbol, as well as the price. Once you lookup a certain symbol, then you can get the price, and then you can use the price to be displayed in your portfolio. The portfolio should also display the user’s current cash balance. That field is stored within your users table. So then remembering how we’re basically having to– we’re having different types of PHP files. We’re going to have a controller which basically does all the thinking for you. And then we have a template in which the template deals with outputting data. You have to think of what variables the controller will need to take in. If we’re dealing with a portfolio which outputs every name, symbol, and share number, as well as current price of a stock, then you’ll want to find some way of basically passing in– you can pass in an array of values that match that. Let’s go into an example of how you might retrieve all of the stocks owned by a particular user. This isn’t dealing–yet–with the price of the stock. What this would do is run a query. It would obtain the symbol as well as the shares from– I’m calling this table, but in this case what would it be? What’s the name of the table that we’re dealing with that has symbol and shares for a particular user? It’s either users or portfolio. Portfolio. What this would do is query portfolio for the symbols and shares for a particular user. Here, I say, (SELECT symbol, shares FROM tbl– but instead of table, you’re going to replace that with portfolio. ‘Where’ is basically my condition. I’m saying I only want to get those associative arrays that correspond to this following condition–id equals. Then I’m putting a placeholder there and then session id. What this would do is say for each row in rows. This is a neat way instead of actually having to set up a for loop that iterates over all of the indexes, then in PHP you can have a for-each loop. If you have a given array, then you can say I’m going to call every successive element– I’m going to call every element this name. So, for each one of these elements, I’m going to call them this, then I can do this. In this for each, you have rows as your actual array, and each row you’re going to call row. Every time it executes the body, it will go up and it will update row to the next element in rows. Now, in terms of buying stocks, what we want to do is get the stock that the user wants to buy and the amount of shares that the user wants to buy, and then–if they want– add that stock to their portfolio. Obviously, if they’re buying something, then that’s going to decrease the amount of money they have, so that’s going to decrease their cash. We’re going to be dealing with updating the portfolio as well as the users table, which contains the cash. But first, you need to get the actual stock and amount of shares that the user wants. For that, you’ll need an HTML form that will ask for the symbol of the stock that you want to buy as well as the number of shares. Then you’ll want to add. You’ll want to select certain values. We’ve gone through this a little bit already, but when you’re trying to obtain certain rows– retrieve certain rows from the SQL table, this is the following syntax. You have select, and then if you specify a star, that’ll basically return the whole, entire row for you. Then again, you have the condition where, and then you specify– I only want the username to be equal to mail-in, so it will only retrieve the row in users that corresponds to mail-in. When a user wants to add a share to a portfolio, you need to check for a few errors. You want to make sure that the user can actually afford the stock, so you’ll want to check their cash. Before, we used star to retrieve a whole row from a SQL table. But here, we can actually just specify that I only want 1 value– I only want cash. So here, it would return the cash for the user with id number 1. If a user has already bought a certain stock but then buys more of that stock, then in your portfolio–you don’t want a separate line, another row that contains that new transaction. You actually want to update the amount. All that’s changing really is the amount of shares that that user owns. If you use the insert into query–so it’s just insert into your portfolio all of these values– the user’s id number as well as the symbol of the stock that they’re buying and the shares, then you’ll also want to specify, well, if I run into a duplicate key– in this case, the duplicate key is not only the user’s id but also the stock symbol– because you can only have–our premise is that you can only have 1 row that corresponds to 1 specific symbol. So, on the duplicate key–if you run into a collision there– you’re just going to update shares to its new value. Shares equals whatever we had before plus the number of shares that the user is buying. Now that we’ve updated the portfolio table, we’ll want to update the user’s cash. That’s in the users table, so we’re going to be subtracting a certain amount from cash. Presumably, it’s going to be cash equals cash minus–and then a certain amount. To update the cash, you would– if I wanted to take away money from mail-in, then I would run this query– ‘update users’ and then set the cash column to cash– I would remove 9,999 dollars only if the username is equal to mail-in. But, in this case, we don’t want to subtract 9,999 specifically. We want to specify, well, we want to subtract the current price of the stock multiplied by the number of shares that they’re buying. Now we’ve allowed them to see all of the stocks that they have, as well as buy more stocks. We have also previously allowed them to look up the current price of a stock. Here we want to allow them to sell them. First we want to display basically– we want to allow them to see all of the stocks that they have, so here we want to display all of the rows from the portfolio. If they choose to sell a certain stock, then we’re going to assume that they want to sell all of it. They aren’t just going to sell 50% of their shares, they’re going to sell 100% of it. We can just delete the entire row from portfolio. We can delete the given user’s shares of the certain symbol. There’s the syntax for that. Then we want to update the cash. We’re going to be adding in the cash equal to the amount of shares they are selling multiplied by the current price of the stock– not the price at which they bought it, but rather the price at which they are– the current price when they are selling it. To reference the current price of a stock, you will want to use lookup, which will give you the price of a stock at the current time. Now we are left with history, which you want to allow a user to keep track of all of their transactions– wants to see whenever they sold something, whenever they bought a stock. We want to specify the time at which they did that as well as how many they bought and what stock it was. Do we have any current, existing structure that specifies that? Well, we have portfolio which displays the number stocks that a user has for a given share. But we’re structuring portfolio in the way that it updates when we buy multiple, whereas history should–if you buy Apple, 10 shares of it, and then later on sell 5, then you would want to see those separately as separate actions, separate rows. Whereas that action to visualize that in our portfolio table would just be an update to that particular row, so we’re probably going to want another table. In our database, we have our users table, we have our portfolio table, and now we’ll probably want a history table. That history table can keep track of the current date, as well as the particular stock symbol, as well as how many shares, and then what action it is– whether you were buying those shares or whether you were selling them. To deal with date, there are a couple of ways that you can do this. PHP has a way of keeping track of date, which you can look up yourself. In SQL you can also use either now or current timestamp. That’s up to you. Just make sure that every time a user buys or sells, you’ll be updating their cash in the users table, you’ll be updating the rows in the portfolios table, then you’ll also be updating the history, so there are going to be 3 separate SQL queries that you’ll be calling there. We have a bunch of functionality now. Just a couple of reminders that in your index file, you’ll want to link to at least your– but you’ll want to allow a user to link to the buy.php page. That’s going to allow a user–buy.php is the controller, so that’s going to either send you to–that’s going to send you to the form that allows you to look things up. We have history. We have logging out, getting a quote and then selling. Those are at minimum what you want to show. In terms of the portfolio, the portfolio is actually shown in the index page. If we go to index, here we see that it renders portfolio.php and passes in the associative array–basically the title equals portfolio. So, this is the controller. If we go to the template of portfolio.php, then all it has is–displays basically a picture that says, oh, this site is under construction. Later on, once you pass in–you’ll be passing in basically more specific information. Instead of just the title, you’ll probably be passing in more things. Once you have those values, then portfolio.php can deal with those values and printing them out in any sort of order. Once you’ve implemented all of those, you also need to implement 1 more feature. This can either be allowing a user to change their password, to reset their password if they’ve forgotten it–so for the password reset, then you’ll probably also want to edit register so that it allows them to specify an email, so if they forget their password, then they can get that. They can probably enter in their username, and then an email will be sent to them with a link to be able to reset their password. You can have something that allows users to get receipts every time they buy or sell something, and then finally, allow them to add cash to their website. Just to go back into the concept of controllers and templates a little bit. You’ll have something like a–so you’ll have a controller here. Right now, we’re looking at the login.php example. When we have a controller, basically it’s going to take 2 cases. When we have controllers, we’re in this piece that we’re also kind of dealing with when we have forms as well. The controller will basically have separate actions– one if a form has already been submitted, and then two if the user is coming to that page for the first time and still needs to input that form. I’m going to jump to that case first before going up to the first case of having the form in. Here we say, if the form has been submitted with the method post– don’t worry about that a bit. Don’t worry about that too much but understand that basically this function deals with whether a form has been submitted or not. This condition is true if a user has submitted the form. If not, then we’re going to want to call render login_form.php, and then pass in the title. This title is just basically going to appear in the header. What this does is basically says, okay–well, if a user goes to login.php and hasn’t actually logged in, then I want to send them to the page that has that form which allows them to input the username and the password. Then I go to login_form, and then that has the actual form. Then, once the user submits that form, they’re going to submit it to login.php with the method post. Then I’m actually going to enter this section of my if-else loop. Then it’s in here that we deal with the values entered into the form. It’s here that we deal with those. Then once you deal with those values–if you’re dealing with– say we’re dealing with the quote.php page where someone can input a stock that they want to look up, and then see that display– that’s kind of similar here. Here we have a login form–you’d probably have a quote form– but then once the user has actually submitted that information, then you’ll want the controller to pass into another template that will show them that actual information. So then right around here, then you’ll probably– around the end of your condition here–the if the method equals post– then you’ll probably want to render another page–the show quote– which sends you to that page–show_quote.php– and then in that file will reference those values. Does that make sense? We have a controller that basically deals with the 2 cases– whether you’ve entered a form in or not. If you haven’t entered a form, then it will redirect you to that form, which will then put you back to that page. Then, once you have information in the controller, that body will deal with that information as necessary–either looking up values for the stock, and then once it’s looked up those values and has them in a nicely formatted array, then can pass that array into the template page that deals with outputting that information. Again, since it’s web, it’s going to be fun. We’re outside of C so we’re not limited to the ASCII and that terminal output, so have fun with this. You can make it as visual as you want. You can allow users to input millions of dollars at a time, or limit them and be really mean and allow them only to enter 1 penny at a time or something like that. Definitely be sure to have fun with this. PHP code is a bit simpler in that it’s a bit easier to map out your pseudocode into the actual implementation. So, definitely have fun with this because it is actually our last piece in CS50. With that, this was Walkthrough 7. Once you’re finished watching the walkthrough and finished your pset, then these were also psets, and now we are on to the final product– after we get through quiz 1. Then hopefully you can use the tools that you’ve learned from the psets– not only the syntax, but more the abstract notion of how to take a certain– like, I want to do this and then actually implementing that. Learning how to struggle through syntax and distribution code. Reading other people’s code, and then interpreting that using pre-existing functions. So, good luck with the last pset. It’s been a pleasure to lead the walkthroughs. I hope they’ve been helpful for you. These were Walkthroughs, and thanks very much. [CS50.TV]

Add a Comment

Your email address will not be published. Required fields are marked *