Tuesday, March 30, 2010

Introduction to Programming: Starting Out With Alice; Chapter 6: Events

Starting Out with Alice: A Visual Introduction to Programming

1. Responding to Events

An event is an action that takes place while a program is running. It could be a mouse click, some even turning true or false, a key stroke, or one of many other items. For an example, in the events editor you will see when the world starts do xxxxx method. This starting of a world is an event.

The process of responding to an event is called handling an event. You have to have an event title in the event editor in order for some event to use it. This is done with the create new event button. This will require some other additional arguments. These methods are known as event handlers.

Specialized Events

Some events will not appear till you create a general event and then right click and select change to on the menu to change to a more specialized event.

2. Handling Key Press and Mouse Events

Key Press Events

A key press event is created when a key is pressed and released on the keyboard. These are created in the event editor with the create new event button. We then choose which key or let it be any key. Lastly we choose what will be done.

Handling the While a key is pressed Event

This is different from the previous in that this event happens when the event is held down, not when it is pressed and released. This event has 4 place holders. One is for the key and the others are for begin, during and end. Each of these refers to the actions that will be taken at each point of the key press. Not all of them will have to be filled.

Mouse Events

When mouse is clicked on anything is another even to use. Created like the others we will also fill in the parameters as needed.

Handling the While the mouse is clicked on something Event

This differs from the mouse click like the key press does to the while a key is pressed. As long as the mouse is held down, the event takes place. Like the while a key is pressed event, we have the same four parameters to fill out.

3. Using Events in Simulations and Games

It is possible to use the mouse and key presses to create games.

4. Tips for Games and Simulations

Random Numbers

Alice environment has a random number generator that can be used any time random events are needed. It is part of the world object and is called random. It generates a number between 0 an 1 which can be manipulated by its properties.

Playing Audio

Some objects like the lion have sound associated with them. You can see this by looking at the class information for that object. To call it, use the object’s primitive play sound method.

Importing and Recording Sound

If you have a wav or mp3 file, these can be used as sounds for objects. Use the import sound button or record sound button on the objects properties tabs to get a sound to use.

The Character Builders

Alice has tools for creating characters on your own. They are called hebuilder and shebuilder. They are located in the local gallery’s people collection. Click the thumbnail and:

  • Design the body be selecting the head, torso and leg types
  • Design the face by selecting a skin color, eyes and mouth
  • Design the hair by selecting a hair style and color
  • Design the clothing by selecting shirt, pants and shoes

These characters have several custom class-level methods.

Debugging with the print Statement

For debugging purposes, the print statement can be used to display in a console below the viewing screen what is going on in the program.

 

 

Visual Basic for Beginners: A Project Approach to Event-Driven Programming



Introduction to Programming: Starting Out With Alice: Chapter 5; Methods, Functions & More About Variables

Starting Out with Alice: A Visual Introduction to Programming

1. Writing Custom Class-Level Methods

Along with the primitive methods in Alice, there are custom methods, called class-level methods. If a method is not available to do what you want it to do, it is possible to build one of your own.

  1. Create an instance of the desired class
  2. Select the instance
  3. In the detail method tab click create new method
  4. Give it a name and click OK
  5. Create the instructions for the method in method editor

Using Trial-and-Error Experimentation in Method Design

There is no way to know what will work right when you create a method in Alice. You will need to test it each time by right clicking and from the methods menu run it to see if you get the desired results. If you do not then modify it again.

2. Saving an Object to a New Class

When you create a custom class-level method it only stays in the world that you created. If you wish to be able to use it again:

  1. Change the name of the object that you want the new class to have
  2. Right click on the object in the world view window, choose save object, add the name in the dialogue box and click OK.

To use it:

  1. Click file the import
  2. Locate the file then click import. An instance of it is now in your world.

Inheritance

In the example in the book we took a FlyingPtrodactyl class and added a flap wing object. The new class had all the old objects with it. It has inheritance, or it inherited the objects as well as added a new one. This is a way of reusing code once created.

Keep Class-Methods Independent of Other Objects

As you learn to make objects, make sure that when you make that they do not rely on the existence of other objects. If they do then trying to reuse them in other worlds will result in failure.

3. Stepwise Refinement

In writing an algorithm in pseudocode it is possible that one could write steps that code is not available for. In that case we would break down the steps and write them out. Since this could make the code harder to read an alternative would be to break them out of the main code and write them as methods. It is even possible that we would break parts of them out into other methods. This refining of the code is called stepwise refinement. It is breaking the code into smaller more manageable pieces.

4. Passing Arguments

Just like we have methods that require a parameter sent to it, we also can write methods that require passing a parameter. These passed values are called arguments. To create one, in the method editor click the create new parameter button and fill in what you need. This now becomes available to use as a variable in your method.

Object Parameters

It is possible to pass objects as a parameter. You would use the object type when you create a new parameter.

5. Using Class-Level Variables as Properties

Each object in Alice programs have properties, things that we can change. They are also referred to as class-level variables, variables that belong to an object and can be changed. To add one to an object, under the objects details property tab choose create new variable. Fill in the dialogue box and click OK.

6. Writing Class-Level Functions

Just as we can write our own methods for objects like the ones built in, we can also write our own function for an object to compliment the ones that it already has. Under the object's function tab click create new function and then follow the steps like we have before to create a function.

7. World-Level Methods and Variables

World-Level Methods

Just as we can break steps into functions that we can call over and over, we can break our big world method into several smaller methods that can be called to do the jobs needed. This allows for code reuse.

World-Level Variables

By selecting the world object we can go to its property tab and create a new variable. Since this is a world variable it will be available to the whole program.

8. Using Clipboards

In Alice a clipboard is an icon that you can drag instructions into. Then when needed you can drag the clipboard onto the area you need those instructions. There is only one clipboard by default but it can be modified by the preferences off the edit menu.

9. Tips for Visual Effects and Animation

Billboards

A billboard is an image (jpeg, gif, or tif) that is imported into a world. It has height and width but no depth. Like any object it will have properties and methods you can use. To add a billboard, click the file then make billboard and look for the file that you want to use.

Fog

In an Alice world, the world objects fogStyle allows you adjust the density of fog from 0 (off) on up. The higher the number the more of a mist will appear and as objects move away in the world they disappear into the cloud.

Moving Objects Together with the Vehicles Property

If we need to objects to move at the same time we can use the vehicle property. By making one object the vehicle for another object, when we move the first object the second object will move along with it.

Making an Object Circle around another Object

By using an object's turn method we can rotate it around its center point. If we want an object to circle around another object we would use the asSeenBy argument (under the more), so that the object will circle the other.

Circling an Invisible Object

If we just want an object go around in a circle, we can have it circle another object that has had its isShowing property set to false (making it invisible).

Capturing Poses

After using the scene editor to move an object into position we want, we can then click the capture pose button on its properties. This will allow us to use the set pose method to bring the object back to that state.

Programming the Camera

Just like anything else in Alice, the camera (the view we see) is an object. We can use its methods to circle around things, move to things, and point at other objects as well as many other things.

Creating Dummy Objects for the Camera

A dummy object is an invisible reference point for the camera. By creating several of these we can use set point of view method and have it use one of these dummy objects.

Beginning Programming For Dummies



Introduction to Programming:Starting Out With Programming Logic and Design;Chapter 8:Arrays

Starting Out with Programming Logic and Design (2nd Edition)

1. Array Basics

Variables that we have learned about so far only allow for one piece of data at a time. If you were need to have many different pieces of data that would be an array. All of the pieces of data must be of the same data type. It is not possible in a running program to change an arrays size. In our psuedocode the declaration of an array is:

Declare Integer units [10]

Integer being replaced with data type, units with variable name and the number in the brackets with how many elements you will need in the array.

Array Elements and Subscripts

Storage locations in an array are called elements. To put information into an array, or to get it out, we would have to use a number to indicate which element of an array we want. That number is called a subscript. Because of the way computers work, the arrays are numbered starting with 0 and not 1. So the highest subscript in a 5 element array would be 4.

Assigning Values to Array Elements

To put a value into an array use the command to put a value into an array, we will psuedocode it as set, use the variable and put the value in it:

Set number[1]=80

Inputting and Outputting Array Contents

It is possible to read values from a keyboard and store them into an array as well as read them that way. You will need to use the input with the array name - subscript.

Using a Loop to Step Through an Array

In order to get all the information out of an array, a loop can be used. By using the variable from the loop to count up (or down), and using it as the subscript for the array name, we can get all the information out of it.

Processing the Elements of an Array

Processing array elements is no different than processing any other variable.

Array initialization

Most languages let you declare an array and then populate it at the same time by putting an = and the list of items separated by commas. This is known as an initialization list.

Array Bounds Checking

Most languages will error out if you try to put a value in an element that does not exist.

Watch for Off-by-One Errors

Because an array starts with 0 it is easy to ignore the fact that most people start counting with 1.  Watch for that simple mistake.

 

Programming Logic for Business



Introduction to Programming:Starting Out With Programming Logic and Design; Chapter 7:Input Validation

Starting Out with Programming Logic and Design (2nd Edition)

1. Garbage In, Garbage Out

If you put bad data into a program you will get bad information out. Programs need to be designed to reject bad data. This is known as input validation.

2. The Input Validation Loop

A common technique for validation is an input validation loop. As long as there is bad data in the input the loop will continue. It is generally a pretest loop. The process:

  1. Get the data
  2. Is it good - yes drop out, if no go on to 3
  3. Display error message
  4. Get the data again
  5. Go to step 2

If the data is bad the first time it will be input at least twice.

Using a posttest Loop to Validate Input

While the logic will work to use a posttest it will not show an error message but just keep asking for input.

Writing Validation Functions

Some validations are not as easy as these are. If we had to test for several different values, to make it easier to read, a function could be used. The function could return a Boolean value and as long as it is false the loop will continue.

Validating String Input

If you need to validate string input it is possible that the input may not be in the case that you need it to be. In that case you may need to use a function like toLower or toUpper to change the case. Or in the case of passwords a length may need to be checked with a length function.

3. Defensive Programming

The examples shown so far are what are known as defensive programming, finding mistakes in input as the user puts them in and before they can cause trouble. Other examples include:

  • Empty input - hit enter when asked for data
  • Putting in the wrong data type - real for integer
  • Invalid state code or zip code for addresses
  • Hours worked in a week being unreasonably high

There are many others as well, it is up to the programmer to think of the ones that can affect his program.

 

Defensive programming



Saturday, March 20, 2010

Web Design and Marketing – Book Reading – Web Style Guide – Chapter 6 - Page Structure


Web Style Guide, 3rd edition: Basic Design Principles for Creating Web Sites (Web Style Guide: Basic Design Principles for Creating Web Sites)

The book that we are using for my Web Design and Marketing Class.  Also available for free on line (but a little harder to read) at http://www.webstyleguide.com/wsg3/index.html

 

 

Book design, news paper design all here standards that are well respected. Though web Standards are emerging, they are in the adolescent stage, still akward.

Site Design in Context

The World Wide Web

Your web Site does not exist in a vacuum. You cannot ignore the design norms of other sites. On the other hand, your site will succeed if your content is good. It will fail it you ignore Content and try to make an interface that is useable.

Enterprise Web Identity

If your organization is part of a larger organization, use the template they have so you have corporate identity. Your site should project a dear relationship to the major (operate site.

Page structure and Site Design

Web sites are abstractions; they only exist in our heads. What gives them the illusion of a site is the Common elements d the site. These make the template of the site. The following are Common elements that have been established:

Page Headers

Headers provide for site navigation, Search, and site identity. If the header is Consistent it will appear to be a site even if it comes from different technologies or locations.

Home link

The company logo should be in the left part of the header and link to the home page. If you do not have a logo, at least put a home link there since that is where people expect it.

Global Navigation

The header is where people expect to see how to navigate the site. You can put list of links or use tabs to give a metaphors of folders . The tabs should a 'you are here' type of navigation.

Breadcrumb Navigation

As part of the header, breadcrumbs give a path of how someone could get there from the main page.

Search

If your site has more than a few pages then search should be provided. Generally the search box is part of the header. Another good location is the left or right side columns.

Checkout Baskets, Online Shopping Carts

The standard that Amazon.com created for all commerce Sites, is for the checkout area to be located in the upper right of the Screen. Banners tend to be in the header so if you are not ad supported be careful to not put banner ad type of Content there. People tend to ignore it-

Scan Columns

Early web designers used the left and right edges of the page as Collins to put information. Now users expect to be finding navigational items there. These include links to other parts of the site as well as search engines.

Left or Right Scan Columns for Navigation?

It does not Matter as long as you are consistent what side your column is as long as it is consistent. Tradition puts it on the left.

Mailing Address and Contact Information

Contact information for your company should be displayed in a noticeable place on each page. The scan column is a good place for this.

Advertising and the Scan Column.

Users expect advertising in the scan column, Make sure your content does not look like advertisement or they well ignore it.

The Content Area

  • Page titles – make sure that the title is not buried, Use and <h1> tag to make it stand out and so that search engines will grab it as important.
  • Breadcrumb navigation – often small text just below the page title.
  • Jump to top links – use if page content is long. Text is fine, small graphic arrow pointing up us good also.
  • Rules – Make as unobtrusive as possible, use white space and ignore them if you have to.
  • Dates – Publication and update dates should be posted at the top of the page on news/magazine style sites and at the bottom of the page on all others.

Page Footers

  • Page author or company responsible for content
  • Copyright statement
  • Contact information (e-mail important)
  • Links to related site
  • Redundant navigation (important on long pages)

 

Page Templates

Page templates should be developed from the inside out.  Most time will be spent on the inside pages so they need to be looking good for the site to look good. 

Internal Page Templates

Provides:

  • Global and local site navigation
  • Design framework
  • Graphic tone

Types of Internal Pages

Your site may have different templates to accommodate the different types of pages that will be used.  There will be a consistent look to them however.  Blogs or wikis may need a simplified template with less navigation to it.  Others may need more room for the content so other parts may be stripped away to give more room for the application, graphic, table, etc.

Secondary Page Templates

Secondary pages should have a close relationship to the main template but accommodate the need for a subset of pages and provide a clear notification that you are on the subpages.

Navigation and Submenu pages

Submenu pages are affectively the home pages for the block of content in that area.

Alternate ‘Front Door’ or ‘Landing Pages’

To match an advertising campaign or some other project, there may be a need to put alternate pages up that people will go to.  They should be similar in content to your main page but be customized for the need.  They should offer clear global navigation to the site as well. 

Department or Program Home Pages

If needed, department or program home pages should clearly show the relationship between the main site and it while hold its own identity. 

The Home Page

Home pages should have four primary elements:

  • Identity
  • Navigation
  • Timeliness, or content focus
  • Tools, (search, directories)

While all good home pages have these, they are not in perfect balance of 25% each. Decide what is important to you and build your page accordingly.  This will establish your priorities to the user.

Taglines

Unless you have one of the top 100 brands in the world there is a chance that people will not know who you are.  Make sure to identify yourself with a tagline that explains who you are in very few words.

Home Page Content and ‘the Fold’

Since most users will be looking at your site on 19 to 22 inch monitors, the top 6 to7 vertical inches become the most important real estate of your site.  This is ‘above the fold’ referring to a term used for print newspapers where top stories went above the fold of the newspaper.  The maximum amount of links you should have in such an area is one per a square inch.  This is a maximum not a recommendation of how many links you should have. 

Dropdown Menus

While they allow you to put more navigation into small space, thought should be given to using dropdown menus. They hide content that will not be visible till the user clicks the menu as well may not be compatible will all browsers. JavaScript only code will not spider in search engines very well. 

Topical Navigation Versus Path-Splitting

You may wish to divide your audience on the home page and give them a path that is important to their category. 

Web Splash Pages or ‘Splash Screens’

Most useless words on the web –‘skip intro’.  Splash pages do not add to the content of a site and are just ‘eye candy’.  If they require a plug in they can be distracting if the user does not have it.  Do not use them.

Simple Web Sites: Organizing Content-rich Web Sites into Simple Structures

Wednesday, March 17, 2010

Web Design and Marketing: Week 7 – Lecture Notes – Interface Design

Objective of this lesson is to know how to properly design a web page for ease of use and meeting the user’s needs. 

Web Page Design

  • Easy to use
  • Meets users needs

Main components to look at to get these objectives

  • Graphic design
  • Text
  • Layout of page

Technical Considerations

  • Not everyone uses the same operating system, check to see what they use and build to that
  • Same with browsers
  • Not everyone uses plug ins or has the most up to date ones
  • Monitor size and resolution affect how your page looks
  • People’s internet connections vary and this affect the page load times

All of these affect your users experience and enjoyment of the site you create

Download Speed

80% of US users have broadband, 20% do not. Where are the majority of your users.  If they are slower you need to have pages that load with minimal time. Even with a broadband connection, slow loading pages will turn your visitors away. 

Use tools like http://www.websiteoptimization.com/services/analyze to check your sites speed. 

If using Joomla, only turn on the modules that you need.  Each module consumes resources and since the pages are made on the fly, the more resources, the longer it will take for the page to be created and load. Use a subdomain to test what modules you want and see how they affect load time.

10 Second Rule

If your user cannot get a page loaded in 10 seconds or less they will generally move on to the next site that they are searching for.  For that reason keep the total page load down to 60K.  That includes you XHTML file and all associated graphics. 

Do not use large graphics and shrink them with the height and width in IMG tags.  Use a software tool to resize them and use the smaller graphic.  Reuse graphics on pages since they will be in the users cache and the browser will grab them from there.  Use Interlaced GIFs to have the picture come in fuzzy and then clear (it loads some lines before others).  Use a graphic tool to break your large image into parts that will all load together.  Graphics will not display on a page till 50% of it has been received so this trick gets them all displaying quickly.

References for Statistics

•ClickZ Stats: http://www.clickz.com/showPage.html?page=stats/sectors/broadband

•Broadband vs. Dialup:
http://www.websiteoptimization.com/bw/

These talk about where in the world high speed Internet is going in.

Graphic Usage

GIF

Best for flat line drawings of 256 colors or less (but millions of colors are available). They compress and decompress with no loss of quality (Losless compression).  They allow for animation and for interlacing (every x amount of lines load first and then repeated till whole image is in).  Also allows for one color to be transparent so that the background of the page will show through.

JPEG

Best for photographic images (most cameras save in this format).  Use a graphic program to resize images from a camera as most are too large to be used on a web page.  JPEG images are lossy, meaning bad compression (not like the GIF). 

PNG

Uses the best from both. Compresses well, millions of colors, and transparency.  However only newer browsers support them.  Make sure what your users us supports it before using it.

Design Layout Considerations

Cluttered Design

Do not overfill a web site with graphics if they are not needed.  Many users are not expecting sound when they go to a web site so use it only when needed.  Use white space to break up the page. You can tell if you used white space the right way if it looks natural. 

Chunking material on the screen keeps it from becoming to busy from large blocks of information.

Background Patterns

Backgrounds should be simple and not be overly repeating.  Make sure any text on the page is readable against the background.

Color

If your site is to be viewed internationally be aware that in different cultures, different colors mean different things.  Make sure that links change colors when they are visited so that the user will not loose his roadmap of where he has been.  Dark text on light background is easier to read. Your total amount of colors used should be about 4 on a page and 7 on a site, not counting neutral colors (gray, black, white). 

Above the Fold

Users tend not to want to scroll so important information should be kept at the top.  If you have done research on the resolution the average user has on their monitor you can build the web site accordingly.  When at all possible avoid horizontal scrolling by using fluid design rather than fixed tables.

Font Guidelines

One thing you will have limited control over is fonts.  Different operating systems come with different fonts.  Two web pages that list them for the Mac and Windows machines:

Font size should be consistent through the site except for navigation, headers, or other elements not part of main content.

The Font Face (or name) that should be used throughout the site would be serif, sans-Serif and monospace. Sans-serif is best used on web sites. 

Text Guidelines

Make your text scannable by:

  • Break it into sections with headings
  • Use logical layout with structure and repeat throughout site
  • Use lists, bold and italics to make some text stand out
  • Use CSS to increase space between lines to make it readable
  • Use no more than four screens of scrolled data

Content Considerations

Want people to return to your site, make sure the content is up to date, unbiased and reliable.  Page content should include landmarks like breadcrumbs, subject headings, title bars and understandable URLs. It is a good idea to include contact information for the business as well as street addresses and phone numbers.  This shows an interest in providing customer service.

Browser Challenges

Because standards are suggestions on how browsers should show things, there can be large variations on how pages look in browsers.  Test your pages with different browsers and different platforms when ever possible. 

Users With Disabilities

It is important to try to make your site as accessible to those with disabilities, especially when your site is a government agency.  http://webair.org is a site that can help you learn how to do this.

Standardization

While Internet Explorer had the largest market share, Gecko based browsers (Firefox, Mozilla, Flock) are increasing market share as are others. Test your pages in multiple browsers. Because of standards not acting the same, it is possible to have the CSS/Dynamic HTML on your site not work. 

Approaches to Differences

Aim for the lowest common denominator. Test your site in browsers or in sites that will show you what it will look like.

 

Designing the Moment: Web Interface Design Concepts in Action

Tuesday, March 16, 2010

Introduction to Programming: Starting Out with Alice: Chapter 4: Decision and Repetition Structures

Starting Out with Alice: A Visual Introduction to Programming

1. Boolean Values

Boolean Variables

A Boolean variable can only hold a true or a false value.

Boolean Functions

We can test a statement and see if it is one or the other and assign it the value. Separating that code into a function would be a Boolean function

2. The if/else Decision Structure

The if/else decision structure will do one set of instructions if a condition is true and a different set if false. This is the opposite of a sequence structure which does everything in order. The flowchart would be a diamond with an arrow to right if true and arrow to left if false.

In Alice, the ifElse tile is at the bottom of the Method Editor. When placed in the editor it will open slots to fill in for the steps for true or false.

Having Multiple Conditionally Executed Instructions

If you need to do more than one step for a condition, put those steps in sequential order within their section.

Creating a Single-Alternative Decision Structure

If you only need to do steps if a condition is true, then in Alice programming you leave the else empty. Most other languages have an if without the else.

Nested if/else Instructions

If you need to test something after it has met or not met the first test, another if/else instruction can be added. This called nested if/else instructions.

3. Relational Comparisons and Logical Operators

Relational operators are use to determine if one value is larger, smaller, or equal to another one.

== equal to
!= not equal to
> greater than
>= greater than or equal to
< less than
<= less than or equal to

These result in a Boolean value which can be used with the if/else to determine which path to take.

To program them in Alice, drag the function tile into place in the if/else tile, select the values you want and finish building the test and instructions.

Logical Operators

It is possible to add multiple tests together; eliminating the need for nested if/else statements. These become Boolean logical operators.

Not a if a is true it is now false and if false it is now true
Both a and b true if a and b is true, false if either one is
Either a or b true if either a or b is true' false only if both are false

4. The loop Instructions

A loop causes a set of instructions to repeat a certain number of times.

Computing the Number of Times to Repeat

It is possible to get a value, like a distance, and loop that number of times. Loops will only use integer numbers.

Infinite Loops

It is possible in the Alice environment to do infinite loops, in other words, ones that will never end till the user stops the program. This is not the best practice in most programs however.

The Complicated Version of The Loop Instruction

A loop instruction in the Alice programming environment has an 'inner workings' button. This button will break the loop down into more complicated steps that are really done.

Flowcharting a loop Instruction

Normally the flowchart would start with the box that initializes the index counter. It would then do a diamond decision with true the loop steps that the loop back to the start of the diamond and false where it drops out.

5. The while Instruction

The while loop is a loop that will repeat as long as a Boolean value is true. Instead of using a counter, it waits for a value to change.

The while Instruction is a Pretest Loop

Because it tests the Boolean value at the start of a loop, and possibly not do it, a while loop is a pretest loop.

Creating a while Instruction

In the method editor at the bottom is the while tile. Drag it on to the editor modify it to set the values for testing.

An Introduction to Programming Using Alice

Monday, March 15, 2010

Introduction To Programming: Starting Out With Programming Logic And Design: Chapter 6: Functions

Starting Out with Programming Logic and Design (2nd Edition)

Chapter 6 Functions

1. Introduction to Functions: Generating Random Numbers

A function is a specially designed module. It will return a value to the part of the program that called it.

Library Function

Most programming languages have built in functions called library functions. They simplify things by doing many tasks that a programmer would have to write himself. Since a programmer will not see the inner workings of them they are sometimes referred to as a 'black box'.

Using the random Function

Random numbers are used in many ways so most programming languages provide for a way to generate them. A common way to code it would be

Set number = (1,100)

With random being the function, number the variable and 1, 100beng the arguments to define the range of numbers to work with. Number would now take a value from 1 to 100. A random number function will return an integer so you want to make sure that the variable is an integer or an error will result.

2. Writing Your Own Functions

When you write your own functions they must have three parts:

  1. Function header - gives the type of data returned and the name of the function; optionally has a parameter list of variables passed to it
  2. Function body - one or more statements that will be done
  3. Return statement - usually the word return with a value that will go back to the calling program line

The type of data would define what it is: real, integer, string. The function name should be descriptive of what it does and will usually have to follow some naming rules.

Usually after the return will be something that indicates the function has ended. We will use end function.

Flowcharting a Function

Draw it like any other program but functions get their own separate chart.

Making the Most of the return statement

Since the return statement will return a variable, it can be used in place of a variable to eliminate a step and make code more efficient.

How To Use Functions

In an effort to make code easier to read it is possible to take confusing code and split it out as a function.

Using IPO Charts

An IPO chart takes the input (I), processing (P), and output (O), and displays them as boxes to define what a function does.

Returning Strings

Most programming languages allow for strings to be returned.

Returning Boolean Values

Most programming languages allow for Boolean values to be returned.

3. More Library Functions

Mathematical Functions

The sqrt Function

Accepts an argument of a number and returns the square root.

The pow Function

Same as ^ since some programming languages do not have raise to power symbol.

abs returns absolute value of a number

Cos returns the cosine of argument

Round accepts a real number and returns it closest value after rounding it.

sin returns sine of an argument

tan returns tangent of an argument

Data Type Conversion Functions

toInteger converts a real number to an integer

toReal takes an integer and converts it to a real

Formatting Functions

Most languages offer a way to format numbers so that it will display as currency.

String Functions

The length Functions

Returns an integer value indicating the length of a string.

The append Function

Takes two strings and ties the first one to the second one and returns a third string.

The toUpper and toLower function

Converts a string of text to all upper or all lower text.

The substring Function

Takes as parameters a string, a starting integer and ending integer and returns a string from the original string starting and ending at the marked locations.

The contains Function

Accepts two strings and checks to see if the second string is in the first.

The stringToInteger and stringToReal Function

Converts a number stored as a string to either a real or an integer.

The isInteger and isReal Functions

Checks to see if a string can be converted.

 

Beginning Programming (Wrox Beginning Guides)

Introduction To Programming: Starting Out With Programming Logic and Design: Chapter 5:Repetition Structures

Starting Out with Programming Logic and Design (2nd Edition)

1. Introduction to Repetition Structures

A repetition structure causes a statement or set of statements to execute repeatedly. This is done so the same code does not have to be typed over and over. We will look at two types: condition controlled loops (using true false tests) and count controlled loops (using a number to count enough times).

2. Condition Controlled Loops: while, do-while, and do-until

The while loop

Gets its name from the way it works: while a condition is true' do some tasks. It consists of a true-false test and a set of instructions to do if it is true. To show the condition in a flow chart a diamond is used with a line to the right to show what to do if true and a line going down to drop out if false.

Writing a while loop in Pseudocode

While condition

statement

statement

etc.

End while

The while and end while should line up while the rest are indented. The condition is a Boolean expression that will do the statements if true. In order for this to work, something in the conditions must change the variable tested for the Boolean test for the program to drop through.

The while is a Pretest Loop

A pretest loop tests the condition before doing the statements.

Infinite Loops

If a loop has no way to end it is called an infinite loop. This will happen in the while loop if there is no way to change the condition.

Modularizing the Code in the Body of a Loop

Using a module in the loop is as simple as calling it and helps in keeping the code clean.

The do-while Loop

The do-while is a post-test loop meaning it looks for changes after the loop is done. It will always run at least once. In a flowchart the diamond is after a group of statements with a true arrow out of the right back to the start of the statements and a false arrow dropping down.

Writing a do-while Loop in Pseudocode

Do

statement

statement

etc.

While condition

Lineup is basically the same as the while loop but test is at the end.

A do-while loop is convenient but any loop written as a do-while can also be written as a while loop.

The do-until Loop

Rather than doing a loop till a condition is false, a do-until continues while it false and stops when it turns true. Flowcharting is similar but the diamond has false to left and looping back to the statements and true to right and drops out. It also is a post-test loop.

Writing a do-until Loop in Pseudocode

Do

statement

statement

etc.

Until condition

Format is like the other two loops looked at.

Deciding Which Loop to Use

The while loop is good to use if a condition may be false to start with and you do not want it to run if it is. The do-while is good for the same but you want it to run once. The do-until is good for a run once condition but you need it to run till test becomes true.

3. Count-Controlled Loops and the For Statement

A count-controlled loop will run a specific amount of times. A for loop is a specially designed count-controlled loop. The count controlled loop works by putting a value (initializing) a counter variable (aka counter). Then the loop starts by testing the counter against the maximum times we want it to ruin. If it is not reached it will do a series of statements and add 1 to the counter. It will then go back and test the loop and exit when the maximum is reached.

The for Statement

Since these loops are common most languages provide for them with a for loop. The for will initialize and then test the loop each time through.

Using the Counter Variable in the Body of the Loop

While the purpose of a counter is store how many times the loop has been done, the variable can be used like any other variable as long as it is not changed as that would affect the loop.

Incrementing by Values Other Than 1

The value incremented is called the step amount which by default is 1. Most languages provide to use another value other than 1 by changing the step value.

Counting Backwards by Decrementing the Counter Variable

To count backward in the loop set the maximum value as less that the initial value and the step to a negative number.

Letting the User Control the Number of Iterations

Usually the programmer will set the maximum amount of times but it is possible to ask the user how many times they want to do it and set the maximum value.

Designing a Count-controlled while Loop

Any loop can become a count controlled loop.

  1. Declare the counter to a start value
  2. While the counter is less than or equal to the maximum value do the statements. Make sure the last statement adds 1 to the counter
  3. If counter is equal or greater to maximum value then drop out of loop.

If you do not add to the counter it will run an infinite amount of times. To use values other than 1 just tell the counter to add that number to itself. This works for negative numbers as well.

4. Calculating a Running Total

A running total is a sum of numbers that accumulates with each time through the loop. It is called an accumulator. You would set the accumulator to its initial value, then start the loop and add it to the initial value. As long as there is something to add you would keep the loop going, otherwise drop out.

5. Sentinels

A sentinel is a special value that marks the end of a list of values. It can be a value we have coded into the program or it usually is a prompt for the user to put in a value to quit the loop. To be useful as a prompt it must be clear that this would not be a normally input value.

6. Nested Loops

A nested loop is a loop inside another loop. An inner loop will go through all of its loops each time the outer loop is done.

Learning to Program in C

Friday, March 12, 2010

Web Design and Marketing – Book Reading Web - Style Guide – Chapter 4 – Interface Design

Web Style Guide, 3rd edition: Basic Design Principles for Creating Web Sites (Web Style Guide: Basic Design Principles for Creating Web Sites)

The book that we are using for my Web Design and Marketing Class.  Also available for free on line (but a little harder to read) at http://www.webstyleguide.com/wsg3/index.html

Interface Design

Users of web sites do not navigate them like any media that existed before.  Because users have gotten used to a Graphical User Interface (GUI) graphics become a very important part for them. 

Navigation and Wayfinding

Wayfinding is the concept of environmental legibility, the elements of a environment that help us navigate it successfully.  It has four components:

  1. Orientation – where am I?
  2. Route Decisions – Can I get from here to where I want to go?
  3. Mental Mapping – can I, from what I have gone through, predict where I should go next?
  4. Closure – will I know when I have arrived?

The man who created this concept for city environments, Kevin Lynch, when found people drew maps of their cit by memory they included some key elements:

  1. Paths: Familiar streets, walkways, subway routes, bus lines
  2. Edges: The physical barriers of walls, fences, rivers, or shorelines
  3. Districts: Places with a distinct identity, such as, in New York, Chinatown, Wall Street, and Greenwich Village
  4. Nodes: Major intersection or meeting places, such as the clock in New York’s Grand Central Terminal
  5. Landmarks: Tall, visible structures that allow you to orient over long distances

While the web requires similar landmarks, we do not have the landscape before us as we travel.  Instead we appear magically at the next stop. 

  • There is no sense of scale or movement – we do not pass familiar landmarks
  • There is no compass – no sense of where you are heading (this is why we need navigation on the home page)
  • You are here – you need navigation tools that print media would never have thought to have used
Paths, Leading the Way

While predictable web site links are good, breadcrumb trails that tell a user where he has been and is are a great source for navigation. 

Districts and Edges: the Paradox of Consistency

If everything looks the same, how can you tell you have crossed from one area to another?  There is no edge to tell you that you have crossed into a new area.  For that reason there should be a visual cue that you have moved from, for example, in a college web site, registration to financial aid. But it still must be consistent with the rest of the site. 

Nodes: The Local Coffee Shop or Times Square

When a user is given to much choice, then there is a chance he will make no choice or not have confidence in the choice he has made. Complicated pages soon become overwhelming like Times Square in New York City.

Landmarks: ”You are here”

Search allows you to jump from one place to another easily.  Because of the the user must be able to take cues from the environment as to where they are.

Summary: Principles for wayfinding in web sites

  • Paths: Create consistent, well-marked navigation paths
  • Regions: Create a unique but related identity for each site region
  • Nodes: Don’t confuse the user with too many choices on home and major menu pages
  • Landmarks: Use consistent landmarks in site navigation and graphics to keep the user oriented

Browse versus Search

Both browsing and searching should supported as research shows 1/2 will browse and 1/2 will search on a regular basis but all will use both at one time or another.

Orientation

Make sure that you provide a ‘you are here’ type of feeling to a web site so that your user does not loose orientation (breadcrumbs, color change, tabs, etc.). While many will be navigating your site by search or browse, many will come in from global search engines and will have no concept of where they are on your site.

Supporting Web Search Users

It is best to provide a search box on every page if your site is more than a few pages. It should be part of the navigation plan of the site. Make sure that you tell them what they are searching (web v. site v. part of site) and how many results you are showing out of how many available.  The results should look like the rest of the site.

Interface Design

Web users loose the sense of the whole document that you would get with a physical media.  Things like length of page and even how long things are can cause disorientation.

Clear Navigation Aids

Any navigation aids that are used should be clear what they do and be consistent throughout the site.  It should be easy to get to the home page and other key pages of the site.

No Dead-end Pages

It is possible with the use of search engines to come in at the end of a related site of pages.  At a minimum, there should be a link back to the home page, and if possible, links to other pages on the site that would be key to their use of the site.

Direct Access

When possible all content should be no more than 2 to 3 clicks away from the home page. 

Simplicity and Consistency

If you must use metaphors on your site, they should be simple, familiar ones.  Getting cute with them only leads to confusion and the user will move on to another site. Navigation should never compete with the content for the users attention. Even if you do not use graphics, be consistent with the navigation text as well as the headers, footers and titles/subtitles.

Design Integrity and Stability

Design your site so that it looks professional.  If it does not, you do not.  Always be checking that all links work as the site expands.

Feedback and Dialog

Make sure that you have a place where people can offer feedback to the designers of things that may need to be fixed.

Bandwidth and Interaction

Users will not tolerate long delays. If the page does not load in 10 seconds many will move on.  If you have visitors from other countries (check your logs), or many dial up users (know who uses your site) you may need to cut back on the large graphics.Be aware also of things like a CMS that will slow down the generating of a page.

Interface Design Conventions

What goes in the headers?

  • Site identity
  • major navigation links
  • search box

Should be a consistent part of the site.

Right or Left Column for Navigation Links

Studies show that left or right does not matter as long as you are consistent. Left however are more expected.

Breadcrumbs for Navigations

Breadcrumbs are just a trail of the hierarchical links that you take to get to a web site. This is a good navigational tool for the user as it provides a clear space as to where he is and how to get easily to related parts of the site.

Information Design

For print media, standards like the Chicago Manual of Style are available.  For web documents there is no current standards, only best practices. For standards sake, Chicago Manual of Style is not hard to implement into web sites.

Freestanding pages

While not novel to web sites it is a fact that pages are often ripped out of the full context of a site.  For that reason, unlike printed media, much more information should be available in the headers and footers of pages than you find in the average print media. Web sites should adhere to basic journalism 101:

  • Who – is speaking – do not put out anonymous quotes
  • What – page title and link names need to tell what page is about
  • When – unlike print which usually has a date to identify age, digital does not, make sure to put revision dates and/or numbers as part of the documents
  • Where – If people print out your page they will have no idea where it is from, consider making the full link part of the end of the page

Summary: Information design guidelines

Every web page needs:

  • An informative title (which also becomes the text of any bookmark to the page)
  • The creator’s identity (author or institution)
  • A creation or revision date
  • A copyright statement, Creative Commons statement, or other statement of ownership to protect your intellectual property rights
  • At least one link to a local home page or menu page, in a consistent location on all pages
  • The home page url
Designing the Moment: Web Interface Design Concepts in Action

Wednesday, March 10, 2010

Web Design and Marketing – Book Reading – Web Style Guide – Chapter 3:Information Architecture

Web Style Guide: Basic Design Principles for Creating Web Sites [WEB STYLE GD 3/E]

The book that we are using for my Web Design and Marketing Class.  Also available for free on line (but a little harder to read) at http://www.webstyleguide.com/wsg3/index.html

 

Information Architecture deals with the overall conceptual models and designs to plan and structure a site.  Like building a house takes many talents, so does building a web site.  If the team is not there, the part that shows to the user will display it. 

Organizing Information

Five basic steps to organize information:

  1. Inventory content – what do you have and what do you need
  2. Establish a hierarchical outline of content and establish a controlled vocabulary for the site
  3. Chunking – divide the content into logical units
  4. diagram the site and make outlines of page with navigation links
  5. Test your system with real users and revise what is needed to be revised

Content Inventory

Content inventory is a listing of the information that you have or will need to create. Though time consuming it is important so that you know what you have.  In inventorying a site the team needs to be able to see the site in a browser as well as the file structure to make sure they have all the content inventoried.  Best way to inventory site is a spreadsheet with the following columns:

  • Unique id number for project purposes
  • Page title
  • Page template or type
  • url
  • General type of content
  • Person responsible for the content
  • Keep/revise/discard decisions
  • Create new content?
  • Review status
Taxonomies and Controlled Vocabularies

Taxonomy is the science of classification.  In information architecture it is the hierarchical of content using specific specific set of terms to describe them.  A controlled vocabulary is necessary for the organization, user interface and what the user is expecting. 

Five Themes to Organize Information

  • Category – similar characteristics or related terms
  • Time – sequential order based on timeline, useful in training
  • Location – spatial or geographic location, maps, training and repair
  • Alphabetic – useful for directories
  • Continuum – range measurements like price or score

Brainstorming

It is good when designing or redesigning a site to step back and take a look at how it can be organized, especially the following:

  • Identity sites: Dominated by projected identity and marketing
  • Navigation sites: Dominated by navigation and links
  • Novelty sites: Dominated by news and “what’s new”
  • The org chart site: Designed around the organization of the enterprise
  • Service sites: Organized around service, content, or products categories
  • Flashy sites: Use interaction and visual flash to draw an audience
  • Tool-oriented sites: Organized around the latest technology, such as xml, Ajax, or “Web 2.0”

Look at all options and see which ones will work for your users.

Card Sorting and Whiteboard Sessions

Card sorting involves using index cards to put major and secondary content categories on them and then organize them in a way that seems intuitive and logical. Different designs can be worked out and then checked with users to see if they make sense.  for smaller sites, a whiteboard can be used with the cards.  Quick consensus can generally be made on topics and organization.  Make sure that:

  • Name the major categories as clearly as possible, without duplications or redundancies in terminology
  • Have a complete inventory of all your major categories and subcategories of content
  • Prepare thorough instructions for individual card-sorting sessions
  • Refrain from prompting or coaching individual participants
  • Refrain from discouraging ideas, and allow free brainstorming
  • Have plenty of supplies for new categories and improved terminology
  • Bring a digital camera to record the proposed organizations and whiteboard layouts

Chunking Information

In general users do not read information on the web like they would with a book, sequentially.  For this reason the information needs to be broken up into chunks or blocks of information, often that will fit on a computer screen.  However, if it is not logical to break up the information leave it in one large piece. 

Site Structure

If your site is structured properly, then the mental models that people make of it will allow them to navigate it easily and find information that they need by extension. 

Browse functionality of your site

Test your site once it is built. You want to balance menus with the content that feels natural to the end user.  If the hierarchy is too shallow it will have large pages and large menus, too massive and the menus become frustrating to use as you have to dig thru them.  Balance this against a web site that continues to grow on a regular basis.

Site search as navigation

As your site becomes larger it will be necessary to have a search option to the content.  This becomes necessary because a lot of the content is only accessible by going down a long set of web pages.  Search is the only real option for a user to find that content quickly.

Site structural themes

There are three basic structural themes for a web site, though they can wind up being a mix of them.

Sequence
Simplest way to organize information is to create a sequence of it.  Good for training and educational sites.  Often these sites will have a small layer of hierarchical pages them that are sequential in nature to explain something in more detail. 

Hierarchies
Hierarchies are the best way to organize large complex bodies of information, especially web sites which suited for this design because of the nature of links. In its simplest form it is a hub and spoke structure (otherwise know as a start structure).  Since these types of sites can form large trees it is important not to lock your user into that branch with no way to get to the rest of the site.  This is done with good site navigation and search boxes.  

Webs
The structure here is really no structure but have a free flow of information.  It exploits the power of linking but can easily cause confusion.  They are best on small sites or on large ones that deal with education or enrichment. 

Summary
As noted earlier, most sites are a mixture of the different types. While they may be hierarchal in nature they can have web like nature underneath as links are made from words to pages that talk about them. Good site navigation helps in these sites.  Even though the user may not look at things in a structure, you have to have one for your site.

Presenting Information Architecture

To site plan as a team, get your site diagram developed and make changes on it as necessary. 

Site Diagrams

Site diagrams can help all stakeholders see how the site is laid out. 

 

Major elements of a mature site diagram include:

  • Content structure and organization: major site content divisions and subdivisions
  • Logical functional grouping or structural relationships
  • The “click depth” of each level of the site: How many clicks are required to reach a given page?
  • Page type or template (menu page, internal page, major section entry point, and so on)
  • Site directory and file structure
  • Dynamic data elements like databases, rss, or applications
  • Major navigation terms and controlled vocabularies
  • Link relationships, internal and external to the site
  • Levels of user access, log-ins required, or other restricted areas
Site File and Directory Structure

As you move from pre-design to actual production, the diagram helps with the overall layout of how the files should organized as well as named.  As these are created, make notes on the diagram of what they are. 

Wireframes

Wireframes are layouts as to where your navigation and content are going to be located.  Using them will let you help focus on content while the design can be tweaked later.  Things that should be on it include but are not limited to:

  • Organizational logo
  • Site identity or titles
  • Page title headlines
  • Breadcrumb trail navigation
  • Search form
  • Links to a larger organization of which you are a part
  • Global navigation links for the site
  • Local content navigation
  • Primary page content
  • Mailing address and email information
  • Copyright statements
  • Contact information

Avoid being specific in color or pictures, the purpose here is to get the content going.  It can get more complex as you understand the full nature of the site.

Canonical Form in Web Pages: Where to put things and why?

Readers tend to scan things on a page in a Z pattern as well as a reading gravity (important at the top).  For these reasons, headlines should always be at the top.  Studies have shown that people will Z scan the left side of a page before they do the right.   Since the web is an emerging technology, placement design will still have to be studied, for best practices, at least till we can get a style guide everyone can agree on to be published.

Information Architecture for the World Wide Web: Designing Large-Scale Web Sites

Tuesday, March 02, 2010

Web Design and Marketing – Week 6 – Lecture Notes

Site Architecture and Navigation

  • Organizing Site Content
    Determine what the content of your site should be.  It should be done by questionnaires that you have gotten back saying what will drive people to your site. Also look at what other sites are doing as well. Lastly what you think content should be can be added to the mix.
    This content should be divided into ‘objects’.  Objects are the parts that make up the page, from the copyright notice to the company logo, the header, the body, all are objects.  Arranging objects consistently on a page give it a structured look. From this you will decide on the look (headers, footers, etc) and the structure (hierarchy) of the web site. The whole purpose, can the user find what he want to quickly?
  • Content decision – users
    What does the user want should be the most important. It is gathered by:
    Market Research
    Benchmarking other similar sites
    Internal Information (what type of support calls they get, web page logs from the server are two examples).
  • Content decision – client
    Talk to the client to see what they want. Look at advertising that they have done to see what has worked. What is the mission statement, what branding do they have. Make sure that your web site matches their branding.  Color can affect it as we will learn later.
  • Content decision – order
    In the end the client pays for the site, but if the user does not come he will not be happy.  Always try to balance the needs of the two.
  • Determining web site objects
    Take the content and break it up in to objects. Object should never be more than one web page (what you see on the screen) in length.  Take some index cards and write out what each object is with the following items
    Title
    Purpose
    Content (Source)
    How often updated
    Who will update it
    These cards can be used to help layout the site as well as to give end-users who can help you design it as well.
  • Prioritizing Web Site Objects
    You need to determine what is needed for the site by breaking them down into three categories.
    Mandatory – ones that must be there
    Desirable – ones that would be good to have
    Optional – if we can get these, good.

    This needs to be done by a review with the client
  • Organizing Web Page Objects
    Make sure that the pages are independent blocks of information as both users and search engines will be accessing them. Make sure that content is no longer than 3  to 4 screen sizes.  If it is, break the content up into chunks that will fit on to a page.
    Repeating objects should be noted on cards but then removed from the stack. In its place draw a mock up of the page. 
  • Information Architecture
    Information architecture deals with how a web site is laid out and the the navigation tools used to move around it. When possible, the hierarchical structure of a site should be as broad as possible to keep the amount of clicks to the information down to a minimum.  To do this make fewer menus but have more choices in them.  Break down the topics into useable chunks in the menus.
  • Linear Design
    Along with the hierarchical layout talked about there is a linear design as well.  It should be used when you need to have one page follow another like a news story or a tutorial.  At the least, this type of design should have a clearly marked exit.  At best, there should be links to all the pages in the line so that the user can jump back and forth as they see fit.
  • Organization of the home page
    Links to the information can be arranged several ways. You can group, or chunk, by topic or by audience for example,  Also, use of metaphors helps by helping the user understand by things that they are familiar with.
  • Navigation
    When a user is at your site they should know where to go next, where they are now, and where they have been. Use consistent link coloring. There is a reason for having a visited link color, it can lead them to where they know the information is, or not to make the same mistake twice.  By changing it to one color for all link types you may take away a visual clue they can use. Avoid underlining text so as not to confuse it as a link.  Name your pages appropriately so that looking at them in the address bar will mean something to your user.  For larger sites consider using breadcrumbs so the user can see how they got to where they are.     Make sure the title tag accurately reflects what is on that page.  Heading tags are helpful in two ways, they help search engines know what is important and help the end use see where information they need may be.  Graphics and color can be helpful to identify what part of the site a user is at. If site is a good size, add a search engine. Drop down menus can be hard on inexperienced users so think twice before using. And always verify with the user and the client that the site will work the way they expect it to.

Advertisements

Web Site Graphics: Navigation: The Best Work From The Web

Web Site Graphics: Navigation 2: The Best Works on the Web

Designing Web Navigation: Optimizing the User Experience

Monday, March 01, 2010

Introduction to Programming – Week 6 – Starting Out With Alice – Chapter 3 – Variables, Functions, Math, and Strings

Starting Out with Alice: A Visual Introduction to Programming
  1. Variables
    Variable is a named storage location in the computer’s memory.
    Types:
    • Local variables - belong to a specific method. Can only be used in it.
    • Parameter variables – used to hold a value that is passed to a method
    • Class-level variables – belongs to a specific objects
    • World-level variable – a property that belongs to the world

    Creating a local variable
    Variable Names
    In programming, variables names are  unique, they cannot have the same name as they would conflict with each other. They should also be meaningful to what they do. They should also use camelCase convention.
    Variable Types
    Number – holds a number only
    Boolean – true or false values only
    Object – holds an object
    Other – specialized types of variables in Alice, such as a string, color, sound
    Initial Value
    When you create a variable it should be given a value. What is given does not matter as it can be changed. This is called a variable declaration, creating the variable and assigning it a value.
    Variable Assignment
    In Alice we use a ‘set’ instruction to reassign the variable to something else after the initial setting.
    Changing Properties with Set Instructions
    Select the object with the property, then drag it form the detail panel into the method editor and follow  instructions to set the value.

  2. Using Functions
    A function is a special type of method that causes some action to take place. To be run it has to be called, and optionally it may need to have some data know as arguments, passed to it. The difference between a function and a method is that a function returns a value back to the instruction that called it.  In Alice, the world and all objects have some primitive functions built into them. To see them, select the object and look at the details panel’s function tab.
    Using a Function to Ask the User for Input
    The world in Alice has three primitive functions that ask a user to input a value. They can ask for a number, ask for yes or no, or ask for a string. Unlike a method that can be called direct, a function returns a value so it has to be called from something that can use its value. 
    Primitive Object Functions
    The functions that objects have are:
    • Proximity - a value that says how close an object is to another object
    • Size – returns value relating to the size of an object
    • Spatial Relation – returns value indicating position relative to other objects
    • Point of view – returns value relating to the objects point of view
    • Other – returns miscellaneous values
    One proximity is distance to which returns a value in meters of the distance to another object.
  3. Creating Math Expressions
    To perform math in any program it will require math operators.   These include addition(+), subtraction (-), multiplication (*), and division (/).  When we do a equation like 3 + 2 the 3 and the 2 are operands.  In place of actual numbers we can put variables.
  4. Working with Strings and Text
    Strings are a sequence of characters that hold a prompt, warning message, name, etc. 
    Asking the User to Enter a String
    In Alice in order to give a variable a string we start the same way as with a number by declaring a variable and putting something in it move the tile to ask for an entry into it.
    Joining Stings
    Sometimes it is necessary to join two strings together to make a longer string.  The method used for this is the ‘joined with’ method. 
    Converting a Non-string to a String
    In Alice if we need to use a number as part of a string, we will convert it with an object ‘what as’ function.
    3D Text
    Alice allows you to create a 3D text object. It will have 4 properties:
    • text - the text that will display
    • font – the font that will be used
    • extrusion – the depth of the text
    • curvature- the curve that the text will have.
Advertisement
Exploring Wonderland: Java Programming Using Alice and Media Computation