While I’ve done some web development and other coding before, I’m learning new terms as I learn Flutter (though some of them are also used in other languages and frameworks). As I learn new terms, I’ll share them here in this post, updating their definitions and explanations (and adding code examples) as my understanding grows. I’ll also throw in terms I’m familiar with that help to understand the other terms, or that I think might be useful for new programmers, for anyone who is learning along with me! (I hope you love sewing metaphors!)

A close-up photo of a dictionary page. The focus is narrow so that only the definition of the word "focus" is legible.

For me, defining new terms is really helpful with the learning process. Stopping and doing an internet search to find different explanations for each term helps me to understand them better, which makes books, videos, and courses easier to follow, and ensures that I understand the reasons why I’m doing certain things when I follow project instructions.

(Photo by Romain Vignes on Unsplash.)

Arguments

Arguments are what we call the pieces of data that we give to a function. For example, if I wanted to calculate the amount of money left in my bank account after I buy groceries, I would need at least two pieces of data:

  • My bank balance before I made the purchase
  • The amount of money I spent on the groceries

If I write a function in a piece of software to do this, I would save this information in two separate variables, and I could pass the specific numbers to the function when I want to run the calculation.

In my sewing analogy, if I want my sewing machine to create a zigzag stitch, I need to tell it two things:

  • The width of my zigzag
  • How long I want to space between two stitch to be, lengthwise

Those would be the arguments we’d put into the sewing machine to get the desired stitch once we start sewing.

Classes

A class is a kind of data structure in object-oriented programming that basically defines a kind of object, including what kind of characteristics it can have, and what it can do.

Classes are abstractions in the sense that they describe the general states and functions an object can have, even though each object (or each instantiation of the class) can be different.

In the example of my sewing machine, “sewing machine” would be the class, while “Husqvarna Viking” is one possible object that can be built from the sewing machine class.

Constructors

A constructor is basically calling a function from inside the function’s own code. I’m starting to understand that it’s a bit more complicated than this, so I’m sure I will expand this as I go. An internet search helped me learn that constructors are common in object-oriented programming, and they essentially are the part of the class that actually builds the object.

(Update) To clarify this a bit, we have classes, constructors, and objects in our set of definitions.

  • The class is like a general category or type of object, which includes the defining characteristics (parameters). For example, if my class is SewingMachines, my characteristics might include:
    • Number of stitches the machine can make
    • Year of manufacturing
    • Model name
    • Model number
    • Brand
    • Number of active threads possible
    • Number of needles
  • The object is a specific example, or instance, of a class. For example, my sewing machine has the following parameters:
    • 160
    • 2016
    • Viking
    • (I’m too lazy to go look this up)
    • Husqvarna
    • 1
    • 1
  • The constructor is the part of the code where a specific object is built based on the class’s definitions. This is where we would put values in for each of the parameters to define the specific object we want to build.

Functions

A function is a set of instructions (code) that makes something happen. Functions have names, and when you “call” the function within your program, the set of instructions will run. The most important thing to know about functions is that they save you a TON of time in coding when you’re teaching your program to do something that you want to be able to repeat.

Using our sewing analogy, imagine I hire you to work in my dress shopt making dresses. If I have to walking you through every step every single time I want you to make an a-line wrap dress, we’re both going to get frustrated very quickly. But if I give you instructions for making an a-line wrap dress that you can reuse every time I ask you to make one, my shop will be much more efficient, and we’ll both save a lot of time. The named set of instructions for a particular series of steps is a function.

On my sewing machine, a zigzag stitch is one of its functions. When I select the zigzag stitch, the machine will produce a stitch where the needle moves left and right as the fabric is fed under the needle, creating the zigzag pattern with the thread. Selecting the stitch I want is similar to calling a function in my program.

Libraries (Packages)

Software developers don’t have the same qualms about reusing each others’ work that you find in academia. In fact, when you’re developing software, reusing code that’s already been written is encouraged. In general, you’re trying to build an application as efficiently as you can, and using libraries is one of the ways we do that.

Flutter has TONS of libraries already (which are referred to as “packages”), each of which has a number of functions built into it already so that you don’t have to do everything from scratch. For example, you might import the dart:math library to utilize a whole collection of mathematical functions for your project. Any time we need our program to select an item randomly from a list, we’ll need the dart:math library if we want to avoid having to teach our program how to make random choices. And believe me when I say that that would take a while, especially for a new programmer.

Here are a few example of other packages that are available for Flutter:

  • image_picker allows your app to open the images saved on the user’s device and allow them to select an image, or even to take a new photo from your app.
  • url_launcher allows you to include links in your app and allowing a user to open the link in a mobile web browser by clicking on in.
  • google_sign_in has functions that allow you to have users authenticate (or sign in) to your application using their Google accounts (you probably do this with apps all the time!)
  • google_maps_flutter allows you to use Google Maps inside your Flutter app.
  • video_player allows you to embed videos right in your Flutter app!

Objects

The complete technical definition of objects is slightly different from language to language, but essentially objects in software are analogous to objects in regular, every day life. In software, objects have characteristics that define their state, and functions, which describe what they do. If I think about my sewing machine, for example, the characteristics that describe its state at any given time can include whether it’s turned on or off, whether it’s set to sew forward or reverse, what kind of stitch it’s set to use, what kind of needle I’ve put on it, etc. It’s functions (what it does) are the different kinds of stitches in can perform – a zigzag stitch, for example, or a basting stitch.

Each object is an instantiation (or specific example) of a class. My sewing machine is a specific model of sewing machine made by Husqvarna, for example.

A class is also a type of data structure.

Simulator

A simulator is a bit of software that lets you test your application as if it were running on an actual mobile device. For example, Xcode has simulators for different models of iPhones and iPads, and Android Studio lets you test your app on different kinds of Android devices.

It would be prohibitively expensive for most people to have enough actual devices to test their apps thoroughly, so simulators make it a lot easier to make sure your app will work for most people!

Themes

Themes are a set of style rules that you can build into your Flutter apps in the MaterialApp widget in your main Dart file. If you’ve ever created a website with HTML and CSS, the Theme you build in a Flutter app is similar to the CSS that styles your website.

If you’ve never used CSS before, the theme you build in your Flutter app is basically a set of rules that you make for what your app should look like, all kept in one, central location that can be used throughout your entire app.

Let’s imagine I’ve got a Flutter app with 20 different Dart files, with different pages that all have things like buttons and text fields and images. You could set style rules on each of those things as you’re building, but if you mess up somewhere, you’ll end up with a page that looks inconsistent with the rest of your app. It would also be a nightmare if you later decided you wanted to change what your app looked like, because you’d have to go through all 20 Dart files looking for every place where you made a stylistic choice.

If you create a theme instead, and select elements from the theme where you want to use them, then you could make changes to your entire Flutter app just by changing the settings in the theme part of your code in one file – your main.dart file.

In our sewing example, choosing a theme is like picking out all of the elements of the garment before you start – the thread you will use, what color and style of zipper, buttons, bias tape, etc. If you have a specific style and color of things laid out at the start, you’re more likely to end up with a garment where everything matches. If you pick items for each part of the garment individually, you’ll end up with mismatches, which probably won’t be the result you want!

Variables

In case you haven’t been in a K-12 algebra class in a while, a variable is basically a piece of information that is stored with a name so that it can be used within an equation or, in programming, within a function. For example, if you read the definition for Argument above, variables are what is passed into an argument when you run a function.

For example, if I’m running the example function to calculate my bank balance, the two pieces of information I need (my prior balance and the amount of my grocery transaction) would be stored as variables within my application.

The same is true for my zigzag sewing stitch – my two pieces of information (the width of the stitch, and the space between stitches) can also be though of as variables.

In fact, if we take the sewing analogy a bit further, we can talk about why we use variables this way. I’ll sew zigzag stitches a lot of times in my life. I use them to tack pieces of fabric together temporarily, or to finish off the ends of the straps on the face masks I’ve been sewing, and for a number of other things. When I use them for different tasks, I need very specific widths and spaces between stitches. If exact numbers were used when my machine was made, I’d only ever be able to use one kind of zigzag stitch! But because I can change both of these variables, I can create hundreds of different variations of my zigzag stitch, each of which is specialized for a specific purpose.

The same is true for calculating my balance. As soon as I take out the cost of my groceries, my bank balance is now different than it was before I went shopping (unfortunately). If I can’t update my balance before I deduct the next expense that comes along, I’m probably going to overdraft my account because my expected balance will be wrong!

Using variables allows us to use and reuse the same calculations by updating the value for the values being used. This makes programming a lot more useful, and makes our functions a lot more flexible!

Widgets

In Flutter, everything is a Widget. Seriously. This is the first part of every book, video, or tutorial I have looked at so far in my learning adventure.

Widgets are a special kind of class in Flutter, which make things (objects) appear on your screen, nesting inside one another to make up the components of the app and the layout at the same time.

The entire app is a widget. The different regions (containers) on the screen that arrange everything nicely are widgets. The components inside those containers are also widgets.

Getting back to the sewing machine example, the entire sewing machine is a widget, as are the stitch selector controls, the bobbin assembly, and the foot pedal. Each of these things is also made up of smaller widgets – for example, the bobbin assembly is made up of the bobbin compartment, the bobbin casing, the bobbin itself, and the thread wound onto the bobbin.

Basically, as I currently understand it, Flutter is the nesting doll set of programming languages.

Flutter and Coding Glossary