The Chronicles: Learning Web Development at Bitmaker Labs (Week 5)

Thoughts on software testing and diving into JavaScript & jQuery

Tara Mahoney
May 6, 2015 · 5 min read

Need some context? Check out last week’s post here, or start at week one here.

Monday

We covered a few more Rails testing essentials on Monday morning before spending the rest of the day working on our SeatYourself (clone of OpenTable) app.

Unit tests, functional tests, feature tests

There are three different types of testing in Rails:

Why testing is important

Writing software tests saves developers time in the development process — this seems like the most obvious reason to me why we would spend a bunch of time writing out tests to do check that models, controllers, and features are working correctly. It is tiresome and time-consuming to fill out every form on your site every time you change a bit of code, and tests can automate this. Testing is also important for checking functionality that is not visible to the user but could prevent a program (or the entire app from working). Finally, Rails has a built-in testing directory (ActiveSupport::Test Case which inherits from MiniTest, the Ruby testing language) to help us write tests, and we should do what Rails suggests because it is almost always right.

So, as tiresome as it might seem to some at first, testing is a pretty vital part of development and you should learn it early and practice it often.

Test-driven development

This is a fun concept whose name pretty much describes what it is. Test-driven development basically means writing a small test for each functionality and feature in your app, running that test (which will fail), building that functionality or feature, and running the test again (which will pass this time). I watched one of our instructors build out part of the SeatYourself app this way and it seems really tiresome and difficult… but I can understand why someone would build something this way. I just won’t be for a while.

Tuesday

We started learning about JavaScript on Tuesday, and covered a few basics before breaking out for the afternoon and practicing the fundamentals on our own. Our afternoon assignment was completing small exercises to get ourselves comfortable with some key concepts like variable assignment, arrays, if/else statements, for loops, functions, and objects.

Why use JavaScript?

Javascript is a lightweight interpreted programming language and is pretty much inescapable if you want to be a web developer. It’s also the main language that runs in your browser, so get to know it. Become its friend. It won’t bite… much.

A few things to remember

The purpose of today’s exercises were to get ourselves comfortable with JavaScript syntax, so here’s a few things to remember when writing JS:

Wednesday

On Wednesday, we continued with Javascript fundamentals and familiarized ourselves with functions, variable scope, objects, “this” keyword selector, and worked on some exercises to practice these concepts. One of these exercises had us build a tiny program to print out the numbers 0–20 and add “is odd” or “is even” depending on whether a number could be evenly divided by two:

Image for post
Image for post

Thursday

We dove into the wonderful world of jQuery on Thursday, but not before getting to know the Document Object Model and manipulating it with ‘vanilla’ JavaScript — which is, as far as I understand it, the reason jQuery exists.

JQuery is a lightweight JavaScript library that basically makes developers’ lives easier by reducing the amount of steps and typing they have to do. For example, what we would write in vanilla JavaScript like this:

Image for post
Image for post

… could be written with jQuery like this:

Image for post
Image for post

Much better.

Our afternoon assignment had us running through short exercises to familiarize ourselves with the Document Object Model and jQuery with exercises like this, which had us use JavaScript to change the colour of the second rectangle:

Image for post
Image for post

Friday

We continued with jQuery on Friday and learned about closures and animations. Did you know that you can tell your computer to do this:

Image for post
Image for post

… and it does this?

Image for post
Image for post

I didn’t! But I’m so excited to put some of this to work next week. There is a lot to internalize this weekend.

Until week 6.


Image for post
Image for post

Tara Mahoney is a freelance web designer & developer in Toronto, Ontario.

Give her a shout if you wanna chat, or check out some of her work here.

The Chronicles: Learning Web Development at Bitmaker Labs

What I learned from a 9 week programming bootcamp

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store