logo

ZiffurComputers and stuff, made simple.

API-First: How to Write Useful Functions in JavaScript

Functions are the bread and butter of a computer program. They help encapsulate business logic, allowing you to easily reuse and build on your existing code. If done wrong, however, functions can easily become confusing, repetitive, and frustrating to use. In this article I'll lay the foundation for you to consistently create intuitive and useful functions.

Each function has a pre-determined way that it can be called. A signature, footprint, or interface, if you will. In this article, I'll be

Composing with React Hooks

Custom hooks are a wonderful tool to have when you're building interactive applications with React. Over the last few months and years, I've developed a few patterns and made a few observations I wanted to share. You see, I spend an unreasonable amount of effort trying to organize and de-clutter my code (far more than I do adding features, at least when I'm off-the-clock). If you're interested in doing the same, I have a few tricks you might find useful.

A Counter App

For the sake of demon

Code-Along: Use Basic Python to Simulate a Card Game

In this article we will write a Python script to simulate a simple card game and collect some statistics about it. By doing this, we hope to provide an overview over some basic programming concepts (variables, data types, loops, and functions) and how they come together in Python to make a useful script.

The Card Game

The game we will be simulating is very simple. In Iceland it is known as "Langavitleysa", which translates to "long nonsense" (if you recognize the rules and know the game by

Functions: How to Simplify, Reuse, and Expand your Code

This article assumes that you know some basic concepts in computer science as well as how to read code written in Python. If you've read and understood the previous article in this series, you're good to go. If you're not so confident, feel free to check out some of the previous articles to catch up. Moving on!

Writing code to accomplish simple tasks (like counting to five) is cool and all, but that's not what we call "real software", is it? That depends. Regardless of what various experts in

Control Flow Basics: How to Write Computer Programs (using Python)

If you've made it this far in the series, great! This is where the real fun begins. If you're new, no worries! In this series on computer science, we make sure not to overwhelm you with too much information at once. Instead, we take only the concepts which we deem essential and try to stack them on top of each other to quickly build up to something meaningful and practical.

So far, we've covered:

  • Binary numbers and their significance in computer science.
  • Booleans, the most basic binary da

Getting Started with Python: A Minimal Set-up Guide

Want to keep reading without running any code yourself? Feel free to skip ahead to the next article.

One of Python's strengths as a programming language is its intuitive syntax, making it easy and predictable for beginners to read and play around with. As with many other programming languages, though, getting set up to write your first line of code can be a frustrating challenge.

This guide is written with the intention of getting you started with Python code as smoothly as possible. To do

Variables and Data Types: How to Talk to Computers

If you've read the previous articles in this series, we're almost ready to start looking at some interesting code examples. Before we do, there's one more topic to cover: Data types. Since computers operate exclusively within the realm of ones and zeros, data types help distinguish between different types of data. Let's find out what this means.

In the previous article, we covered the most basic data type: Boolean. W

True or False? An Introduction to Boolean Algebra

An android walks up to a street food stand and asks: "One small fries, please". The vendor asks back: "Ketchup or mayo?", to which the android responds "yes".

This joke's a bit of a long shot so please bear with me. To get to the bottom of it, we're going to talk about Boolean algebra, a branch of mathematics first introduced by English mathematician George Boole in 1847. Although the word "Boolean" was coined as an adjective to describe this branch of mathematics, modern programmers often u

Binary Numbers: A Gentle Introduction

There are 10 types of people in this world: Those who understand binary and those who don't.

Hilarious. 10 out of 10. If you don't understand this joke, that's okay. We're not here to judge. We're here to learn. So let's learn binary.

What is Binary?

Binary is a numeral system. What's a numeral system, then? A numeral system is a method for representing numbers. The one humans use every day is called the decimal system. This system uses ten symbols, 0–9, to represent all real numbers. I

A Gentle Introduction to Computer Science

We've written this series on computer science basics for anyone to read, including beginners. Instead of going into every detail we try to maintain easy and concise reading, focused on building an intuitive grasp on basic concepts as well as an overview of how they come together in the real world.

Articles in this Series:

  1. Binary Numbers: A Gentle Introduction
  2. True or False? An Introduction to Boolean Algebra
  3. [Variables and Data Typ