CRUD! A Visual

Jillian Short
4 min readMay 14, 2021

OCTOBER 23, 2020

Fair warning that this is another blog that revolves around more coding adventures! Boldly going down the path of Software Engineering at Flatiron School.

So I’m a little over three months into the part-time software engineering program at Flatiron School, and we’re just about to turn in our second project. It’s literally due tomorrow, and I’m usually not so last minute about things. But that’s another blog post for another time which I’m sure will be called something like, 2020 — I Want Off This Ride.

On the bright side, I’m finished with the minimum requirements which will just have to be enough for now! I’m still proud of what I created, it works, and I can turn it in on time. So what was project #2 all about? Sinatra! Not the singer, I’m sorry. Remember, this is about coding.

Sinatra, very basically put, is a framework written in Ruby for building simple web applications. So that’s exactly what the second project was all about, creating a simple web application. The requirements were fairly simple, and included lots of fun acronyms, as is usually the case. Everything we’ve learned so far always includes a fair share of acronyms. My favorite is CRUD. How can you forget that?! (fun fact, you can’t) CRUD stands for create, read, update, and delete. Pretty straightforward. Those are the four basic things you need a web app to be able to do, and four things our users needed to be able to do.

To execute CRUD, I decided to create a web app called Vinyl Records. It’s a basic place for vinyl collectors to log in and add their records and the condition of them into their collection so they know what they have.

So, how does Vinyl Records execute CRUD? Well, after building the web app and saying crud to myself many times while I fixed bugs and figured out how to make it work I’d say it does a good job of executing the basics of CRUD.

C

Create. It’s actually pretty simple to hit this one. You can’t have Vinyl Records without having the ability to add some vinyl to your collection. So a user can create vinyl objects. Once they create vinyl, it gets saved to their database via an HTTP post request, so when they log in it’s always there.

R

Read. Also known as retrieve. A user can see their collection as a list of all their Vinyl, or click on one and see the specs of just that record. On the coding side of things, as users click around through their vinyl they’re sending HTTP get requests. Makes sense, they’re clicking a thing and saying, hey computer, get this thing for me and show it to me. That’s what read is doing behind the scenes. And so long as I tell it to route to the correct place, you’ll get what you ask for.

U

Update. Or edit. A user can edit their vinyl. In the web app, there’s an option to add the condition of your vinyl on a scale of 1–5. So if you need to change that number, or if you made a typo, you can go in and fix those things. Behind the scenes, update is very similar to get, except this time we’re doing what’s called a patch request. Patch requests simply make small changes to things that already exist. You could even say it puts a patch over a small piece of your object that needs to look a bit different. That’s all. Think, denim jacket, and patches.

D

Delete. Sometimes, you lose a record, or it breaks, or your drummer’s new girlfriend liked your David Bowie album so she took it, and then they broke up so that’s gone now. Delete. It’s simple on the back end as well. Delete is as simple as adding a form disguised as a button that just says delete. And then you tell that button to destroy that object. Careful though, once it’s gone it’s gone. Just like that David Bowie album.

So that’s CRUD in a nutshell. It works on so many levels. It works on the back end, it works from the user’s perspective and it works when you’re just trying to get the albums to alphabetize, but you just keep getting errors so you keep saying awww crud.

This was a fun project and I’m happy to be moving into the front end of development. It’s been great (and honestly super rewarding) getting to actually see how things are working. It’s a very exciting step and really helped me a lot with making sure everything worked the way a user would want things to work. It all seems very small for now, but baby steps!

Onto Rails.

--

--