Presentation is loading. Please wait.

Presentation is loading. Please wait.

Outline Midterm results Static variables Memory model

Similar presentations


Presentation on theme: "Outline Midterm results Static variables Memory model"— Presentation transcript:

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

2 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 , 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?

3 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 , 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?

4 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 , 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?

5 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 , 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?

6 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 , 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?

7 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 , 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?

8 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 , 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?

9 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 , 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?

10 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 , 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?

11 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 , 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?

12 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 , 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?

13 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 , 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?

14 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 , 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?

15 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 , 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?

16 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 , 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?

17 #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 , 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?

18 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 , 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?

19 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 , 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?

20 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 , 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?

21 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 , 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?

22 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 , 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?

23 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 , 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?

24 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 , 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?

25 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 , 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?

26 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 , 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?

27 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 , 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?

28 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 , 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?

29 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 , 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?

30 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 , 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?

31 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 , 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?

32 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 , 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?

33 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 , 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?

34 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 , 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?

35 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 , 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?

36 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 , 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?

37 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 , 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?

38 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 , 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?

39 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 , 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?

40 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 , 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?

41 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 , 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?

42 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 , 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?

43 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 , 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?

44 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 , 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?

45 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 , 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?

46 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 , 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?

47 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 , 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?

48 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 , 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?

49 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 , 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?


Download ppt "Outline Midterm results Static variables Memory model"

Similar presentations


Ads by Google