Sunday, June 30, 2013

Week Three

Welcome back! I have been gone for a while; sorry! I wrote Week Two's blog towards the end of Week Three, and then that weekend plus all of Week Four was devoted to our first projects, and then Week Five was mostly recovering from that, so I haven't had much free time lately! So, this post might be really long! Let's see how much I remember...

Monday

As I mentioned in the previous post (I was going to say last week, but it was actually ages and ages ago), we covered a lot of stuff this week. I think there were some more abstract concepts covered, and there was less homework than the previous two weeks, which I think combined to make it a bit harder to comprehend everything that was going on. I also had a pretty rough Monday night (I didn't realize until I was going to shower around 1AM that I had run out of clothes, and had to do laundry...) and the tiredness from staying up until 4AM or whatever carried through the whole week. But anyway! On Monday we covered how the different "parts" of a Rails app work together. Previously, we'd kept most of our code to one or two individual files, but as our programs get more complicated, we want to start compartmentalizing code - basically we can group similarly-functioning pieces of code together for easier readability. It also makes it easier to spot problems, and helps to isolate bugs.

Our assignment for the day was to write a blogging program, as some additional database practice. Basically we needed to make separate tables that would store blog articles, comments, and authors/users. So if I can make my own blog, why am I still using blogger? Well, I wouldn't want to go and change the address on you guys in the middle of my class!

Tuesday

As I already mentioned, I ended up having a rough Monday night thanks to stupidly not noticing that I'd run out of clothing, so I was super tired during class today. We reviewed the blog program, and then learned how Rails can magically make all of those pages that we had spent so many hours creating. This is a slight exaggeration, but we can basically write "rails create blog" and poof, done. I actually nodded off for a few minutes during this part of class, so I missed everyone ELSE flipping out, and then had my *own* "WHAT IS THIS WITCHCRAFT" moment when I woke up. We also discussed routes, which really shouldn't be that complicated (I think) but my head was so foggy that I didn't really have a solid grasp on them until pretty recently. Routes are basically how URLs are made, which is fairly simple, but we learned a few ways to rename them inside of the program, and that confused me. Why are we suddenly writing new_blog_path instead of article/new? And why is it sometimes /articles/new? And what is going on with articles#new?? Who knows! So basically, kids, don't sleep in class...

Wednesday

We covered a bunch of different topics today - more on routing, partials (basically a way to further compartmentalize your code), assets (an area created by Rails where you should store images and things), CoffeeScript, which is another way of writing JavaScript (we briefly touched on it; I'm not sure if we'll go back to it in the future, or just stick to JS though), and how to create sessions, which basically give us the ability to create login verifications. Whew! That was a lot of stuff! And I actually forgot something! Flash notices! They are sort of like little alerts that will pop up and tell you things like "Your password is incorrect." (in the context of the day's lesson). Anyway, there was a ton of stuff covered today, and I honestly have no idea how to write a login, so that is something I really need to get around to learning/relearning, although Rails is magic and I can find some login code that someone else wrote and just it install it into my program and boom done. BUT, I would like to know how to write a basic login, just for personal study reasons. So I will have to get on that at some point.

Thursday

So this past Thursday (real time) we had a homework assignment that required us to write a search function, and I was sure we had never written one before. As it turns out, we learned one today (blogtime)! So yeah, when I say that 1) I was really out of it this week, and 2) we cover a lot of stuff really quickly, I am not lying...

We also covered JSON, which is a commonly used way of displaying lots of information, since computers can read it easily, and it isn't *horrible* to read as a human. We used a "scraping" gem called Nokogiri that let us pull all of the information from a website and store it as a JSON file, and then we were able to open that and parse it for the specific information we wanted. As a concrete example, we had created a recipe website earlier in the week that would let people post recipes they liked. We used Nokogiri to scrape a recipe from a recipe website, then wrote a program that would post the ingredients and steps to our recipe website (and leave off the useless extra stuff). We also did a bit of work with Twilio, and set up a simple bit of code that would send us a text message to alert us that a recipe had been posted on our website. All in all some pretty neat stuff. The final thing of the day was covering seeding, which will automatically put information into our database (rather than having to go into our website and manually add it). I more or less forgot about seeding, but it ended up being super vital to my first project, which I'll get to in a bit (hopefully!).

Friday

Today we were given partners for our first assignment. We were given pretty free rein - basically make whatever we wanted. We then spent most of the day covering things that would help us in working with partners - making "branches" on github, for example. Github is basically an online code repository - I can post my code there, and someone else can download it and work on the same program, and then upload their changes to the repository. By making "branches" they can make changes to the code and upload it for me to look at, but it will be in a branch file rather than in the original file. That way, if I don't like the changes, I don't have to add them. We also covered environment variables, which are basically a way to store information on your computer rather than on the internet - it prevents people from just looking at our website's code and getting information we don't want them to have (phone numbers, for example). Our only assignment for the weekend was to come up with a project idea, and neither I nor my partner, Isaac, really had anything in mind at this point.

Well! That about wraps up Week Three! I will be back in a bit (hopefully) with Week Four! I felt a bit lost this week, and was stressed out about some random stuff as I'd mentioned in the Week Two post, but once Week Four rolled around, I was so busy with my project that I didn't really have much time to feel stressed about anything else! Our project was pretty neat though, so I'll see you back here soon with the summary of how that went!

No comments:

Post a Comment