Outline Midterm results Static variables Memory model

Slides:



Advertisements
Similar presentations
Dynamic memory allocation
Advertisements

Dynamic Memory Allocation in C.  What is Memory What is Memory  Memory Allocation in C Memory Allocation in C  Difference b\w static memory allocation.
Chapter 6 Data Types
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
CSCI 171 Presentation 11 Pointers. Pointer Basics.
1 Memory Allocation Professor Jennifer Rexford COS 217.
ספטמבר 04Copyright Meir Kalech1 C programming Language Chapter 6: Dynamic Memory Allocation (DMA)
Kernighan/Ritchie: Kelley/Pohl:
Memory allocation CSE 2451 Matt Boggus. sizeof The sizeof unary operator will return the number of bytes reserved for a variable or data type. Determine:
POINTER Prepared by MMD, Edited by MSY1.  Basic concept of pointers  Pointer declaration  Pointer operator (& and *)  Parameter passing by reference.
Dynamic memory allocation. The process of allocating memory at run time is known as dynamic memory allocation. C have four library functions for allocating.
Informática II Prof. Dr. Gustavo Patiño MJ
Dynamic Memory Allocation in C++. Memory Segments in C++ Memory is divided in certain segments – Code Segment Stores application code – Data Segment Holds.
Memory Arrangement Memory is arrange in a sequence of addressable units (usually bytes) –sizeof( ) return the number of units it takes to store a type.
C and Data Structures Baojian Hua
1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation –The new operator –The delete operator –Dynamic.
. Memory Management. Memory Organization u During run time, variables can be stored in one of three “pools”  Stack  Static heap  Dynamic heap.
1 Procedural Concept The main program coordinates calls to procedures and hands over appropriate data as parameters.
CS 11 C track: lecture 5 Last week: pointers This week: Pointer arithmetic Arrays and pointers Dynamic memory allocation The stack and the heap.
Runtime Environments Compiler Construction Chapter 7.
Dynamic Memory Allocation Conventional array and other data declarations An incorrect attempt to size memory dynamically Requirement for dynamic allocation.
February 11, 2005 More Pointers Dynamic Memory Allocation.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 12: Pointers continued, C strings.
1 C - Memory Simple Types Arrays Pointers Pointer to Pointer Multi-dimensional Arrays Dynamic Memory Allocation.
This set of notes is adapted from that provided by “Computer Science – A Structured Programming Approach Using C++”, B.A. Forouzan & R.F. Gilberg, Thomson.
Stack and Heap Memory Stack resident variables include:
Dynamic Memory Allocation The process of allocating memory at run time is known as dynamic memory allocation. C does not Inherently have this facility,
Pointers review Let a variable aa be defined as ‘int *aa;’, what is stored in aa? Let a variable aa be defined as ‘int ** aa;’ what is stored in aa? Why.
Week 9 Part 1 Kyle Dewey. Overview Dynamic allocation continued Heap versus stack Memory-related bugs Exam #2.
C++ Data Types Structured array struct union class Address pointer reference Simple IntegralFloating char short int long enum float double long double.
ECE 103 Engineering Programming Chapter 47 Dynamic Memory Alocation Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103.
1 Dynamic Memory Allocation –The need –malloc/free –Memory Leaks –Dangling Pointers and Garbage Collection Today’s Material.
Dynamic Memory Allocation. Domain A subset of the total domain name space. A domain represents a level of the hierarchy in the Domain Name Space, and.
Object-Oriented Programming in C++
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Dynamic Memory Allocation Suppose we defined the data type: struct custrec.
Copyright 2005, The Ohio State University 1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation.
Pointers in C Computer Organization I 1 August 2009 © McQuain, Feng & Ribbens Memory and Addresses Memory is just a sequence of byte-sized.
Introduction to Computer Organization & Systems Topics: C arrays C pointers COMP Spring 2014 C Part IV.
+ Dynamic memory allocation. + Introduction We often face situations in programming where the data is dynamics in nature. Consider a list of customers.
Computer Organization and Design Pointers, Arrays and Strings in C Montek Singh Sep 18, 2015 Lab 5 supplement.
CS415 C++ Programming Takamitsu Kawai x4212 G11 CERC building WV Virtual Environments Lab West Virginia University.
Lecture – Pointers1 C++ Pointers Joseph Spring/Bob Dickerson School of Computer Science Operating Systems and Computer Networks Based on notes by Bob Dickerson.
1 Lecture07: Memory Model 5/2/2012 Slides modified from Yin Lou, Cornell CS2022: Introduction to C.
1 Lecture08: Program Development & Preprocessor 11/12/2012 Slides modified from Yin Lou, Cornell CS2022: Introduction to C.
Pointers1 WHAT IS A POINTER? Simply stated, a pointer is an address. A running program consists of three parts: execution stack, code, and data. They are.
1 Recall that... char str [ 8 ]; str is the base address of the array. We say str is a pointer because its value is an address. It is a pointer constant.
Multi-dimensional Arrays and other Array Oddities Rudra Dutta CSC Spring 2007, Section 001.
1 Dynamic Memory Allocation. 2 In everything we have done so far, our variables have been declared at compile time. In these slides, we will see how to.
MORE POINTERS Plus: Memory Allocation Heap versus Stack.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 11: Pointers.
Dynamic Memory Management & Static Class Members Lecture No 7 Object Oriented Programming COMSATS Institute of Information Technology.
C Tutorial - Pointers CS 537 – Introduction to Operating Systems.
DYNAMIC MEMORY ALLOCATION. Disadvantages of ARRAYS MEMORY ALLOCATION OF ARRAY IS STATIC: Less resource utilization. For example: If the maximum elements.
Memory allocation & parameter passing
Computer Organization and Design Pointers, Arrays and Strings in C
Checking Memory Management
CSCI206 - Computer Organization & Programming
Programming and Data Structures
Pointers, Dynamic Data, and Reference Types
Dynamic Memory A whole heap of fun….
Dynamic Memory Allocation
Memory Allocation CS 217.
Dynamic Memory A whole heap of fun….
Chien-Chung Shen CIS/UD
EENG212 – Algorithms & Data Structures Fall 07/08 – Lecture Notes # 5b
Dynamic Memory A whole heap of fun….
Pointers, Dynamic Data, and Reference Types
Run-time environments
SPL – PS2 C++ Memory Handling.
Chapter 16 Pointers and Arrays
Presentation transcript:

Lecture08: Static Variable, Memory Model, Top-Down Program Development 4/22/2013

Outline Midterm results Static variables Memory model Program development Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Midterm results Good job – most of you have done well. Avg: 84.68 Std: 36 Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Static Local Variables A permanent variable inside a function whose value lifetime lasts through the entire program execution (vs. local variable, its storage is gone at the end of the function) #include <stdio.h> void f1() { static int k=0; int j = 10; printf("value of k=%d j=%d\n", k, j); k=k+10; } void main() int i = 0; f1(); printf("after first call\n"); printf("after second call\n"); printf("after third call\n"); Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Exercise 8-1 Complete the following function sumit() that reads an integer from the user, computes an accumulative sum, and print it out. void sumit() { static int sum = 0; ..int num; printf("\nEnter a number: "); ..scanf("%d", &num); ..sum+=num; printf("The current sum is: %d", sum); } int main() int i =0; printf("Enter 5 numbers to be summed\n"); for(i = 0; i<5; ++i) sumit(); printf("Program completed\n"); return 0; Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

C Memory Model – where are variables & program code stored in the computer memory? Function variables Arguments Local variables Return location Global Variables Statically allocated Dynamically allocated int fact (int n) { return(n*fact(n-1)); } void main() { … fact(5); …} Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

The Stack Stores Function local variables Temporary variables Arguments for next function call Where to return when function ends Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

The Stack Managed by compiler One stack frame each time function called Created when function called Stacked on top (under) one another Destroyed at function exit Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

What can go wrong? Recall that local variables are stored on the stack Memory for local variables is deallocated when function returns Returning a pointer to a local variable is almost always a bug! char *my_strcat(char *s1, char *s2) { char s3[1024]; strcpy(s3, s1); strcat(s3, s2); return s3; } Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

What Can Go Wrong? Run out of stack space Unintentionally change values on the stack In some other function's frame Even return address from function Access memory even after frame is deallocated Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

The Heap C can use space in another part of memory: the heap The heap is separate from the execution stack Heap regions are not deallocated when a function returns The programmer requests storage space on the heap C never puts variables on the heap automatically But local variables might point to locations on the heap Heap space must be explicitly allocated and deallocated by the programmer Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

malloc() Library function in <stdlib.h> Stands for memory allocate Requests a memory region of a specied size Syntax: void *malloc(int size) void * is generic pointer type Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Usage Good to check the return value from malloc() int main() { int* p1 = (int *) malloc(10 * sizeof(int)); if (p1 == NULL) // do cleanup } // do something free(p1); return 0; Good to check the return value from malloc() Must explicitly free memory when no longer in use Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

What Can Go Wrong? Run out of heap space: malloc returns 0 Unintentionally change other heap data Access memory after free'd free memory twice Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Multidimensional Array On the stack: int a[10][20]; Initialization: int a[][] = {{1, 2, 3}, {4, 5, 6}}; Accessing the array: a[1][0] On the heap: int **a = (int **) malloc() The array size is not known until runtime and stored in a variable x int **a = (int **) malloc(x * sizeof(int *)); for (int i = 0; i < 10; i++) { a[i] = (int *) malloc(20 * sizeof(int)); } Don't forget to free them! Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Exercise 8-2 Write a program that (1) asks for the number of friends, (2) asks for a name, and (3) checks a series of strings to see which one matches the names of friends. Please use Use malloc() to create this multi-dimensional array to stores friends’ names. Assume that each name is less than 10 characters. Use <string.h> library Use scanf(“ %s”, ..) to read a name separated by one or more whitespaces You can modify from the skeleton code on the next slide. Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

#include <stdio. h> #include <string. h> int main() { char #include <stdio.h> #include <string.h> int main() { char** friends; char name[10]; int n, i; printf("Input the number of your friends: "); scanf("%d", &n); /* call malloc() to allocate dynamic memory for friends and friends[1..n-1] */ … for (;;) printf("Input a name: "); scanf(" %s", name); for (i=0; i<n; i++) if (strcmp(friends[i], name) == 0) printf("%s is friend #%d\n", name, i+1); break; } if (i == n) printf("%s is not a friend\n", name); /* call free() to free memory for friends and friends[1..n-1] */ Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Program development (important!) A Common problem Know all C commands but don’t know how to use them to write a program. Top-down approach – always work! Start by writing down the main steps (in words/comments, not code) of a program. Like a paragraph in an essay. For each difficult main step, break it down into smaller steps. Again in words/comments, not code. Apply this “divide-and-conquer” approach until the steps are simple enough to code. Write code Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Last Year’s Midterm Problem 1 Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Top-Down Approach to Program Development Start by writing down the main steps (in words/comments, not code) of a program. Like a paragraph in an essay. For each difficult main step, break it down into smaller steps. Again in words/comments, not code. Apply this “divide-and-conquer” approach until the steps are simple enough to code. Write code Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Top-Down Approach to Program Development Start by writing down the main steps (in words/comments, not code) of a program. Like a paragraph in an essay. For each difficult main step, break it down into smaller steps. Again in words/comments, not code. Apply this “divide-and-conquer” approach until the steps are simple enough to code. Write code Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Top-Down Approach to Program Development Start by writing down the main steps (in words/comments, not code) of a program. Like a paragraph in an essay. For each difficult main step, break it down into smaller steps. Again in words/comments, not code. Apply this “divide-and-conquer” approach until the steps are simple enough to code. Write code Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Systematic way of writing programs Like writing an essay. Start with an outline that describes what you are going to write. Okay to write the comments in Chinese. Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Exercise 8-3 Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Top-Down Approach to Program Development Start by writing down the main steps (in words/comments, not code) of a program. Like a paragraph in an essay. For each difficult main step, break it down into smaller steps. Again in words/comments, not code. Apply this “divide-and-conquer” approach until the steps are simple enough to code. Write code Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Top-Down Approach to Program Development Start by writing down the main steps (in words/comments, not code) of a program. Like a paragraph in an essay. For each difficult main step, break it down into smaller steps. Again in words/comments, not code. Apply this “divide-and-conquer” approach until the steps are simple enough to code. Write code Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Top-Down Approach to Program Development Start by writing down the main steps (in words/comments, not code) of a program. Like a paragraph in an essay. For each difficult main step, break it down into smaller steps. Again in words/comments, not code. Apply this “divide-and-conquer” approach until the steps are simple enough to code. Write code Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Top-Down Approach to Program Development Start by writing down the main steps (in words/comments, not code) of a program. Like a paragraph in an essay. For each difficult main step, break it down into smaller steps. Again in words/comments, not code. Apply this “divide-and-conquer” approach until the steps are simple enough to code. Write code one step at a time Debug each step if necessary Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?

Software infrastructure: support integration between physical space and virtual computing space, adapting to different smart environment, etc. Sensors: acquire user context such as techniques to estimate location from 802.11, etc. Context-aware applications: how can we use the context information to make application or everyday objects intelligent Security and privacy: user context information (where you are) should be protected. Human experience: user experience in ubicomp environment – how to evaluate it quantitatively or qualitatively? Ubiquitous data access: access information from any devices in any modalities from any networks Coping with uncertainty: sensors may have errors (GPS). Social computing: ubicomp is used in everyday physical / virtual activities. It will affect your social activities. How can we use it to improve your social lives?