If anyone knows about the circle…er…cycle of life, it’s Simba…

One of the key aspects regarding how React works to alter the DOM is the component lifecycle. This process ensures that the DOM is being transformed only when and where necessary, increasing the overall efficiency of React as a framework.

Let’s take a look at the three major parts of the life cycle of any component in React and discuss some of the functions associated with each that can be called as needed:

1. Initialization

This is the process by which a component is added to the DOM. In terms of class components, the life cycle begins with:

constructor() — This is…

Return of the calculator

A couple weeks ago, I took a look at the process for building a basic calculator in Ruby and testing it using RSpec. This week, we’ll take our calculator and move it to JavaScript, testing it with one of the most popular JavaScript testing libraries: Jest.

In this instance, rather than building a class, we’ll simply keep our functions in the same file, called calculator.js.

If you want to follow along, set up your directory using the following steps:

  1. Create the directory. Name it whatever you’d like. (Mine is named CalculatorTestJest.) Enter the directory in your terminal.
  2. Run npm init

Source: Pixabay

Three months ago, I completed Flatiron School’s Software Engineering bootcamp program. I learned much from the experience, and I’m excited about the opportunity to continue exploring the world of technology.

With tomorrow being Thanksgiving, I’ve decided to take a break from the technical blogs to reflect a bit on what I’m thankful for in this journey I’ve taken so far into code. Thanksgiving is my personal favorite holiday, because it’s solely about taking stock of what we find important and worthwhile in our lives with no expectation of giving gifts of any kind.

That being said, here are five things…

Sweepea encapsulated in a photo. — source: Klipartz

Encapsulation is a concept utilized frequently in Object Oriented Programming. Encapsulation allows us to keep variables and methods of one class restricted to direct use and access within that class.

Encapsulation is accomplished in Java using access modifiers, specifically the private access modifier. If we have a Baby class:

public class Baby {
private String name;
private integer age;
private boolean needsDiaperChange;

We can see that while the class is public, the three variables declared above are not, meaning that the only class that has direct access to them is the Baby class.

Other classes can obtain access to…

Testing Our Calculator

Test Driven Development is an essential component of the Software Development Life Cycle. As such, it’s helpful to know some basics regarding automated testing options for your programming language of choice. Automated testing is extremely efficient, saving both time and money in the process.

In Ruby, one of the most commonly used testing libraries is RSpec, which will be the focus of this blog. We’re going to build a basic Calculator class and test various functions of it using RSpec.

To begin, be sure that you have the rspec gem installed. …

Source: pixabay

Abstraction is a concept that appears in several programming languages. It affords the ability to prevent users from seeing certain information regarding the names of methods or classes.

In Java, the keyword abstract can be utilized as a label for both classes and methods. Let’s look at abstraction in relation to a parent class HungryBear.

abstract class HungryBear {
public void tummyGrumble() {
System.out.println(“*rumble rumble*”);

Abstract classes cannot create new objects. In order to access components of an abstract class, the class must be inherited by another.

class BabyBear extends HungryBear {
BabyBear thisBear = new BabyBear()…

Source: Wikimedia Commons

Polymorphism is a concept that appears in object-oriented programming languages. It allows for methods to take on multiple levels of functionality depending on how they are utilized.

Polymorphism in Java is most often exemplified when one class inherits a method from a superclass or parent class.

Let’s take a look at how this operates using a parent class Dog and three classes of dog breeds that will inherit from Dog.

class Dog {
public void bark() {
System.out.println(“Doggie says bark!”)

We can utilize the keyword extends to allow for one class to inherit the methods of another.


Image taken from design by Camilo Garcia — Pixabay

In the first entry of this series, we began by taking a look at the structure of a basic output task, declaration and assignment of variables, and mathematic operations. In the second entry, we discussed value comparison and conditionals. In this entry, we’ll take a look at how arrays are created and modified in Java and JavaScript.

Array Creation and Terminology

Let’s begin with the various options for creating a new array in both languages:

In JavaScript:

// Method 1 of Array Declaration
let emptyArrayOne = [];
let filledArrayOne = [1, 2, 3, 4, 5];
let mixedArrayOne = [1, “two”, 3.0, …

Image taken from design by Camilo Garcia — Pixabay

Last week, we began our basic comparison between Java and JavaScript, taking a look at the basic structure of completing a simple printing task, how to declare and assign a variable, and how to manipulate a variable via basic mathematic operations.

In this entry, we’ll take a look at how the two languages compare values and utilize conditional values.

Value Comparisons

For the following operations, let’s define a few variables:

In JavaScript:

const valueOne = 12;
const valueTwo = 7.5;
const valueThree = 3;
const valueFour = 12;
const valueFive = “I’m a string”;
const valueSix = “I”;

And Java:

Image taken from design by Camilo Garcia — Pixabay

As a novice programmer, one of the first big mistakes in nomenclature that I made when starting to learn JavaScript was to tell a friend, “I started learning Java last week.” He raised an eyebrow in disbelief, asking to clarify if I meant JavaScript instead. When I mentioned that I thought they were the same thing, he gave me some harsh lessons regarding the differences between the two.

Both Java and JavaScript are extremely common languages in the coding world. Many companies will appreciate an understanding of one if not both languages, yet the way they are structured is quite…

Steven Kandow

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