Viewers: in countries Watching now:
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.
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.
Find answers to the most frequently asked questions about Foundations of Programming: Fundamentals .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.