Lesson 4: Visual Direction and Complex Data Types
Introduction to Visuals in IxD
Having spent time thinking distinctly about the words we use in interaction design, we now turn to think critically about the visual design we implement.
Read IxD1, Chapter 4: Visual Direction in Interaction Design.
Study Questions
- In what ways is the sense of vision dominant in IxD?
- What are three requirements for orienting users?
- What are the seven tips for orienting users to navigation?
- What are some ways we can ensure visual consistency?
Creating Lists of Data with Arrays
The data types we've discussed several primitive data types so far: numbers, strings, and booleans. These provide very basic kinds of data we can store, but we often run into cases where we'd benefit from being able to store sets of data, particularly, lists of similar data.
Read Duckett, Chapter 2, pp.70--73 to learn about the Array data type.
Study Questions
- What are arrays?
- SKILL: Create an array using both the array literal technique and the array constructor, and add items to an existing array using each method as well.
- SKILL: Access items from inside an array.
Objects in Detail
Its time to get serious about objects. Having studied the other data types, and most recently, arrays, you have more context to consider what makes objects different and useful. We'll start with a general reading on objects and how to construct them.
Read Duckett, Chapter 3, pp.100--119 to learn about the object data type.
Now let's take a look at some of the objects already set up and available to you through JavaScript.
Read Duckett, Chapter 3, pp.120--139 to learn about built-in objects.
Study Questions
- SKILL: Create on object using literal notation and constructor notation.
- SKILL: Access properties and methods of an object using dot notation.
- What is the difference between an object created with the literal notation and an object created with the constructor notation.
- What is the
this
keyword? - What are built-in objects?
- What are some features of the
window
object? - What are some features of the
document
object? - What are some features of the String object?
- What are some features of the Number object?
- What are some features of the Math object?
- What are some features of the Date object?
Presentation and Demo
Watch this presentation and play along in the demo provided in CULearn. Use this handout to take notes.
Commit to Memory
Snippets
Create an array using literal syntax:
var __1__ = [ __2__ ];
- The name of the variable being assigned this array.
- A comma-separated list of values.
Call an array value:
__1__[ __2__ ]
- The variable storing the array
- The numerical index of the desired item, counting up from 0
Create an object using literal syntax:
var __1__ = {
__name1__: __value1__,
__name2__: __value2__,
etc...
};
- The variable being assigned this object. * Provide a set of name-value pairs with a colon between name and value, and a comma after each name-value pair.
Call properties or methods of an object with dot notation:
__1__.__2__
- The variable holding the object.
- The desired property or method. If a method is called, also provide
()
and any parameters required by the methods.
Define an object/class prototype with constructor syntax:
function __1__(__2__) {
// Properties
this.__3a__...
this.__3n__...
// Methods
this.__4a__ = function...
this.__4n__ = function...
}
- The name of the object/class, usually capitalized
- Parameters for setting up the object
- Any predefined properties using the keyword
this
and assigning the desired value - Any predefined methods using the keyword
this
and assigning an anonymous function
Instantiate any predefined object/class:
__1__ = new __2__(__3__);
- Typically a variable to store the object instance
- The name of the object/class after the keyword new
- Any parameters allowed by the object
Built-in objects
Be familiar with what is possible with each of the following built-in objects:
window
document
- String
- Number
- Array
- Math
- Date