So in quite a lot of languages you're actually choose whether you want an immutable array or a mutable array. Now you might think, "Why an earth would I ever want an unchangeable array, why wouldn't I just want the flexibility of one that can change that I can add to, subtract to?" Well, think of a couple of examples. So you make an array containing all the days of the week or the months of the year, do you really need to add elements to that array? Do you actually want that array to support the idea of suddenly removing the second element mid-program? Probably not.
One of the benefits of immutable arrays is that they're usually faster, because the language can just allocate an area of memory for that array that it knows will never change, whereas with mutable or changeable object there is always a little bit of overhead for knowing that this array may grow or shrink. We've seen that an array is an ordered list of items. We start at position 0 and go up one by one, but there are other kinds of collections where we might want something different. Let say instead of the built-in index of 0, 1, 2, we might want a, b, c or even more likely to have the idea of a key, something that's more meaningful to us.
Let's see an example. Say we have a list of states. It might be very useful to have this collection, but using the abbreviation for these states. So instead of going up 0, 1, 2 we'll use AL, AK, AZ. Now this kind of an array can be created in many languages and it goes by quite a few different names. Generally, it's called an associative array, but some languages call this a dictionary or map or a table. There are even a few more names to it. For those of you who worked with databases you may think there is kind of a link between these.
This of course is not a database. It's nothing to do with a database. This is still a variable in memory, but it's a very useful one to allow us to go directly to each individual piece of data. So when you move into exploring any language you're going to find it's very common for you to consider what is that language's built-in support for different kinds of collections, what does it let you do and what does it make you do.
Finally, the course compares how code is written in several different languages, the libraries and frameworks that have grown around them, and the reasons to choose each one.
- Writing source code
- Understanding compiled and interpreted languages
- Requesting input
- Working with numbers, characters, strings, and operators
- Writing conditional code
- Making the code modular
- Writing loops
- Finding patterns in strings
- Working with arrays and collections
- Adopting a programming style
- Reading and writing to various locations
- Managing memory usage
- Learning about other languages