Getting started with TDD and writing your own tests

Unit testing is an integral part of Test-Driven Development (TDD) which is the process of defining the desired actions of a function and what we expect it to do (or not do) before we begin work on the actual function. Approaching software development in this fashion serves a number of purposes:

  • this process can help define a path to success by outlining the tasks that must be done over the course of the function.
  • this process can help identify edge-case scenarios and ensure that your code continues to function as expected in these situations.
  • As the codebase continues to grow…


Recovering from the loss of Ruby’s .send

Too many choices
Too many choices

Reminiscing of Ruby’s .send

Since I have begun exploring the world of Javascript and React in recent weeks, one of the things I have missed from the world of Ruby has been the `.send` method. Being able to call a method by way of a string or symbol argument (that could be stored in a variable) opens many doors for abstraction.

For those who are unfamiliar with Ruby’s `send` method, I discuss it more in this blog post, but the gist of it can be seen below…(get it?)

While the amazingness of this may not be immediately apparent, I’ll quickly reuse one of…


Implementing a Backtracking Algorithm in Javascript & Ruby

Update:

Thank you to edh_developer from the Dev Community for helping me to identify an issue with multiple possible boards being generated. The gist code has been updated.

Sudoku

Puzzle games like Sudoku have always fascinated me, and Sudoku in particular has helped me get through many long waits. It is a quite popular game, but for those unfamiliar with the rules here is a quick synopsis, or you can see the Wikipedia entry here.

Example Sudoku Game Board
Example Sudoku Game Board

A Sudoku game begins with a 9x9 grid partially filled with values from 1 to 9. The goal for the player, is to fill all of the…


Refactoring App features into Modules can make debugging, managing, and extending the code base easier — if done right

Recently I was pair-programming on a Ruby CLI app to help manage subscription services for my phase 1 project at Flatiron School. After building out the models and schema utilizing ActiveRecord my partner and I began writing out the primary app file that would run and manage the app interface. After getting through just the user login control, we quickly realized that this file was about to become incredibly large, and search through hundreds of lines of code to find specific methods or for debugging was going to be a pain.

From our previous experience with incorporating modules (described in…


Beginner’s guide to Setting up the Twilio API in Ruby and using ENV files to secure your credentials. Time to actually say Hello World to the world!

As a beginner in Ruby working primarily in a text editor, Terminal, and interacting with an app through CLI, it’s natural to itch for something “bigger” and to want to give your basic app a greater reach. It’s exciting to see “Hello World” pop up on your screen for the first time, but after the 100th (or even 3rd) time it loses a little magic. What if we could instead send that message out to the users in the world via a text message? Or, in more advanced cases, what if you wanted to incorporate Two-factor Authorization for user logins…


A beginner’s journey to writing DRY, modular, and extensible code in Ruby with ActiveRecord

Imagine we are building an app that represents an old-school VHS store. This was a task I paired on recently and we challenged ourselves to keep our code DRY.

Daniel Sasse

Fullstack Dev w/ experience in JS/React and Rails

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