Wednesday, April 9, 2014

CRUD, AJAX!

This week at Coder Camps we've been working with AJAX to communicate with a NoSQL database. We're doing "Coder pushups" - creating a series of similar apps, adding functionality each time in order to practice the process and master the concepts. The screenshot above is of the app I made last night.

It's a simple list of monsters. You can add a new one, edit or delete an existing one, and sort the list. The list is stored on a Firebase database and uses a RESTful AJAX method to GET, POST, PUT, and DELETE from the database; the code then rewrites the table without refreshing the browser. I used Bootstrap for the (minimal) CSS styling. There's one line of JQuery that makes a Bootstrap modal function, otherwise this was done in straight Javascript, including the AJAX - we are learning the hard way first so we actually understand what's happening - no use of firebase.js either. We will be learning the faster ways to code this functionality in the near future.

Have to say I'm a little proud of myself, in class we saw examples of a GET and POST method, and at home I was able to figure out DELETE (and yes, I did delete the entire database on my first several attempts to get it working) and PUT based off that; then merged the four options into one function. Full CRUD achieved 2 days after my introduction to databases.

Tonight I do it all again, adding another couple interesting pieces to the mix.

Today in class we also got better at laying out a project ahead of time, separating out and documenting View and Model before touching Visual Studios, talked about abstracting functions, and learned how to GET just what we actually need from a database rather than retrieving the entire thing.

If all this sounds like a lot of work, it is, the last two days I spent 4 to 5 hours each day on homework, after a full 9-to-5 days in class. But if you put the work in, it pays off.



No comments:

Post a Comment