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

gtg842y CoWeb Assignment 3

Extreme Programming:
Pair Programming requires two software engineers to work in a combined development environment on a single machine. Usually, one person is creating unit tests and the other person is thinking/creating the class that is necessary to achieve the goal. The person who is typing the code is called the "driver", and the person who is guiding the direction of the coding is called the "navigator." The two switch roles in a period of time (30 min, 1 hr, etc).

Unit tests are very import when come to Extreme Programming. They are used as to perform white-box testing, which the code is known and to test if the code works in a desirable way. Unit tests will make sure the programmer is not break something up if they changed code.

Garbage Collection
Reference counting is a technique of storing the number of references, pointers, or handles to a resource such as an object or block of memory. It is typically used as a means of deallocating objects which are no longer referenced. Basically, any Object created has its own reference under reference counting. If any other variable is assign with this object, the number of counts incremented; otherwise, it will get decremented. When reference counts to zero, the object can be garbage collected.

The Reference Counting is problematic because it does not detect cycles: two or more objects that refer to one another. An example of a cycle is a parent object that has a reference to a child object that has a reference back to the parent. These objects will never have a reference count of zero even though they may be unreachable by the roots of the executing program. Another disadvantage of reference counting is the overhead of incrementing and decrementing the reference count each time. So, when come to code inheritance, Reference Counting will not work.

Advantages for Garbage Collection:
1. help to solve the problem of manual memory managment (save great amount of time for programmers).
2. It will help to make program more stable, because it will prevent classes of runtime errors.

Disavantage:
Garbage Collection are fully automatic, so sometimes it could cause noticable performance decreases for programs


Program problem
cutTo: aLength
"This method is an Instance method in the String class."
| output space|
((self size > aLength) & (aLength >= 5))
ifTrue: [
(aLength odd)
ifTrue: [
output := String new: aLength.
"Determine the necessary character space before/after the ellipsis"
space := ((aLength - 3)/2).

"from beginning of the string to the ellipsis"
1 to: space do: [:i |
output at: i put: (self at: i).
].

"add ellipsis"
(space + 1) to: (space + 3) do:[:i |
output at: i put: $.
].
"from the end of ellipsis, to the end of the string"
(space + 4) to: aLength do: [:i |
output at: i put: (self at: (i + (self size - aLength))).
]
]
ifFalse: [
Transcript show: 'You must enter an odd number of length you wanted to short'.
].
^output.
]
ifFalse: [
Transcript show: 'The required length for this string must be at least 5'
]

Link to this Page