Coding Fundamentals for Real Estate Finance Enthusiasts
Introduction to Programming
What Is Programming?
Imagine you're training a dog. You can't just say, "Fetch the newspaper." You have to break it down into very specific steps: Go to the door. Open the door. Go outside. Pick up the paper. Come back inside. Close the door. Drop the paper at my feet. The dog needs a precise sequence of commands it understands.
A computer is a lot like that dog, but infinitely more literal and less furry. It only does exactly what you tell it to do, in the exact order you tell it. Programming is simply the act of writing those step-by-step instructions for a computer to follow. These instructions, bundled together, are called a program or an application.
Program
noun
A set of instructions written in a programming language that a computer can execute to perform a specific task.
The purpose of programming is to automate tasks, solve problems, and create tools. From the app that wakes you up in the morning to the complex financial models used in commercial real estate, everything is powered by programs that people wrote.
Speaking the Computer's Language
Computers don't understand English, Spanish, or any other human language. Their native tongue is a series of ones and zeros called binary code. Writing instructions directly in binary is incredibly tedious and difficult.
This is where programming languages come in. They act as a translator, allowing us to write instructions in a way that is more readable for humans. A special program called a compiler or interpreter then translates our code into the binary instructions the computer can execute.
There are hundreds of programming languages, such as Python, JavaScript, C++, and Java. You don't need to know them all. Most programmers specialize in a few. The good news is that they all share the same fundamental concepts. Once you understand the core ideas, learning a new language becomes much easier.
Remembering Information
Programs need to work with information, like a user's name, the price of an item, or whether a door is open or closed. To keep track of this information, we use variables.
A variable is like a labeled box where you can store a piece of information. You give the box a name, and you can put something inside it. Later, you can look inside the box to see what's there, or you can replace its contents with something new.
Variable
noun
A storage location in a computer's memory, paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a value.
These boxes are designed to hold specific types of information, known as data types. The most common types are:
- Text (Strings): For storing words, names, and sentences. For example,
"John Smith"or"123 Main Street". - Numbers (Integers and Floats): For storing whole numbers like
42or numbers with decimals like3.14. - Booleans: For storing a simple
trueorfalsevalue. This is useful for tracking states, likeisLoggedInbeing either true or false.
By using variables, our programs can store and manipulate data dynamically, making them much more powerful and flexible.
Making Decisions and Repeating Actions
Programs aren't just a straight list of instructions executed one after another. They need to be able to make decisions and perform repetitive tasks. This is handled by control structures.
The two most basic types are conditionals and loops.
Conditionals allow a program to make a choice. The most common form is an "if-then-else" statement. It works just like it sounds: If a certain condition is true, then do one thing, else do something different.
For example: If the user's age is over 18, show them voting information. Otherwise, show them school information.
Loops are used to repeat a set of instructions multiple times. This saves us from having to write the same code over and over again. Imagine you needed to send a welcome email to 100 new users. Instead of writing the "send email" instruction 100 times, you would use a loop.
A loop says something like: "For each new user in the list, send them a welcome email."
These simple building blocks—variables, data types, conditionals, and loops—are the foundation of all programming. By combining them, you can create complex logic to solve almost any problem.
What is the primary role of a programming language?
Based on the text, a variable is most similar to a:
These core concepts are the first step on your journey. Understanding them well will provide a solid base for learning any programming language and, eventually, building powerful applications.
