Week 4, Databases….

In our first week someone asked our coaches “which week is the hardest”, Sam’s response (with a smirk on his face) “week four”. I am writing this at the end of five, and I can safely say that Sam wasn’t wrong….

Everyone knew on monday morning we were going to jump head first into a subject that was pretty much a first for everyone: how to create a database and store and retrieve information from it. Sounds relatively straightforward on paper, but I was under no illusions that the coming week was probably going to be my most challenging yet.

As with every week so far, our learning is centred around a core project that is broken down into smaller ‘sprints’. Our challenge this week was to build and create a bookmark manager for saving weblinks. Features we needed to implement were: create a new user account, sign in and out of said account, store the url of web pages, view the links in chronological order, and tags to the links and then be able to filter the links by their tags.

The previous week had introduced to us how the web works by building a pokemon style battle game, but it was lacking a means of being able to store anything more than tiny snippets of data. Databases are how information that is inputted into a website is stored, for example this blog post is stored on a database and every time someone visits this page the data (the post) is retrieved and displayed on the page. Another example is when we sign up to something (say facebook), and our signup details (email, password, name etc) are written and stored on a database.

You have a few options when it comes to creating databases, but we used PostgreSQL, rather than taking up a whole blog post explaining what this is, here is what wikipedia has to say.

The initial setup and creation of database was fairly straight forward, and getting to grips with how postgres works was really interesting. It wasn’t long before the “brain melting” side of things started, and for me this point was when we were introduced to Data Mapper. Data Mapper allows you to manipulate a database and interact with it by using Ruby, which is super cool, but super hard for me to get my head around!

Another really interesting topic that came up this week was how sensitive information is stored on a database (such as passwords), and what measures have to be taken to ensure such information is handled correctly. Cyber security is a massive topic, but we touched on the bare bones on how to encrypt a password using Bcrypt.

Another interesting technology we were introduced to was Datamapper. Using Datamapper allowed us to communicate with our databases using Ruby, which is a very neat but also quite confusing to set up and get to grips with.

By the end of the week my brain was frazzled by the amount of new material we had covered, and although it was really tough being constantly out of my depth, I felt fairly positive going forward into week 5.