Data from beyond our code
This week, we stop our focus on OOP, and move on to other areas of software development. While we will still read and write OOP code, let's start talking about data.
So far, all applications we have written or seen rely on data we provided ourselves, either by defining it as a variable, or by providing user input to our program.
This week, we will learn how to grab data from two new sources: Firstly we will deal with file-related operations. Handling files is a great way of making sure your code's result can be saved for the long term!
Secondly, we will learn a technique for grabbing information from the internet directly. This really broadens the options available to us!
Preview
Here is what we will be exploring this week:
- What is the syntax for reading from and writing to files?
- How can we use this to make data from our code persist?
- How can we fetch information from the internet to use in our code?
Why does this matter?
Without file interactions, everything would have to happen immediately: If you wanted to type an essay, you could never quit the software you are using to edit it until you are done. Imagine if your machine crashes or its battery runs out? Your work would be deleted! Storing data into files that we can refer to later on is something we take for granted, and is absolutely necessary to learn.
There is a wealth of useful information and functionality available to us, often for free, on the internet. We can leverage this for personal use and professional projects.