Foundations of Programming -Introduction to data and data types
In computer science, data is information that is stored or processed by a computer.
While that might seem fairly abstract, there are a lot of data points we use in everyday life. A birthday, that's a data point. The latitude and longitude of a specific location. That's a piece of data. The name of a city. Whether a store is open or closed. Your initials. These are all data points.
We store them in different ways within a computer. But how exactly do we represent these in code? Or use them in our programs? Well, the short answer is that it's a lot of ones and zeroes.
However, to make it a little easier programing languages have created something called data types that we can use to represent common pieces of our data in code. What are some common pieces of data? Think numbers, letters, true or false values.
In the programs we create, we use and store a lot of these. And the programming languages have created conventions on how these pieces of data can be described and manipulated in code. We classify different pieces of data with data types based on their value.
For example, There's a data type for letters and symbols. And there are various data types for numbers.
But what really is a data type? Ultimately, a data type provides a set of possible values. And if a piece of data is one of these values, it's classified as that specific type. So a data type is defined by the possible values it can be. But it's also defined on how we can operate on that piece of data. In the most general sense, we can think of whole numbers as a data type. Now this is usually called something else by developers which we'll get to.
But, it's the set of possible values that includes every whole number between a very high upper limit and a very low lower limit. Operations-wise we can add numbers, subtract them, and more. But before we dive too deep, we need to understand how various numbers are classified with data types in code.
Comments
Post a Comment