Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Coweb Assignment 1
riting Code (1 point)
(val < 0)
ifTrue: [self error: 'Error: invalid function parameter'].
(val = 0)
ifTrue: [ ^1 ].
(val = 1)
ifTrue: [ ^1 ].
^ (self fibonnaci: (val - 1)) + (self fibonnaci: (val- 2)).
Tracing Code (1 point)
| data onlyPositiveNumbers | - This line declares our temporary/local variables for this function
data := OrderedCollection withAll: #(1 2 3 -4 -5 'error' 6 -7 999 2). - here, the data variable is initialized to a new OrderedCollection containing
the values: 1 2 3 -4 -5 'error' 6 -7 999 2
onlyPositiveNumbers := [:i | (i isKindOf: Number) and: [i positive]]. - now, onlyPositiveNumbers is initialized to a block of code which if executed
will iterate over some iteratable object and return only objects of the type
'Number' greater than 0
data := data select: onlyPositiveNumbers. - now data is set equal to an OrderedCollection only containing the positive numbers
from the original collection
data := data copyUpTo: 999. "not including" - this line will copy all values sequentially up to 999, meaning the first four values
1 2 3 6 from the data collection.
Transcript show: data average - this command tells the transcript(console) to print the average of all the values in
data, in this case 3
Coweb Assignment 2
How to Use Monticello
First off Monticello is a very handy squeak utility which concurrently manages the code for a project. It allows users to, through squeak, access and manage code files virtually anywhere because it doesn't actually act as a repository. Instead, it acts more as a management tool for a file. The end result however is very much the same thing as CVS. It does require however that you use some sort of http or ftp hub. Rather than trying to set that up yourself, you could use the free and relatively easy squeaksource. Login and create a project. Once you do you will be given a 3 line snippet of code to insert into squeak. Copy it.
To open Monticello in squeak you will need to:
1. left click and go to the open menu
2. then go to monicello browser
At this stage if you haven't set up a repository then you will:
3. press the +repository button
4. select http
5. here is where you will paste that code you copied.
6. VERY IMPORTANT to enter you password into the password block on the last line
7. hit save
If you had a repository made already at step 2:
3. click on the repository you are using and hit open (unless you have added a project there won't be anything in it)
To add your project to your repository:
1. open Monticello (above)
2. click +package
3. type in the name of the project you are working on
4. click save
To save, merge, and load code you will need to:
1. open Monticello (above)
2. select your project in the left pane
3. click open
4. select the project on the left and click save
To Overwrite your local copy
4. select the version you want from the right and click load
To Merge the newest copy with you copy
4. select the version you want from the right and click merge
5. a box will open with all of the changes.
6. cross out what you don't want by looking or click all newer if its a generic merge
7. click merge and you're done.
Hope this stuff helps somebody.
Coweb Assignment 3
1. Frameworks are useful not only because they provide a library of classes for one to work with, but they also provide an outline of how a person should develop their application. This particular sort of outline addresses more general issues than a design pattern would.
2. The difference between a framework and a class library is that frameworks also contain designing principals and in many cases require that certain objects get instanciated correctly to function. The idea is that frameworks are much larger in scale and function than class libraries. Frameworks are also rather specific in their intent. They are meant to accomplish a certain idea and that's pretty much all they are capable of. Along those lines there are rules which must be followed in the use of frameworks without which they are useless.
3. Two framework patterns that exist in Squeak are SUnit and Morphic. SUnit is a testing suite that allows developers to create tests to help the refactoring and quality control of their software. Morphic is the framework on which Squeak's gui is based. This frameworks allows for a tremendous amount of flexibility in constructing programs. However in many cases the amount of complexity it contains makes it difficult to work with.
4. Creating a framework is disproportionately expensive. There are many issues that must be addressed that conflict with one another. For example making it so that it can handle errors, but also making it flexible enough to be reusable in multiple situations. It almost requires the system be intuitive to some degree. Since frameworks are prepackaged utilities the end user most likely will not want to learn all of the ins and outs of the system. In this case frameworks need to be simple enough in application so as to be useful to the end user.
Links to this Page