Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Schedule: 30 September 2005
Discustion III: Squeak Problem
Part I: Problem in Squeak
When I created the timer class for milestone one I had the most annoying type specific problem. I did integer division and wanted an integer to make display easier. Squeak saw division, so it gave me a fraction. I told the fraction asInteger, so Sqeak gave me a fraction. Then I tried truncate, rounded, ceiling, floor, and everthing else I could think of, and I still got back a fraction. All the methods I had just tried truncated the original answer at this point I came to the conclusion that trucation is illegal in Squeak. I dediced it might be easier to convert the fraction to a float, and then the float to an integer. This led to the solution shown below. In the solution I am tricking Squeak in to beleiving the original input is an integer, so rounding it will not truncate it.
((fraction asFloat) - (fraction asFloat fractionPart)) rounded.
Part II: Other people's posts
His disscusion is about the standardfilemenu. This discussion is particularly useful because it helps you create a standard file menu properly(something that should already be included in squeak). This is important becuase as explained in class we are expected to use this menu for file operations in our project.
His disscusion is about the alignmentmorph. This discussion is particularly useful because he fully explains alignment morph. This is important because alignment morph can be used to control layout and that is required in the next milestone.
Links to this Page