View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Michael Henderson

Member of Team Chuck Norris

CoWeb Assignment 1

Class-Based Inheritance

A: A class can be though of as a "template" for how to build an object. It is the "blueprint" of the object.
A: An instance is the implemented copy of the class. It is the class brought to life in object form
A: An object used in squeak is an instance of a class. Instances are the implemented form of a class.
A: Instance variables have their own copy for each copy of the object. Class variables are variables that are not initialized for each instance of the class.
A: Instance methods are handled individually by each instance of a class. Class methods are handled by the class itself, such as the creation of a new instance.

Writing Code

fibonacci: n
| sum |
sum := 0.

(n < 0) ifTrue: [ self error: 'n must be positive' ].

(n <= 1) ifTrue: [ ^1 ].

sum := (self fibonacci: (n - 1)) + (self fibonacci: (n - 2)).


CoWeb Assignment 2

The Debugger tool in Squeak is very useful in, well, debugging your code. With most programming languages, errors given to you are in the form of a simple line number and an error type. In Squeak, you have access to a powerful debugging tool. Whenever an error is caught, you are able to track the methods and messages sent in order to find out in detail what was occuring in your program at the time of the error. By tracing the method calls back, you can find out the exact occurence of the error. This improves greatly upon many other debugging tools, as often if a method is called by multiple classes it can be hard to find out which call is causing the error. In Squeak, you are told quite straightforward what was occuring prior to the error call. This system of tracing turns many simple errors, such as not having variables initialized in time(as illustrated), into nearly negligible problems. This can save incredible amounts of time in the development process, reducing the time spent from the "Human Error" factor during the debugging process. This also makes it possible to thoroughly trace more in depth errors, eliminating the need for "Trial and Error" testing in many cases.(Seems to be a pattern in Squeak ridding us of Trial and Error thought processes).

It can be confusing to go through the debugger the first few times. Many of the times methods that are shown are ones that are not actually written by you, but methods implemented in the background, so to say. Simply start from the top and work your way down. If you're having a really hard time, or the list is particularly long for some reason, you can usually skip ahead to the first method down the list you recognize as one of your own. From that point you can continue to trace back to see what exactly called it, leading to the error.

There are also an array of buttons that can be used and useful after selecting to "Debug"(Though personally I found myself simply manually moving through the items in the debugging list). With the row of commands, you are able to make your way through the methods that were processed, following it step by step, or even going more deeply into each individual call.

Uploaded Image: mdhdebugss1.JPG

CoWeb Assignment 3

History of Object Oriented Programming

Kent Beck is the originator of the Extreme Programming method. Extreme programming is used to keep development costs low. It is known as an "Agile Development" practice, allowing for simplicity of adaptability in programming.

Ward Cunningham created the CRC (class-responsibility-collaboration) cards that we have been using as a development process. These cards ensure clean implementation of designs by allowing for programmers to set out early the class structure and relationships between the classes.

Collection Classes
1. How do OrderedCollection and Set differ?
OrderedCollection maintains, obviously, an order to the items contained within. This allows for them to be run through or referenced by indicies, whereas a Set can not be.

2. How do OrderedCollection and Array differ? Why would you use one over the other?
Array's are of a static size. OrderedCollections can be expanded at any time. OrderedCollections would be used if there were a dynamic number of items to be stored.

3. How do you use a Dictionary? Why is accessing a Dictionary so fast?
Dictionaries, instead of being indexed by integers, are instead stored with keys. These keys are kept alphebetically, so programs are able to find the item in the dictionary very quickly.

Design Patterns
A) 1. Intent: How you are going to go about solving the problem
2. Participants: All the elements needed for this design
3. Consequences: Issues that may arise by using this design pattern

B) a.) Observer
1. Intent: An observer class will be used to inform a number of classes to any changes to the "observed" class(es)

2. Participants: Subjects: Know the observers and can choose to associate with them or not.
Observers: Can update upon changes.

3. Consequences: It can be heavy on computer resources to add/remove observers.

b.) Factory
1. An interface for creating objects in which subclasses are instantiated based on the given parameters as decided by the factory itself.

2. Creator: The factory itself
Product: The classes created by the factor, given the chosen parameters
Concrete Product: Each product interface itself
Concrete Creator: Overrides the Factory in order to create a specific Concrete Product.

3. Every Product must have a Concrete Creator so that it can be instantiated itself.

Links to this Page