Photo by Samuel Sianipar on Unsplash

Even after working with git for a few years I am still left in awe sometimes at its capabilities. The ability for developers to work on different parts of the same project at the same time through the use of branches is amazing. While these branches can help boost productivity by allowing simultaneous progress, they can also lead to wasted time and thought if used without proper naming conventions.

If you thought variables were the only items that caused issues when named improperly, just try to work with a 10 dev team who all use different naming conventions to create…

Photo by Science in HD on Unsplash

Good tests revolve around great data. How you get or generate this data can occur in many different ways. For Ruby on Rails, two of the most common ways to get data for testing are factories and fixtures. Though both of these strategies create data that can be used across tests, they do it in different ways.

Before we dive into the benefits and drawbacks of features and fixtures let’s first look at what they are. A fixture is “the fixed state used as a baseline for running tests in software testing.” …

Photo by Veron Wessels on Unsplash

TLDR: Enums are a great user-defined model level validation for stored values. There are many ways to implement enums in Ruby on Rails, but the best way uses hashes with strings for the keys and values.

Ruby on Rails is great for newer developers as it preaches convention over configuration. What this means is that there is a community agreed upon “correct” way to setup models and controllers. This convention includes scaffolding scripts which makes setup quicker, allowing for more time implementing solutions rather than writing boilerplate code.

When creating database migrations there are a number of different types for…

Photo by Ryan Quintal on Unsplash

TLDR: You can create a reusable Layout component in React without knowing its nested components by making use of React’s “children” prop. By passing in the children prop to your Layout component, you can add JSX of { children } to your component which will inject any nested components into Layout when you call it.

What is the children prop?

React is great as it allows developers to create sets of reusable UI components. Because of this, developers are able to quickly create a beautiful, interactive webpage from a set of common building blocks. …

Photo by Patrick Tomasso on Unsplash

TLDR: You can use commits to move around in your project’s history, and moving to a specific commit will place you in a detached HEAD state. A detached HEAD state means that git’s pointer points towards a specific commit instead of a branch and requires a new branch to save any work done from the detached HEAD state.

A few weeks ago I was putting the finishing touches on some changes I had made for a ticket, and was getting ready to push the changes up to GitHub. I had been working on this issue for a while and had…

Photo by Shane Aldendorff on Unsplash

TLDR: RSpec offers a powerful match matcher that will allow you to leverage regular expressions to make non-brittle tests. Coding non-brittle tests that are robust and test behavior instead of implementation will save you maintenance time and lead to overall better quality code.

A common set of tests cases for any web app is checking that the correct message is returned upon user request. This can be anything from checking for “insufficient account funds” to “shoe size X not available.”

While software engineers like to think that the first message they code will be the last, these messages are often subject to change by the business group or users. The message might be too short, or too long or not clear in what it conveys. Because of this, a software engineer could end up changing this message many many times.

If these changes…

Photo by Fleur on Unsplash

While working on a recent project, I came upon a guard clause acting on an API response. My app returned a specific message to the user based on whether or not the API gave back a value of true or false. Whether this API was unstable or the previous developer was just cautious, I found a “to_b” appended to the end of the attribute we were checking. While I had worked with “to_b” before, I had never dove into it’s inner workings, and was curious to learn more.

One of the great challenges of interacting with 3rd party APIs is…

Photo by Caleb Jones on Unsplash

Programming is built around the concept of conditional logic. A user sees their profile or a login screen depending on whether their login_status is true or false. While a setting like normal or dark mode is binary and straightforward, logic for different user permissions can become quite complicated as you check for many different factors. Because of this, conditional logic can grow from binary logic to ternary on up.

When you first start out programming, you are introduced to if-else blocks. While these work great for certain applications, as you develop your skills, you’ll start to see instances where a…

Photo by on Unsplash

Intro to E-commerce

If you work with e-commerce for long enough, you will likely run into the issue of conditional money transaction records. While services like Stripe make it very easy to handle credit card transactions, these don’t account for all internally managed payments such as company gift cards and promotional funds. Customers love these different payment options, but as a developer these can add migraine inducing complexity to your project.

With new forms of payment, your linear checkout process will soon branch into a complex decision chart with credit card transactions, promotional fund transactions, gift card balances and every…

Photo by Benjamin Dada on Unsplash

In Ruby, both the Array and Hash classes gain similar methods from the Enumerable module. Enumeration is the act of traversing an object and the Enumerable module extends the methods most common with dealing with arrays and hashes.

Both the map method, which traverses an array or hash and performs an operation on each item before returning a new array, and select method, which returns an array of values that evaluate to true if a given condition is met, are part of the extended functionality of the Enumerable module. …

Daniel Pericich

Former Big Beer Engineer turned Full Stack Software Engineer

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