An Order Entry and Wireless Data Collection System Using Tcl and SQLite

Notes on Steve Redler IV's Tcl2008 talk.

Steve's been in business for 16 years providing industrial solutions using Tcl/Tk and Linux. Customers include Wonder Bread (breads and cakes), Thumanns (deli meat products), North East Foods (provide buns for McDonalds and Burger King).

Last years solution. Added features to the Oracle solution. Using bits from the Tcl'ers Wiki. Took 20 line proxy by Michael A. Cleverly and extended it with ~1,200 more lines of code.

The Oracle Dilemma:

  • Classic bait and switch
  • High licensing cost after modifications
  • High total cost of ownership

Oracle wanted $800K more. Steve (jokingly) offered customer to re-write it for $800K and park himself there for the next four years :-D. Deli company needed a way to enter orders and then have them picked, shipped, and invoiced. Steve cranked out a prototype in 3.5 weeks.

Initial design (reinventing the wheel):

  • Fixed record database
  • Sales order client GUI
  • Order fulfillment app server
  • Network Database Server (using code from the wiki by Reinhard Max)

Went live on a Monday morning. Shut Oracle down the same day. Never looked back.

After a couple weeks of use found some limitations discovered: speed and concurrency. "No, really...speed & concurrency!" The simple database was doing a linear search. Started reading up on the Wiki about b-trees. Then it hit him: why do b-trees? DRH has already created sqlite.

Second design (Wheel 2.0):

  • Shoehorn in SQLite in 2 hours
  • Proof of concept turned production
  • Runs reliably 24/7
  • Logging for diagnostics
  • Easy to backup--one file
  • Can use a "yesterday" db snapshot for offline query use

"Users break everything"--logging comes in very handy to figure out what happened afterwards.

If you are available (to your customer) they'll come to you with more modifications, more things to do... great for him being self-employed.

What he has now:

  • Single file applications & reports
  • Multiuser clients app -> network db
  • app server -> telnet clients
  • on the fly application updating (using zipkit technology from Pascal Scheffers)

Program code checks the file mtime of the .kit and if it sees it has changed it unmounts the VFS and remounts it and re-sources the application code, and voila, it's running the updated code, no end user downtime. The customer was floored (especially in comparison to Oracle upgrades).

Future goals:

  • Redundancy
  • Database and Application Failover
  • TDBC integration
  • TclOO simplification

"Why I am here":

  1. Discuss upcoming Tcl/Tk features with peers
  2. Discuss/debate my solutions with peers
  3. Drink with peers
  4. Knowledge transfer to attendees

Happy to share how he makes a living with Tcl.

Question from the chat: Do you do anything with RFID? Answer: no, barcodes. RFID makes it hard to identify a single individual piece of equipment.