Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
CoWeb Assignment2 gtg514z
Refactoring is the process of revising the code of an existing project to make it cleaner and easier to read. It does not directly add any functionality and can be time consuming, but easily saves a great deal of time on large complex problems. Its goal is to make the code and design more understandable so it is easier to read, build upon, and maintain. Some methods of refactoring can be simple such as choosing more descriptive variable names (i to ArrayIndex) or eliminating any hardcoded numbers. Other methods are more complex such as extracting attributes out of large complex class and creating new classes for these attributes. When making changes to the design such as this, SUnit testing could be helpful. After one of the many changes you make, it is possible that multiple other things will break as well. Properly built test cases will quickly catch these mistakes and help solve any problems.
I actually tried doing these and then checking them. When I checked the first line, I couldnt get it to work and tried a couple things but I'm not sure what we are looking for...
1 + 2 3 –
4 factorial 24
a := #(1 2 3 4 5) #(1 2 3 4 5)
a select: [:i | i odd] #(1 3 5)
b := a #(1 2 3 4 5)
a := a reversed #(5 4 3 2 1)
b collect: [:i | i i] #(1 4 9 16 25)
a perform: #at: withArguments: #(4) 2
Link to this Page
- Alistair Jones last edited on 19 April 2009 at 9:23 pm by 220.127.116.11