Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
M1 the first one:
1.) Create the map
2.) Be able to draw on the map using the designated API
This was the first squeak project, although Mark told us pretty
much what we needed to do and somewhat how, the main challenge of
this project was trying to get things to work in Squeak. The
analysis of this project was basically, "I need to draw lines on
a map". Although it wasn't very sophisticated, it was the starting
The design was basically a collection of Street objects that would
know thier points and whether or not they ran horizontally or not.
The points and horizontal information was then used to draw the
streets in black on a Form using a Pen.
From there, the StartAt: method would pick up the Pen and move
it to the starting intersection that was determined by taking the
points that are associated with the roads and using the horizontal
information to see if the point should be a X or Y point. That
information is then stored as instance variables that keep thier
state. The travelOn: method then just took the name of a Street and
used the horizontal information to decide whether to move the pen
to a new X point or a new Y point. At that time the pen was down
and the color was red so that it appeared a new path was being
drawn. The stopAt: method worked the same as the startAt: method.
The only real tricks were
1.) Knowing how to make a Form.
2.) Knowing how to put the Pen on the form. ( Pen newOnForm: )
3.) Knowing how to change the pen width (pen squareNib: 5.)
The rest was just iterating through lists using the do: message and
using if statements.
The last part of interest was getting the map. This was done using
the actual map on the webpage and the HTTPSocket class
This saved a lot of time in not having to draw the actual map.
Actual Code used:
Thinking through this one, one big mistake I made was not using code
I already had written. The startAt: and stopAt: methods could have
used the exact same code. Also, using a web parser in this project
would have made it more flexible and reusable. Typos of street names
and the like was also a big problem. I did like the simplicity of the
methods that moved the Pen. Also using the HTTPSocket Class bought a
lot of time. On a more abstract level, I learned to use Squeak and
understand the six basic rules. Knowing these help one what the code
is doing. This is important since sometimes documentation in Squeak
can be scarce or confusing. Now that I have gone through all the
projects, my advice is to just play around with Squeak, try out
exapmples, and don't be scared to just try things.
Link to this Page
- RandomFurniture last edited on 11 August 2007 at 1:46 pm by c-69-180-28-252.hsd1.ga.comcast.net