API's that Suck

December 8, 2009

Why I like the dictionary operator

Filed under: Uncategorized — Grauenwolf @ 11:48 pm

Before

 

  1. currentRow("IBD") = GetS(line, 1, 3)
  2. '4 is not needed
  3. currentRow("TradeDate") = GetD8(line, 5, 12)
  4. currentRow("RefNumber") = GetS(line, 13, 18)
  5. currentRow("OfficeNumber") = GetS(line, 19, 21)
  6. currentRow("AccountNumber") = GetS(line, 22, 30)
  7. currentRow("AccountType") = GetS(line, 31, 31)
  8. currentRow("AccountName") = GetS(line, 32, 63)
  9. currentRow("BuySellCode") = GetS(line, 64, 64)
  10. currentRow("CancelCode") = GetS(line, 65, 65)
  11. currentRow("CapsSource") = GetS(line, 66, 68)
  12. currentRow("Quantity") = GetD(line, 69, 81, 4)
  13. currentRow("Price") = GetD(line, 82, 94, 7)
  14. currentRow("ProductCode") = GetS(line, 95, 98)
  15. currentRow("Cusip") = GetS(line, 99, 107)
  16. currentRow("AccountShortName") = GetS(line, 108, 117)
  17. currentRow("OrderType") = GetS(line, 118, 118)
  18. currentRow("MiscFee") = GetD(line, 119, 131, 2)
  19. '132-133 is not needed

 

After

 

  1. With currentRow
  2.     !IBD = GetS(line, 1, 3)
  3.     '4 is not needed
  4.     !TradeDate = GetD8(line, 5, 12)
  5.     !RefNumber = GetS(line, 13, 18)
  6.     !OfficeNumber = GetS(line, 19, 21)
  7.     !AccountNumber = GetS(line, 22, 30)
  8.     !AccountType = GetS(line, 31, 31)
  9.     !AccountName = GetS(line, 32, 63)
  10.     !BuySellCode = GetS(line, 64, 64)
  11.     !CancelCode = GetS(line, 65, 65)
  12.     !CapsSource = GetS(line, 66, 68)
  13.     !Quantity = GetD(line, 69, 81, 4)
  14.     !Price = GetD(line, 82, 94, 7)
  15.     !ProductCode = GetS(line, 95, 98)
  16.     !Cusip = GetS(line, 99, 107)
  17.     !AccountShortName = GetS(line, 108, 117)
  18.     !OrderType = GetS(line, 118, 118)
  19.     !MiscFee = GetD(line, 119, 131, 2)
  20.     '132-133 is not needed
  21. End With

My only problem is that late-bound identifiers like column names should be colored differently than ones that are statically verified.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: