DIYEFI.org Forum
http://forum.diyefi.org/

Proper code/class layout diagram before writing any code.
http://forum.diyefi.org/viewtopic.php?f=45&t=1147
Page 1 of 1

Author:  SleepyKeys [ Wed May 04, 2011 11:19 pm ]
Post subject:  Proper code/class layout diagram before writing any code.

I would like to refine this diagram/note so that I can use it to create a new loader that utilizes a "comms suite". I used dia to create what I like to call a proposed class sheet.
Image

I don’t necessarily want to create all these classes at once, some have higher priorities than others. I also don’t want to work myself back into a corner making it too much work to add/change some of the underlying classes.

I will use loading an s19 file from the GUI to the Device to iterate though the diagram.

1. the user loads the application creating within it an instance of the Communications/Operations class.

2. the user selects properer comms method and protocol(rs232 and serial monitor)- this could be the default

3. The user clicks connect and depending on their settings the Communications/Operations initializes within it self the a Data-I/0 class with the specified parameters. In this example Data-I/O will use the serial monitor over RS232.

4. The user clicks load and chooses an s19 file from the file menu.

5. The Communications/Operations class receives a file name parameter and a "load" command after which it reads out the file and gets/checks the payload data via the functions in this s19 lib.

6. CO class feeds data to the Data-I/O object who checks for proper acks etc depending on the transport protocol and set options.

7. After the operation has completed the user has the option to reset the device state and disconnect etc.

I think what would be a big help is to define what each part should and should not do before writing any new code.

-sean

Author:  Fred [ Tue Jun 28, 2011 12:08 pm ]
Post subject:  Re: Proper code/class layout diagram before writing any code

I've had a bunch of graphviz tabs open in my browser for months, so I'm dumping them here for the time being.

Gallery of examples: http://graphviz.org/Gallery.php
Live online engine: http://graphviz-dev.appspot.com/

The balance were from the gallery page, trying to choose a style.

Fred.

Author:  SleepyKeys [ Tue Jun 28, 2011 2:21 pm ]
Post subject:  Re: Proper code/class layout diagram before writing any code

awesome thx!

Author:  MotoFab [ Tue Jun 28, 2011 2:22 pm ]
Post subject:  Re: Proper code/class layout diagram before writing any code

Thanks for the link!

Author:  Fred [ Mon Oct 03, 2011 1:13 am ]
Post subject:  Re: Proper code/class layout diagram before writing any code

http://plantuml.sourceforge.net/activity.html

Check out the other types of diagram that they offer. It USES graphviz, so it IS a front end to graphviz, just a text based one. Nice stuff.

Code:
@startuml EMS.Purchasing.png
title EMS Purchasing Flow Chart

(*) --> "Looking for an EMS"

if "FreeEMS?" then
  -->[yes] "Run engine beautifully"
  --> "Have money left over for..."
  if "Hungry?" then
    -->[yes] "Pizza!"
    --> "Be very happy!"
  else
    -->[no] "Beer!"
    --> "Be very happy!"
  endif
  --> "Laugh at MS user"
  --> "Still be very happy!"
  --> "Buy second project car"
  --> "Be happier than ever"
  --> "Retire early"
  --> (*)
else
  -->[no] "Which EMS then?"
  if "Rich?" then
    -->[yes] "Motec"
    --> "Not anymore!"
    --> "Run engine well"
    --> "Put on smug face"
    --> "Desire customisation"
  else
    -->[no] "Get a Link"
    --> "Bros like it"
    --> "Run engine ok"
    --> "Bros get one too"
    --> "Desire customisation"
    --> "Be very sad"
  else
    -->[poor] "MegaSquirt"
    --> "Laugh at Motec user"
    --> "Load new code, again"
    --> "Melt coils"
    --> "Replace coils"
    --> "Bad PID idle"
    --> "Use open loop"
    --> "DB37 Problem"
    --> "Melt piston"
    --> "Be very sad"
  endif
  --> "Be very broke"
  --> (*)
endif

@enduml

Build like so:

Code:
fred@cheetah:~$ java -jar plantuml.jar EMS.Purchasing.plantuml
fred@cheetah:~$ eog EMS.Purchasing.png

Image

I hope you have a sense of humour!

Fred.

Author:  EssEss [ Fri Oct 07, 2011 6:05 pm ]
Post subject:  Re: Proper code/class layout diagram before writing any code

I use this a lot for diagramming state machines: http://www.umlet.com

Author:  Fred [ Wed Nov 02, 2011 4:28 pm ]
Post subject:  Re: Proper code/class layout diagram before writing any code

Sean and I were talking the other day and agreed that he should do a meta summary of the parts required to build an awesome loader. I didn't want to lose what we had discussed into the depths of time, so here it is!

The issue tracker can act as a guide about needed glue logic and the current spec too. Plus, you know the sort of chunks it has in it to do the work, stuff like:

  • low level serial
  • sm commands
  • fw commands
  • s19 parsing/reading/writing
  • etc

And the glue:

  • micro sequences
  • combos of sequences
  • logic on how to handle different states

Once you've thoroughly done that, with feedback, we can talk about how to assemble the pieces :-)

Fred.

Author:  SleepyKeys [ Wed Nov 02, 2011 4:50 pm ]
Post subject:  Re: Proper code/class layout diagram before writing any code

Selecting previously deselected package umlet.
Unpacking umlet (from .../archives/umlet_10.4-1_all.deb) ...
Processing triggers for menu ...
Processing triggers for man-db ...
Setting up libecj-java (3.5.1-3) ...
Setting up libitext-java (2.1.7-2) ...
Setting up libjlibeps-java (0.1+2-1) ...
Setting up umlet (10.4-1) ...
Processing triggers for menu ...

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/