Code Clan Week 7
Well i'm running a bit behind on sending this out this week... I've had such a busy week and been chasing my tail a bit. Unfortunate timing of some major dental surgery has flung me a bit out of sorts so this entry may be a bit short , sweet and I may copy some things from the class notes to remind myself of what is actually happening!
If you see me and I don't talk to you, its because I cant talk at all :)
Day 1 - intro to Pub Sub
Dynamic JavaScript applications often only have one route that the browser uses to make an initial request. This request loads the HTML and other resources including the JavaScript files into the browser. The JavaScript is then used to handle the user interaction, dynamically updating what is rendered to the page in real-time. This replaces the traditional request-response cycle.
from class notes
Think I have totally got this pattern. It's quite simple to follow, but just need to make sure that the channel that you publish is the same name as the channel you subscribe to.
Application Architecture example. We created a word counter for the Lab on this.
I also keep forgetting the module.exports.....
Today was a gentle introduction to Pub Sub, although I do think I've managed to understand it.
Day 2 - Pub Sub (publish & subscribe
We have been using the pub/sub architectural pattern to build front-end application. We are going to look at an application that implements the pub/sub pattern and has some initial data that it uses to populates the page.
In the lab ,using the provided start code, our task was to create an app that allows a user to click on a planet name in the menu (already provided), to view the planet's details. Implement the Pub/Sub pattern to separate your presentation and business logic into views and models.
It was quite a hard Lab to be honest. Although we were in groups, it was quite tough to get through. we thought we were finished, but turns out we just kept adding to the list and not clearing... then we found out that we were just showing the 1 same planet... but we managed to get there nonetheless.
Homework was the same thing.... only using instruments.
Day 3 - making a request to API and looking into reusable nested views.
An API, or application programming interface, is a tool that allows one piece of software to interact with another. A lot of software provides an API, allowing developers to write software that interacts with it. The DOM, for example, is an API. The DOM allows us to write software that interacts with the web browser.
APIs often provide us with functionality or data that would be incredibly difficult and time consuming to create on our own.
JSON, JavaScript object notation, is a language agnostic data interchange format derived from JavaScript. It allows us to store data in a human readable format that appears familiar to programmers of C family languages.
When we say that JSON is language agnostic, we mean that it doesn't know anything about any other programming languages. We will be converting JSON to JavaScript today, but we could just as easily make a request from a .NET application, written in C#, and convert the resulting JSON data to C#. This means that we can use JSON as a common language allowing software that was written in different languages to speak to each other.
for the code along, we made a joke app that pulls a joke from an API and shows it in the browser.
Day 4 - And this is were it all went down hill ... I was off today for surgery... but we learned about Promises
We previously learned about the XMLHttpRequest web API and how we can use it to make requests without refreshing the page or loading another page. As we've seen, this can be particularly useful for requesting data from JSON APIs and using it to update the information that we're displaying in the browser in real-time.
We know that XMLHttpRequest requests are asynchronous, which means we when we make a request we don't know when we will receive the data. We have been using callbacks to handle this asynchronicity, where we pass the request a function and say, 'once the data has been received, invoke this function'.
In this lesson we're going to look at Promises, which we can use to clean up our request code. Promises are fantastic for dealing with asynchronous code, vastly reducing the need to pass callbacks around and making it feel a little bit more structured.
Day 5 - looking back... I shouldn't have came in to class ... but my little head always thinks if I can walk, I can go... turns out... i was very VERY wrong. I managed the whole day but Im not going to lie, i was spaced out. It was less than 24 hours after being under general anaesthetic I thought yeah cool I can go in. I feel fine.. I started the homework on the Friday before I left but then couldn't complete it during the weekend. I was completely out of it. Not the best timing... and even when i tried to complete the homework on the Sunday after i was feeling a bit better, a tiny error totally knocked me for stupid.
Great start to the week... ending... not so much although it wasn't the code that was the issue for once. small win. Although, you cant say I'm not dedicated... I love the course and I'm glad i managed to make it in but i really need to learn to let my body recover. I thought it would be a quick in and out kind of surgery and id be back to my normal routine the next day... yeah not so much.
Overall, the start of the week went great... I get the logic behind Promises but I just need practice...
On to week 8 ... 1/2 way mark!