






Hotspots: Admin Pages | Turn-in Site |
Current Links: Case Final Project Summer 2007
M6: Domain Coding
M6: Domain Coding
Welcome to M6! This was the first coding milestone,
which came as a blessing for some in the group.
Here was when we started to encounter our largest
problems, which was mainly with not having enough
functionality. This part could very easily take the
most time, so start as early as possible.
General Tips:
- Begin coding ASAP. We spent hours doing the code
and got lucky that we started around M5.
- Start the GUI coding. Hooking up the GUI to everything
and having everything work properly will probably not
happen the first time through.
- Use your CRC cards! We didn't really realize it, but
some of our CRC cards had much more functionality, in
retrospect, than we realized. Mainly with items and
lot numbers.
- Like mentioned earlier: Try and get extra credit
functionality if you can, but make sure to hit all
of the guideline by the deadline.
Smalltalk Coding Tips:
- Make your code readable. One of our coders in the team
practically insisted making the code near unreadable,
which makes life much more difficult for everyone else.
- SUnit Tests. These are your best friend. Due to everything
being objects, there is no telling what will break/work
until testing.
- Comment like your life depended on it. It helps the GUI
coders and makes the code understandable without having
to read through it every time.
Example of BAD CODING
itemReport: aPos theItem: anItem
"Iterates through invoices, checks POS against invoices, checks items at POS. Also: GOOD LUCK UNDERSTANDING THAT CODE BLOCK (just format it; I like it dirty)"
|theOrder numTimesOrdered allOrders sortedInvoices currBuyPrice|
theOrder := Order new.
allOrders := Orders new.
numTimesOrdered := 0.
currBuyPrice := (anItem buyPrice).
sortedInvoices := SortedCollection sortBlock: [:a :b | a item buyPrice < b item buyPrice].
filledInvoices do: [:currentInvoice | sortedInvoices add: currentInvoice].
sortedInvoices do: [:currInvoice |(currInvoice pos name = aPos name) ifTrue: [ (anItem lotNumb = currInvoice item lotNumb) ifTrue: [ (currBuyPrice = currInvoice item buyPrice) ifTrue: [theOrder pricePoint: ( currInvoice item buyPrice). theOrder timesOrdered: (numTimesOrdered + 1). numTimesOrdered := numTimesOrdered + 1.] ifFalse: [allOrders orderCollection add: theOrder. theOrder := Order new. numTimesOrdered := 0. theOrder pricePoint: (currInvoice item buyPrice). theOrder timesOrdered: (numTimesOrdered + 1). currBuyPrice := (currInvoice item buyPrice). allOrders orderCollection add: theOrder.].].].].
^allOrders
This could easily be put into more methods that would make it nicer. Also, RIGHT CLICK AND PRESS "FORMAT" AND IT WILL LOOK SEMI-READABLE!
This is our Supply Chain Code (Final):
TeamApathy.rar
Link to this Page
- Team Apathy2 last edited on 23 April 2009 at 10:43 pm by 128.61.127.211