View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Questions on Spring 2003 M2 Milestone

Put your questions on the M2 milestone here.

I have finished the M2 functions. My M1 changeset was still active and recorded all of the changes. I have inspected this change set in Squeak and verified that it contains the changes I have made, however when I file it in on a clean image I receive the following exception: 'MessageNotUnderstood methodsFor: stamp:'. I'm not sure what I can do to try to fix this. How can I create a new ChangeSet that includes all of the changes that I need from my current image?
I can't tell from this description. Did you try to explicitly fileout the classes and bring them in?

My GUI is an "information display box". Users only can get various information they want by pressing different buttons, but they can't input any data. Can we assume that all accounts are associated with portfolios and all portfolios are associated with users?
User can also deposit certain amount of money into a FixedSaving account through method "buy:portolio:amount", right?
Bob says: Yes to both. The GUI just has to support the minimum report and sorting. Everything else can be in the workspace and Transcript for M2. You may assume for M2 that everything is well-behaved. For the full-up system, you will need to design it so that portfolios and account always get associated correctly so that there are no accounts "lost in space".

does anyone feel like being kind enough to give me a hint as to how I can access system time in squeak??? I've found stuff in Magnitude but it all seems only useful if you assign a time to it... how can I get a time for a time stamp?

Bob says: Do a search on class TimeStamp. The search tools in squeak are pretty good. Type what you are trying to do in the find class, find method or even find in class comments, and you should get an idea of what is available.

You keep mentioning the id: in the milestone. However you only reference the name and name: methods in the summary of the requirements. So would you please clarify id/name problem. In addition, could you clarify the method that requires an 'ID': find: strID and return the account with the unique user ID.
Bob says: OK I corrected the page. An account number is considered to be a unique identifier (id). I corrected all the references to be number (deleted id)

User can change any account attribute value except name, number and balance.
For FixedSavings, user can change rate;
For EquityStock, user can change price;
For EquityBond, user can change rate, faceValue, anAccount;
Is my understanding right?
Bob says: In the real system (M3-M7) you will need to worry over what things are volatile (like share prices and interest rates) and what things are immutable (like name and account number). For this milestone, you do not have to absolutely enforce this. For balance, in the real system, you should allow an initial balance to be set. After that, a balance should only be modified by buy,sell,deposit, withdrawal actions.

The syllabus on the coweb shows M2 is due on 2/4. however, the syllabus linked to from the default class page (on the CoC site) still shows M2 as being due on 2/6. I am assuming its due on 2/4, but the old syllabus should probably be deleted now.
Zach Crowell
Bob says: Thanks for pointing this out. We changed our milestones to Tuesdays to try and put maximum distance between us and the 2335 due dates. I will correct the link.

Users want to be
able to find accounts
by their type (show me all the stocks),
by number (show me all my COKE stock)
or balance (show me all accounts with more than X dollars).

but no methods are listed in the minmal message list to implement these behaviors.
so, are these required or are we allowed to code only the minimally required messages in the table?
Bob says: OK. Placed sample messages for find and findType. Deleted reference to querying for various balances. We'll save that for M6.
Should the method, findAccount: accountNumber in the Portfolio class find an existing account in the current portfolio, or an account with the specified accountNumber in ALL accounts created in the system?
Bob says: At the user level, the find:accountNumber should look across all accounts a user owns and return the one with that unique number. In portfolio, findAccount: number should look through all accounts in that portfolio to find one that matches that unique number.
Also, it says that a new transactions method is required in Account. Should we make a CRC card for Account with JUST this method, and/also a UML class diagram for Account with JUST the transaction method??
Bob says: Yes, just use the card to explain how account interacts to accomplish the new M2 functionality. You do not have to show or discuss any M1 specfic stuff.

In the milestone2 it says netWorth should return the value of all the portfolios. But the FixedSavings class doen't have a value member. For fixedsavings are we supposed to use the balance as the value? Also the method netWorth says "do not double count the accounts". Does that mean you can have two or more portfolios with duplicate accounts? Also, should netWorth be an instance variable that is kept volitile, or can the netWorth function simply calculate it at execution?
Bob says: Yes. A fixed savings account has a value equal to its cash balance. An account may be in more than one portfolio. For instance an individual may group all retirement and non-retirement assets together and also taxable versus non-taxable assets. A single account may be both non-retirement and taxable etc. So net worth should only use an account once, no matter how many portfolios it is in. I would recommend netWorth be computed on demand rather than trying to constantly keep it updated. Especially in the real system where stock prices are volatile. Networth is a good example of a derived attribute in UML. We talk about it like it is a real attribute, it even appears in the class diagram with a slash in front of it /netWorth, but in the implementation it doesn't exist as an instance variable.

Can we use BOOST to create our CRC cards and UML class diagram?
Bob says: Yes. Be sure BOOST draws the UML diagram in using the correct syntax. I think some parts of BOOST use the old 0.9 UML spec like the book which would produce incorrect class diagrams.

In M2, do we have to create a user interface which consists of several buttons such as showUserStatusButton, showPortfolioButton etc?
Or, we just call messages in our own TestCase classes?
Bob says: The only M2 GUI requirement is the minimum one spelled out. One button that controls sort direction. If you want more, that's up to you. Everything else can be printed to the transcript as the requirements say.

The description for the find: accountNumber message in the User class says that it should "return the account object with this unique number", implying it should return an account. In the example of how to use it though, the expected result is a collection of accounts. I'm guessing the example of how to use it is really correct?

Bob says: In M2, we assume that an account's number is unique: thus 'COKE' is the only account allowed to have this number. I corrected the sample to show that the return is an account object. In the full system you will have to worry about the fact that you may own 'COKE' with Merrill Lynch which is different from the COKE account you own with Charles Schwab.

If this is correct, then what about findAccount: accountNumber and account: newAccount in the Portfolio class? Can more than one account in a given portfolio have the same number?
Bob says: For M2, assume the account number uniquely identifies an account. For M3-M7, a set of information may be necessary to uniquely identify an account.

If so, we should probably return a collection of accounts with that number.

I think the underlying question I'm trying to ask is "what uniquely identifies a particular account?".
Bob Says: for M1-2 the account number alone uniquely identifies the account. For M3-M7 you will need to design a way to uniquely identify accounts.
Andy Scukanec

How do you get apostrophes inside of strings?
Bob Says: Use a double apostrophe 'a''b' will show a'b
Do we still need to print error messages to the transcript if they are all going to be logged in the transaction records?
Bob says: Yes leave your M1 messages still printing. They will help you with debugging

do creditInterest and related methods need to be documented in the transaction history? i ask, because it does not seem like the user should be able to run those - they should be run automaticaly by a timer.
also, should balance, price, faceValue, etc changes be documented since user is (ultimately) not supposed to be able to change those?
Bob says: The purpose of the transaction history is to record all changes to the balance or value of an account. Thus interest credited to the account should be recorded. Think about your monthly bank statement. You would like to see when and how much the interest payments were to your account.

Is it my understanding that exception, normal and full reports will be printed to the transcript and not to the GUI?
Bob says: That is correct.
Also, are the, I guess they're error codes, that are printed with the report,
eg. 0001 01/01/03 Interest Rate changed to 5.25
0945 01/03/03 Deposit 345.75
The numbers in question "0001" and "0945", are they in fact error codes that we should make up for each error/normal transaction, or are they incremental values that should be incremented every time a transaction is added to the transaction history?
Bob says: Negatory. Those are times in the standard 24 hour clock thus 0945 is 9:45 AM, 1320 is 1:20 PM. A timestamp is both a time and a date.

Do they have to be formatted in that way? Can we just use the default squeak timestamp format?
Bob says: They can be in any format that is recognizable. The default format is fine.

Can a portfolio contain multiple identical accounts?
Bob says: No. While an account might be in multiple portfolios, I can think of no logical reason why an account would be listed more than once in the same portfolio.

for the method buy: portfolio: amount:
What is the type of the argument portfolio ?
In the example code it seems to be a string, is this correct?
Bob says: For M2, the each portfolio has a unique name, which allows us to uniquely identify it. So the answer is yes.

Do we have to include any GUI related classes in the CRC cards and UML diagrams since these deal with the human software interface?
Bob says: For M2, the gui should be extremely minimum. You are just putting one form on the screen.

How does a TA tests our code? Since there is no main function in Squeak, there is no way to generate an initial user interface which consists of option buttons for a Tester to interact. Besides my own testing methods, what else should call messages like showExceptionReport, showUserStatus these messages. I'm really confused by that.
Bob says: You can put a test in SUnit that calls those functions if you like. Otherwise, a known state can be created and the transaction history printed to the transcript. In either case, you would need to manually check the results in the transcript. So the TA tests the code by activating messages through SUnit and in the Workspace.

Besides the minimal external messages, we should have messages like user withdrawals money from saving account; sells bonds and stocks; changes interest rates, right?
Bob says: For M2, you only HAVE to provide the new functionality specifically specified in the milestone description and maintain the old M1 functionality. These types of transactions you are identifying will be requirements in the full-up M3-7 system.

Do we need to modify our m1 SUnit test classes to test new methods that we have added to the M1 classes during M2?
Bob says: Yes. You should keep your SUnit classes synchronized with the actual implementations of the classes they test. This provides you with the automated regression testing to ensure that as you add new functionality, your old code does not get broken.

How do we go about SUnit testing the showStatus method in class User?
Bob Says: SUnit is not that strong for testing actual GUI components. SUnit could call messages that launch the GUI, and then activate the sorts, but actually checking the order would need to be done visually by you unless you do some cool stuff beyond the scope of this milestone.

Should showUserStatus include portfolio and account information? Or Portfolio class should have its own display message to show its information in Ascending and Desending ways?
Bob says: The requirement is to display the information by account/portfolio. How you design the system to do this is up to you. The requirement expects that a single display will present the portfolio and account information. We don't want a list of portfolios and then a list of accounts. We want a list which is first by portfolio then account. For example:
Account 1
Account 2
Account B
Account C|

When using the buy: portfolio: amount: method, is the amount a currency or could it be an integer, for example when buying bonds. The EquityBond buy method takes in an integer number of bonds. The EquityStock buy method takes in a dollar amount. Should we convert in the method between currencies and integers to fit the class before actually making the buy call to the specific class?
Bob says: If you look at the requirements and the method description in the table, it refers to buying amounts of stock/bond or actual cash in a fixed account. It is referring to the number of shares. You don't have to do any conversion. For M3-7 you will probably want a more accurate interface.
I have used the squeak search to search for the Time Stamp class but was not able to find it. Do we have to have SqueakMap installed to have it?
Someone else pointed out that they did not have a TimeStamp class either. Somehow my image has a TimeStamp class in it. I don't know if it came from the upgrade to 3.2.1 or if it came via SqueakMap. Try a google web search on timestamp squeak and see if you can find something. I filed out a copy of my timestamp class and sent it to a classmate. You might checkout your classmates. If you still can't find it, email me directly and I will try to send you a copy of the file.

Is there any way to embed carriage returns in strings? For example just say I want to make a String called aString3 with:
aString1, newline, aString2.

aString1 _ 'string1'.
aString2 _ 'string2'.

so that a Transcript show: aString3 printString. would print out:


Bob says: No. There is no escape sequence like \n that goes in a string in squeak. That's why we send the cr message in the Transcript. You can look at the Character class and actually concatenate the raw ASCII values for CR and LF. I think there might be better ways to do this though.

Well, there are other ways. You can put a newline into a variable like this:
nl := String with: (Character cr).
You can then concatenate strings with nl, for example:
string1, nl, string2.
Alternatively, you could write this as a method called that returns String with: (Character cr). You can concatenate strings with a call to the method, as below:
string1, (insert call to newline method), string2.

Lauren Rich

can we use files to store our transaction records?
Ryan Stell

We have not put any restrictions on you doing this. However, that's what M4-M7 will handle in part, saving data to files, etc. You can easily create constructs in memory to hold all your data. I would suggest looking into those solutions before you mess with files. Chris Verges

Is it OK if we do the CRC Cards in Micrsoft Word using 2 column tables?

Sure. But if the requirements say to hand them in during class, I would make sure to print it and hand in the printed copy. Chris Verges

Do we need to list built in classes like collections as collabarators?

Yes. You just don't need to do CRC cards for those. Chris Verges

How thoroughly must the UML diagram correspond with the actual program? For example do we have to have every single instance variable and method accouted for or can we be a bit more general?

In general, you can skip accessor/modifiers. However, every instance variable must be there, and all other methods must be there. An accessor is defined as a public method which returns a private variable, and a modifer is defined as a public method which sets a private variable. Chris Verges

Should we SUnit test the Account class since that class is sort of an abstract class that is meant to be inherited from?

Bob says: If it has any concrete methods, then those should be tested. If is a pure abstract class (like an interface specification) then there is nothing to test.

What is the correct netWorth for the example code?
i got 37274.31 not sure this is correct

One of the M2 sample code lines is the following:

u buy: 'COKE' portfolio: 'Home' amount: 1352.50.
"should buy 10 shares of COKE account in Home portfolio"

Now I already have increased the shares in the Home portfolio by 10, but my question is where does the $1352.50 (that was used to buy the COKE shares) come from? Am I supposed to take it out of Savings???
Don't worry about where money comes from in M2. If you look at the M3-7 descriptions, you will see how you need to account for money across accounts.

Do we have to include built in classes in the UML diagram, do we have to catalog all of their functions or can we just draw boxes with their names in it?
No. Sometimes its important to model library classes so you can understand what behavior subclasses may have. For this assignment, only those classes that are important to the design need to be shown. For instance you might feel that the relationship between a TimeStamp and a Transaction is important (if these were classes you were using) and so you might show TimeStamp on the class diagram. Remember the purpose of developing these design diagrams is to help you-they are not supposed to be busy work.

Suppose you wanted to include TimeStamp in the class diagram. How much of it would you have to include?

Bob says: I would show that part of the built-in I was using. For instance if the only thing I used was the class method current then I would just show $current in the operations box of the class.

For a message that simply returns an object, and does not use any of that object's messages - does that message collaborate with the class of that object? (in the context of a CRC card)
I am not sure I fully understand the question, but I think the answer is no. Generally you collaborate with another object when you request services from it (i.e. send it messages). Obviously, if we send no messages to an object, then that object can change wildly and it has no effect on us.

Is there any place that we can download an answer to M1 that got a 100? It would help me write M2 without having to waste the time rewriting my M1 first.
UH, no. There is only a small amount of the M1 functionality you would need to have operating to get M2 to function correctly. The emphasis on M2 is manipulating the collections and drawing a simple GUI.

Anyone have some ideas as to why standard error raising of the form:
ifFalse: [
self error: 'name: expects a String'.
would work fine in some places and cause the Squeak VM to completely lock up in others? This is reproduceable, too.

I'm almost finished, but my unit testing that should raise errors is locking up the VM on some of my classes. I even retyped the methods just to make sure there were not any funny nonprintable characters getting embedded.

Any help is greatly appreciated.
Zachary Crowell

Can you provide more context for this error? Have you tried adding "self halt." above where this occurs and stepping through the code from there to make sure this is really the line causing the problem? Another possibility is that your image is trashed. Try filing out you code and then filing in to a fresh image and see if the problem persists... I wish I could help more, but there are just too many possibilities without more context information. Please feal free to come to office hours tomorrow (12-1, commons area) and I will try to help you more then.
Jonathan D'Andries

Hello everyone,
I am having a problem with the dictionary class' method valuesDo:. Basically, I just want to do a block of code on every value in the collection, but I am doing something wrong. I put this in a workspace:

d _ Dictionary new.
d at: 'one' put: 1.
d at: 'two' put: 2.
d valuesDo: [Transcript show: 'Yeah'].

It get an error: block requires 0 arguments and is being evaluated with one. I think my problem is something about passing a block as a parameter, but I don't know what. Any help will be greatly appreciated.

hey tommy, you do it just like a "for loop":
d valuesDo: [:entry | Transcript show: 'Yeah'].
Kyle Mahan

for the user method buy:portfolio:amount why bother giving the portfolio name? can't we find an account just based on it's accountNumber? Since if an account with the the same number is in multiple portfolios, they should all change when one changes correct?

Bob says: Crud, For M2 I think you are right. One part of doing design critiques is to find and eliminate useless parameters. Just go ahead and do it the documented way recognizing you may not need that parameter to accomplish the task for this milestone.

If we elect to draw our UML diagram using paper and pencil, is it ok if we have rough edges around the class-
indicating rectangles or does everything have to be clean ruled?

For the user method buy:portfolio:amount, in the M2 info it says "purchases the desired AMOUNT OF SHARES OR BONDS", but then on the previous questions you make it out to be a currency.. Do we use amount as a currency or as a number of bonds? (big difference)
  • Jason Parekh
    Could someone please make the file available on the Swiki? - James Lee
    Also, the example of how to override the existing new on Page 71 of the Guzdial book doesn't seem to be working. Whenever I try, I still end up having to manually call "initialize" on the class, otherwise everything is set to nil. I have followed the example to the "T," so what else could be my problem? Thanks! - James Lee

    Link to this Page