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

Matthew Peterson


Refactoring (pt1):

refactoring is the process by which the structure and placement of exisitng code is changed while leaving the functionality intact and unchanged. this is to be done in any case where it is difficult to understand the function of a portion by reading the code. examples are ambiguous variable and function names, excessively long functions, and large amounts of reproduction. to refactor variable names, rename them to something more meaningful. to refactor long functions, seperate logical peices of the function into smaller functions. to refactor large amounts of reproduced code, condense the reproduced sections into seperate functions.
unit testing can be very useful in the process of refactoring code. each unit test will check if individual functionality is still operating correctly. occassionally while refactoring, human error will break functions and classes that were not broken before. unit testing will help you find and fix these problems easily.

Message Passing (pt2):

(test-statement) whileTrue: [code-block].

(test-statement) is the reciever, whileTrue: is the message, [code block] is the argument

1 to 10 do: [:i | code-block].

1 is the reciever, to: do: is the message, 10 and [:i | code-block] are the arguments

(test-statement) ifTrue: [code-block] ifFalse: [code-block].

(test-statement) is the reciever, ifTrue: ifFalse: are the messages, [code-block] are the arguements

Link to this Page