Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Co Web Assigment 3
(Part A) What are the advantages and disadvantages to using garbage collection? (Part B) Explain how reference counting works. Include an example. (Part C) Explain how mark and sweep works. Include an example. (Part D) What problems of garbage collection do generational scavenging and “stop and copy” address? How do they address them?
Garbage collection allows the programmer to focus on programming rather than having to deal with memory allocation. Also, it frees up memory that is no longer in use so it can be put to other uses by the object memory. One pitfall of garbage collection is that it can cause memory fragmentation.
Reference counting is a way to determine whether or not an object is still being used by the program. The problem with reference counting is that it doesn't delete anything that is still referred to by something else in memory. However, this means that two (or more) things can point to each in memory and never be deleted by the garbage collector even if they are no longer being used by the program.
Mark and sweep starts at the root of the program and works it way throughout the entire program, marking all the objects that are referenced by the program. At the end of this, the garbage collection "sweeps" away everything else. It is more effective than reference counting.
Generational scavenging uses the principle that objects that have been in memory longer are less likely to be deleted. Therefore, it marks every object with how long its been in the program and checks the ones that haven't been around more frequently durinig mark and sweep. This is for the efficiency of garbage collection. Stop and copy addresses the problems of memory fragmentation. It stops the program and tries to better allocate memory.
Questionnaires are a common technique for evaluating human-computer interaction. If you were designing a questionaire, what are three things that you need to watch out for to ensure the validity of your findings. Why are each of these a problem? How do you avoid them or keep their influence to a minimum?
Prestige bias - users will act like they know how to use the system when they really don't when you're watching.
Embarrassing questions - don't ask users questions that insult their intelligence or pry into their private lives.
Leading questions - don't ask questions that point the user to the right or a particular answer
Co Web Assignment 2
- Method Finder
The method finder is a useful tool in Squeak. It allows you to search all the Sqeuak code for a given method. To use the Method Finder, click open -> MethodFinder. This will open up the blue box that you see below. Type the method you want to find in the small box at the top left. After pressing enter, a list of all the methods containing the word you just typed in will be displayed. More information about a particular method will be displayed in the box on the right if you click on it.
- Senders of
Senders of displays a list of all the methods that call the method that you have currently selected. In the browser, select a method that you want to try this out on, click on the senders button.
- Implementors of
Implementors of is similar to Senders of. Follow the exact same same steps for senders of (except click the implementors button); however, this will open a new window with all the classes that have the method you are calling.
Co Web Assignment 1
(n < 0) ifTrue: [self error: 'n is not valid'].
(n = 0) ifTrue: [^1].
(n = 1) ifTrue: [^1].
(n > 1) ifTrue: [^(fib: (n - 2) + fib: (n - 1))].
A class is the a description of the basic characteristics of an object, a bluprint for an object, if you will.
An instance is a particular object from the class blueprint. There can be multiple instances of the same class.
Instance variables can be different for different instances of a class, but a class variable exists for all instances of the class. In the same way, instance methods only affect one instance while class methods do not have to refer to a single instance.
Link to this Page