Is there any tool to describe program algorithm in flowchart and generate code from the chart?

Discussion in 'Java' started by david ullua, Feb 1, 2007.

  1. david ullua

    david ullua Guest

    Hello, everyone, Is there any tools which we can drawl program
    algorithms in flowchart?

    In programming, we conceive an algorithm and describe it clearly in
    document. and then implement it by programming language, like java, c/c
    ++. we pay double the times in describing the algorithm, one is when
    designing, second is when coding. My idea is to do it in one step,
    just express the algorithm in flowchart, then generate codes from the

    If it hasn't been clear, let me explain the case in more detail. like
    the algorithm for mistyped keyword suggesting:
    background: use may mistyped keyword in doing search on search engine
    site, ( as , )
    PronounceDict, is our pronounciation dictionary which maps
    pronounciation to a list of keywords.

    * 1. find keyword in search dictionary, if exist, return empty, else -
    * 2. find suggest keyword by pronounce/soundex: <br>
    * get the keyword's pronounce, <br>
    * find pronounce in PronounceDict, <br>
    * if found return keywords list in the PronounceDict for the <br>
    * keyword's pronounce. else -> 3 <br><br>
    * 3. get the soundex, find the soundex for soundex dictionary, <br>
    * if found, return keywords list in the SoundexDict for the
    keyword's soundex.<br>
    * else return empty.

    It is just an outline of the algorithm. there maybe some if, while ,
    and sequential structure of the algorithm. We can draw the total
    algorithm process in microsoft visio or openoffice draw.

    The problem is how we can convert these algorithm flowchart to code?
    Any tools can do the work?

    If can generate flowchart from code, it would be better.
    Any comments are appreciated.
    david ullua, Feb 1, 2007
    1. Advertisements

  2. I think you should make that the study of your
    PhD thesis in AI.

    Andrew T.
    Andrew Thompson, Feb 1, 2007
    1. Advertisements

  3. david ullua

    david ullua Guest

    Thanks, Andrew,
    The idea is to express complicated algorithms in flowchart. I think
    it can be done.
    Have found jgrasp, jGRASP can produce Control Structure Diagrams
    (CSDs) for Java, C, C++, Objective-C, Ada, and VHDL. but not
    flowchart. not mention the function to generate code from flowchart.
    david ullua, Feb 1, 2007
  4. david ullua

    Chris Uppal Guest

    I don't know if any currently available general-purpose tools like that. Some
    UML editors generate code, and I think there are also special-purpose visual
    editors for various flowchart-like applications.

    Many years ago, I wrote something very similar myself (it actually generated
    Simula/DEMOS code for discrete-event simulations from flowchart-like "Activity
    Diagrams"). It's pretty trivial to do if you can build on a suitable package
    for doing the graphics and user-interaction -- something that understands
    networks of typed nodes and links and their associated data. The problem is
    that the result is /insufferably/ tedious to use. It's a lot easier just to
    type the program in as text...

    I should mention that few people these days would agree that the best way to
    write a program is to create an exhaustively detailed flowchart before starting
    to code. Few people use flowcharts at all for programming design (they are
    used to specify somewhat related things like workflow, or flow through a user
    interface, but not the way the program itself is written). Indeed not many
    people would agree that exhaustively detailed design should be completed before
    coding begins. (Design happens, of course, and sometimes people choose to draw
    diagrams too, but it doesn't have to be complete, and it certainly doesn't have
    to be detailed, before you start programming.)

    -- chris
    Chris Uppal, Feb 2, 2007
  5. david ullua

    Daniel Pitts Guest

    Funny that you should bring it up, I was thinking about something
    similar to this on my morning commute.

    My thought was a little more complex, but also more complete.

    You can think of every aspect of a Programs design as an object. The
    Class object, the Method object, the statement object, etc...

    What I was thinking, most of what learning a programming language
    involves is learning how to create and manipulate these objects in a
    text-based manor. in java, to create a Class object (not to be
    confused with java.lang.Class), you have to type "class ClassName {}"

    It might be possible to represent all of these objects in a less
    textual and more graphical way. You would also be able to manipulate
    these graphical representations in a more intuitive way than, say, cut-
    and-paste. An IDE based around this could provide a very powerful set
    of refactoring capabilities.

    Well, thats the thought I had.
    Daniel Pitts, Feb 2, 2007
  6. david ullua

    david ullua Guest

    Chris, Thanks for your suggest of mapping it to a network.
    also your comment is very reasonable, maybe I am too laaaazy,
    I hope don't need to code, just draw some charts, and things would
    begin to work. In my memorization of electronic experiment class, we
    just draw a flowchart of electronic circuit, and click the mouse, then
    the machine runs by the logic of the flowchart. Also, in FinalBuilder,
    we can drag and drop icons to compose a flowchart, though it is rather
    david ullua, Feb 5, 2007
  7. david ullua

    david ullua Guest

    Hi, Daniel, it is a funny question :) Thanks for your great idea. It
    is just a presentation different between text and graphic, If we can
    decompose the problem into different aspects, and implement them in a
    graphic way, then maybe it would be solved.
    david ullua, Feb 5, 2007
  8. david ullua

    Chris Uppal Guest

    You are working yourself towards Smalltalk ;-)

    (Though no Smalltalk IDE I know of puts /heavy/ emphasis on graphical-style
    manipulation of code entities, those entities are "real" objects in the running
    IDE. Not the code /for/ a class, but the class itself. Not the code /of/ a
    method, but the method itself (methods /have/ source code, rather than /are/
    source code. If you think of the IDE's concrete GUI as an MVP/MVC-style view
    of the underlying objects (which is technically correct) then the choice of
    view(s) is just a matter of what seems most convenient. E.g. in Dolphin, I
    usually more classes around the class hierarchy by drag and drop since that's
    (to me) the most convenient way to interact with them. Other people may
    usually prefer to do it by changing typing in a replacement for (part of) the
    class definition. On other occasions, it may be better to execute code that
    /tells/ the classes to move themselves around. Live objects...)

    -- chris
    Chris Uppal, Feb 5, 2007
  9. david ullua

    Chris Uppal Guest

    That's a good thing in a programmer (seriously!).

    Yup, that's the lazy programmer's attitude all right -- "why should /I/ work
    when the computer can do it for me?". Hold that thought ;-)

    -- chris
    Chris Uppal, Feb 5, 2007
  10. david ullua

    Stefan Ram Guest

    In Java, the source code of a method is the »method
    declaration«, so it is also not the same as the method proper.
    Stefan Ram, Feb 5, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.