Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
CoWeb Assignment 1
(numb 0) ifTrue: [ ^-1 ].
(numb == 0) | (numb == 1) ifTrue: [ ^1 ].
^(self fib:(numb - 1)) + (self fib:(numb - 2)).
"This declares temporary variables: data, and onlyPositiveNumbers."
| data onlyPositiveNumbers |
"data is set to be an OrderedCollection containing: ( 1 2 3 -4 -5 'error' 6 -7 999 2)"
data := OrderedCollection withAll: #(1 2 3 -4 -5 'error' 6 -7 999 2).
"onlyPositiveNumbers is set to a block of code that will act as a sort of delimiter."
onlyPositiveNumbers := [:i | (i isKindOf: Number) and: [i positive]].
"data is set to the numbers in data that passed the onlyPositiveNumbers test.
data will now contain: (1 2 3 6 999 2)"
data := data select: onlyPositiveNumbers.
"This copies data over the old data excluding 999 and everything after (2).
data now contains: (1 2 3 6)"
data := data copyUpTo: 999. "not including"
"This prints the average of the elements in data to the Transcript"
Transcript show: data average
CoWeb Assignment 2
Simple and Dual Change Sorters
Before you can start using the Simple and Dual Change Sorter, you need to know how to
open them. Both sorters, along with all the other tools for change sets, are in the
changes category of the “World” menu, which can be accessed by left clicking anywhere in
The Simple Change Sorter shows all changes files (.cs) in the squeak directory in the top left box.
When you select one of the files, the classes that were changed appear in the top right box. If
you select one of these classes, the methods changed appear in the middle box. From these, you
may select one and the code will appear in the bottom box. When you are working alone and
dont have to worry about the problems that come up from merging different change set files,
the Simple Change sorter is perfect. It lets you see exactly what has been changed down to
the actual code. When you are happy with your changes, you can right click on the change
category and choose to file it out. Once you do this, your .cs file will be created/updated and
When you are working with a team and merge errors can set you back days or when you have multiple
change set files and don't know what to do with all of them, you can make use of the Dual Change
Sorter. This change sorter lets you compare the code between two change sets. It also lets you
move methods from one .cs to another by right clicking on the method name to bring up all the method
options. When you are satisfied with your merges and changes you can, as with the Simple Merge Sorter,
right click on the changeset and choose to file out.
Co-Web Assignment 3
History of Object Oriented Programming
Kent Beck thought up the idea of “Extreme Programming”, which is a discipline by which to approach software engineering. The goal of “XP” is to minimize the overall cost of developing and maintaining software, which goes hand-in-hand with writing clean, robust code. The values of XP are: communication, simplicity, feedback, courage, and respect.
Ward Cunningham was the mastermind behind CRC (class-responsibility-collaboration) cards. These cards are a brainstorming tool where the developer writes down each class he thinks he will need on an index card along with the responsibilities of the class and the other classes with which it will collaborate.
Problems with questionnaires include:
Question Specificity: This problem is caused by questions that are not specific enough to give us accurate answers. For example, we can ask a person if he owns a computer. They may very well own a computer but this does not mean they are adept at using it or even that they have ever used it in the first place. Questions have to be specific enough to yield accurate answers while not making the subject feel embarrassed or make them feel like they have to answer a certain way. To limit this problem, we can have a group of people familiar with the project for which the questionnaire was designed look over the question(s) and see if they can think of a more specific way to phrase them.
Language/Jargon: When designing a survey, we must make sure not to use jargon or language that the subject might not understand. If the subject does not understand what the question is asking, he cannot answer accurately. Language must be kept simple and understandable. If an explanation could be needed then a note should be made after the question or somewhere on the questionnaire that is available to the subject. To avoid this problem even further we could have people with very limited knowledge of CS read through the questionnaire to see if they understand the questions.
Leading Questions: These leading questions are questions that lead the subject towards answering a specific way. The way the questions are worded can possibly make the question seem positive or negative. A simple example of this is the two questions: “Do you like operating system Linux?” and “Do you like the unpopular operating system Linux?” While the two questions ask the same thing, it is clear that most people would answer negatively to the second question no matter what their personal feelings are about Linux. To avoid this problem, we could have people who we know for sure hold different opinions and have them read through the survey to make sure the questions are unbiased. Better yet, we could hold no biases to begin with.
Object-Oriented Language Design
3. The advantage of a language that runs on a virtual machine is that it is highly portable between platforms. To port a language that runs on a VM to another platform, the only change that has to be made is slight modification to the virtual machine. Another great feature of VMs is that they take care of garbage collection automatically so the programmer does not need to worry about allocating, reallocating, or freeing memory. Virtual machines are more memory efficient and even safer since the virtual machine usually won't allow unsafe operations to move on to the bare machine. The drawback to VMs is a reduction in speed. This speed penalty is the result of adding an extra layer between the bare machine and the code.
5. In class-based inheritance objects are instances of a class hierarchy, making it scalable and robust. Classes behave like a blueprint, guaranteeing that all instances will behave the same way as the parent class. Drawbacks of class-based inheritance include that an object can’t change its class/type and a reduction in speed. In prototype-based inheritance, classes and instances are not distinct entities. Since objects are instances, objects inherit properties from other objects. The advantages of this type of inheritance are simplicity and speed. The drawback of prototype-based inheritance is that since there are no classes, there is no guarantee that and object will behave the way it is meant to.
Links to this Page