Converting Dia diagram to Ruby StateMachine =)

Hello !!!

After a loooong while I decided to dev something just so I don´t get too rusty!

The concept is: Statemachine is a fine implementation of FSM for ruby (act_as_state_machine is also an option). The author  wrote a nice guide for layperson (or forgetful like me :P) BUT still something is missing! In all examples there are diagrams, those are very necessary for us to understand what to implement in the machine, but a huge one´s mat get really confusing. The solution would be to convert the Diagram into Ruby code!

The plan: Dia is a great and easy to use diagramming tool, win and linux able, it´s save file is in XML.What i´m gonna do is make a JS that is able to parse it´s code and generate ruby =)

Execution:

  1. Make a definition of the simbols accepted by the conversion. Document it (blog).
  2. Understand the .dia XML, what is gonna be used inside?
  3. Make a website that receives a file .dia
  4. Make a response page with the contents
  5. In this page, JS will read, convert (the XML inside .dia) and return a ruby code for the statemachine in a textarea.
  6. In future (since the future is unknown this may never happen..) there will be no upload to the server, a Flash reads the content and return to JS.

Purpose: I love ruby lang, every Computer Science student must at least once use a Finite State Machine, maybe this interface will make things more attractive so he have a taste of ruby programming..

Long automata’s description may be very boring and error prone this should make the assembly easier.

Advertisements

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