Monday, April 14, 2014

Angular, MVC, and Game of Thrones

In the app - add a character and they are automatically added the to proper House, hovering over a character's name reveals their portrait.
Time for another update from Coder Camps! Last week we learned about communicating with a database and updating a web page without having to refresh the browser window using AJAX. Friday we learned how to using polling (and touched on websockets) so that a web app can check for database updates automatically without the user having to do anything.

To practice we made an instant messenger app that connects to any number of friends and checks for new messages every second. I sorted the messages by date, including my own, to form a message feed.

The homework over the weekend was to build out a Twitter clone with the following functionality:
Post tweets, maintain a profile, maintain a friends list, display a feed of friend's tweets that updates automatically, and display a list of your friend's friends that you can click to make them your friends as well.

I got all the major features up and running but late Sunday night I bogged down trying to get my app to upload a user's picture file (.jpg/.png/etc) to Firebase - the NoSQL database we were using. It was a good reminder that, whenever I'm spending a long time on a problem without making progress, I'm probably going about it the wrong way.  This morning I mentioned it to my housemates who then suggested the (in hindsight) very obvious 5-minute solution. And yes, storing your images in your database is usually the wrong way.

Today we got introduced to Angularjs and the MVC framework (although Angular is technically MV*). We built out a Game of Thrones page that lists characters by House - very similar to projects we did last week but with Angular the app was written in a fraction of the time and with a fraction of the lines of code.

Also for the first time we used AJAX calls from a library (Angular, of course) rather than using vanilla Javascript. Tonight for homework I'll be writing another similar app, including edit, delete, and search capability, using Angular.

Time is really playing tricks on me right now; because we've covered so much ground it feels in one sense like I've been here much longer than two weeks; simultaneously, because everything is constantly new and interesting, the time seems to fly right by.

That's all for today from Houston, talk to tomorrow!

No comments:

Post a Comment