Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming

Ask Slashdot: Is There a Way To Write Working Code By Drawing Flow Charts? 264

Slashdot reader dryriver writes: There appear to be two main ways to write code today. One is with text-based languages ranging from BASIC to Python to C++. The other is to use a flow-based or dataflow programming-based visual programming language where you connect boxes or nodes with lines. What I have never (personally) come across is a way to program by drawing classical vertical (top to bottom) flow charts. Is there a programming environment that lets you do this...?

There are software tools that can turn, say, C code into a visual flow chart representation of said C code. Is there any way to do the opposite -- draw a flowchart, and have that flowchart turn into working C code?

Leave your best answers in the comments.
This discussion has been archived. No new comments can be posted.

Ask Slashdot: Is There a Way To Write Working Code By Drawing Flow Charts?

Comments Filter:
  • Is this a joke? (Score:2, Insightful)

    I probably still have my flowchart template from Introduction to Computers in 1993. Used it for that one class and never used it again. Not even when I later went back to school to learn computer programming a decade later.
    • by Giant Electronic Bra ( 1229876 ) on Sunday June 04, 2017 @12:54AM (#54544639)

      I mean, we have had UML now for going on 15 years. You can CERTAINLY generate code and other artifacts from some types of UML diagrams. None of these is all that much like a flowchart, and frankly flowcharts are essentially dead AFAIK. They really only ever worked well, if they ever did, on fairly straightforward procedural code. Back in the bad old days before Structured Programming and then OOP it wasn't all that uncommon to see people using them, but that was mainly because even fairly straightforward linear code was hard to understand when it was written in FORTRAN or COBOL. Such charts have little relevance in modern OO/functional coding where linear control flow is really not an issue.

      • by Z00L00K ( 682162 ) on Sunday June 04, 2017 @01:07AM (#54544675) Homepage Journal

        Simulink is a variation of flowchart programming, but maintainability is hard when it comes to flowchart programming. You need a football field or two to try to make sense of it and any large system will have cross-dependency graphs that are extremely hard to follow.

        • Everything is hard when you have limited experience.
      • by jellomizer ( 103300 ) on Sunday June 04, 2017 @08:01AM (#54545401)

        UML and other Flowcharting method are better on paper. But rarely can scale to a full application.
        1. They are based on the idea that the business owners know what they want. UML and flowchart are based on the idea if you have enough meetings and talk to the right people that you will get all the info needed. This isn't true. What they say they want vs what they need are actually very different.
        2. Like objects often will evolve into two different species. UML wants to make a Person class that can be inherited into Users, customers, execs, administrators... however as time goes on under real use you may find that you may have users who are just another program or dealing with customers who are business which has data elements that just don't fit in the model of a person. This makes either bad data entry to get it to work. Or crazy workarounds.
        3. UML and flowchart are about understanding the info not building it. That one box that says save data could be a complex piece of code, factoring in silly things like security performance and the face that this data is being used by many people at the same time. Building a flowchart for all parts will just be more cumbersome and make the process way too officiated.

        They are flowchart and UML based converts and languages. But they are marketed as workflow management systems, which are fine and good for what they are. But don't expect these to be on the top programming language board. As they are usually under tight controls of the consulting companies and the development companies.

    • by Nutria ( 679911 )

      I probably still have my flowchart template from Introduction to Computers in 1993

      They had me do it in 1983, and I know that flowcharts were around in 1963...

      I also remember 4GL flow chart code generators in the mid-1980s, and their promise of "programs without paying programmers". What a joke that was.

    • by Roger W Moore ( 538166 ) on Sunday June 04, 2017 @02:10AM (#54544843) Journal
      It's no joke. LEGO Mindstorms comes with a graphical flowchart-like language using LabVIEW to write programs. Of course, the system is hideously slow and inefficient compared to text and with EV3 the brick runs Linux so you can easily dump it for Python, C++ or whatever you like.

      LabVIEW itself is also used for instrumental programming in some labs although I expect it is rather slow so its applications will be somewhat limited. I've never used it myself in particle physics but I believe some of my condensed matter colleagues use it as a slow control system for commercial instruments.
      • by sjames ( 1099 )

        It's not a joke but it is EXTREMELY limited. So much so that I'm not convinced it can ever be used for anything but programs just slightly more complex than hello world.

        Sometimes, that may be good enough for example, LabVIEW for handling tabletop experiments.

        • With limited power comes limited opportunity to screw things up. "programming" by bolting together functional blocks with lines are the preferred ways of programming safety systems for this reason, and the IEC standards put very different requirements on programs written this way compared to those written in freeform code.

        • Re: (Score:2, Informative)

          by Anonymous Coward

          LabVIEW has it's faults, but "limited" is not one of them.It is currently used to control the LHC at CERN, SpaceX uses it for its rocket launches, and it is in use by several companies for 5G wireless standards research. LabVIEW can be used in everything from simple data acquisition and instrument control, to motion and vision control systems, to HIL and simulation testing, to FPGA programing, and to testing MIMO communications systems. I have even seen LabVIEW FPGA used to program a National Instruments bo

      • by dbIII ( 701233 )
        Yes, but it doesn't scale.
        In LabVIEW you get stuff crossing over and under all over the place unless you decide to have the complete opposite of a modular approach and end up with a time consuming verbose thing.
        The choice for anything other than an utterly trivial project is too complex for another to understand easily or too much code for them to bother looking at it.
        IMHO it's a teaching tool gone wrong. I think it's supposed to inspire people to go up to the next step and think of large modules the way t
      • Yes it is great for controlling instruments. It's not really slow per se. It really depends what you are trying to do. The biggest issue is it is very easy to write a mess with anything half complicated. But these same PhD's write FORTRAN and Matlab code with zero functions too.

      • by Megane ( 129182 )
        The worst thing about labview is that it's basically impossible to use source code control with it. That's fine for throwaway toy programs, but not for anything that has to be maintained.
    • Someone is posting as you, with very closely spelled names, and 4980000+ uid's

      • Someone is posting as you, with very closely spelled names, and 4980000+ uid's

        creimer apparently has a troll that is up in the middle of the night. I get up earlier than most of Slashdot in spite of being on the left coast and I have been seeing his trolls in low-comment-volume stories in the mornings. By midday they tend to be buried in higher-value comments, because his troll is not very good.

        • [...] his troll is not very good.

          My troll is an asshat turned n00b who can post only so many comments before the mods down vote them into oblivion and the account gets restricted to two comments per day. This troll has three accounts that I'm aware of.

      • Someone is posting as you, with very closely spelled names, and 4980000+ uid's

        Casey Neistat has a video that defined success as people wanting to be like you. I'm not surprise that someone wants to post like me on Slashdot.

        https://www.youtube.com/watch?v=3iQ8BGw13So [youtube.com]

    • Re:Is this a joke? (Score:5, Interesting)

      by Dutch Gun ( 899105 ) on Sunday June 04, 2017 @06:16AM (#54545221)

      Yes, you absolutely can write code using flowcharts, and I've got two practical examples from my career in videogames. Obviously, both were in specialized sub-domains, as the bulk of our general work is in C++.

      First example: I worked at a place that allowed artists to wire up nodes in Maya using a circuit-like logic system. For input, they'd use timers, triggers, environmental sources (time of day), etc. Then they'd connect those inputs to various logic gate nodes (AND, OR, math, branching, delays, etc), and then to various output nodes that would affect the game world in various ways, such as triggering animations, environments, music/sound effects, and so on. This gave artists an incredible amount of power to shape the world if they were clever enough with their wiring skills, and all without programmer support. It was telling, though, that we eventually added a "Lua Script" node, because sometimes complex logic is really hard to do with circuit-type wiring.

      Second example: In widespread use today, many game developers generate HLSL shader code using visual tools. Again, the same sort of logical wiring occurs. The connections represents an RGBA color source, or maybe a vector, while the nodes represent methods to transform that data. To blend two color sources together, for example, you pick a particular blending operation node, then just visually connect the sources and output. The visual programming paradigm means that technical artists can use this system rather than programmers, allowing them to tune their materials exactly how they'd like.

      This sort of visual programming works really well when dealing with data flow in a fairly constrained environment. Other real-world examples include creation of sophisticated virtual musical instruments using visual programming techniques. Native Instruments has some products that work this way, like Reaktor. Example: https://www.native-instruments... [native-instruments.com]

      • Re:Is this a joke? (Score:5, Interesting)

        by K. S. Kyosuke ( 729550 ) on Sunday June 04, 2017 @07:53AM (#54545359)

        It was telling, though, that we eventually added a "Lua Script" node, because sometimes complex logic is really hard to do with circuit-type wiring.

        There's a nice quote by Alan Perlis: "A picture is worth 10K words - but only those to describe the picture. Hardly any sets of 10K words can be adequately described with pictures."

    • Perhaps... From the hacker test... http://www.mit.edu/people/mjbauer/Purity/hackpure.html

      00B4 Do you have a flowchart template?
      00B5 ... Is it unused?

    • Why would that be a joke? We live in an age where AI software is coding AI software. Why would a less-automated system be outlandish?

      • Why would a less-automated system be outlandish?

        Because every decade we get something that promises to remove the programmer from creating the program, allowing corporations to save a ton of money or the layman to create programs at the press of a button. Those efforts never finds widespread appeal.

    • The idea of taking a graphical app design and converting it automatically to code goes back a long, long ways. It was supposed to eliminate the need for programmers.

      Variations on this include decision-table based code generators and other similar things - it was just flowcharts. In one sense, Apple's HyperCard also was a player in that space.

      It has never worked. As with every other automated code-generation system and 4GL that was supposed to render programmers obsolete, getting a flashy demo start-up app w

  • by Anonymous Coward on Sunday June 04, 2017 @12:57AM (#54544651)

    Plus Simulink coder.

  • Google Scratch. 2.0 makes it turing-complete but it's not exactly API compatible
  • by roskakori ( 447739 ) on Sunday June 04, 2017 @01:00AM (#54544659)
    Scratch [mit.edu] uses an approach similar to flow charts. If you're not to picky about the notation, it might be what you are looking for.
  • Why? Even if it could technically be done, it's probably not good code from a human-readability standpoint and will have to be heavily reworked, such as variable re-naming, splitting into functions/modules, etc.

    • That depends on the flow chart language you use. The DRAKON [wikipedia.org] language was designed to create extremely easy-to-read and highly modular flow charts.

  • by AHuxley ( 892839 ) on Sunday June 04, 2017 @01:07AM (#54544671) Journal
    Look at the US educational products that let users do things with a gui and even a robot kit.
    They often have a very simple gui system of getting input and presenting an output.
    I am not sure how much of the US educational product would allow for options other than following a set course structure.
    Often used so the whole class in a US educational setting can feel they are been educated about computers.
    A slow pace of education, not much maths, all about the gui and getting something done in a short time.
    Of historical interest might be some aspects of a card in Hypercard https://en.wikipedia.org/wiki/... [wikipedia.org] from Apple.

    Most people who are smart find some programming language they can use e.g. Basic, Ada, Pascal or something Apple, todays apps or Windows supports.
    People who are not smart then just use what other people create for them.
    If a person needs C, take the time to learn C. If a person can present a flow chart, work with a smart person to turn that into C.

    If this is a marketing test to see what exists and what is needed, consider the many marketing lessons of Hypercard. What it did, what was done with it and why people now just use the maths and code for their Apple, MS or app needs.
    Circuit board design tools might be a starting point to replace the circuit board part with more of a gui, chart feel.
  • There's a reason people don't .... It's terrible. LabView is a mess, and AmigaVISION was charming ... 25 years ago.

  • by Dialecticus ( 1433989 ) on Sunday June 04, 2017 @01:12AM (#54544689)
    My favorite is called Automate by LlamaLab. [llamalab.com]
  • by Anonymous Coward
  • They're not flow-charts, but the PureData [puredata.info] programming language is provides executable diagrams. Pure Data (or just 'Pd') is an open source visual programming language for multimedia. Its main distribution (aka 'Pd Vanilla') is developed by Miller Puckette. Pd-L2ork/Purr-Data is an alternative distribution (originally based on the now unmaintained Pd-Extended project), with a revamped GUI and many included external libraries.
    • by mkendall ( 69179 )

      I think pd, like LabVIEW, primarily shows the flow of data, not execution. They are data-flow diagrams, not flow charts in the traditional sense.

  • Time marches on (Score:5, Insightful)

    by Waffle Iron ( 339739 ) on Sunday June 04, 2017 @01:33AM (#54544741)

    When I was first taught to code in FORTRAN, we were told that we really needed to create a flow chart detailing every statement before writing any code. We also needed to start every line in column 8, and variable types were determined by the first letter of their name.

    Those days are long gone, and we now have languages with features that allow us to directly transcribe our ideas without intermediate formats (yes, LISP always allowed that from day 1, yada yada).

    I find that flow charts still have some usefulness on occasion, but only as a high-level planning tool. I will sometimes write up a flow chart with a dozen boxes to define the rough flow of a complex algorithm, but it might take a thousand lines of code to actually complete the final implementation. A flow chart that had enough detail to mechanically translate to code would look like an incomprehensible pile of spaghetti; not very useful compared to well-formated code.

    • When I was first taught to code in FORTRAN, we were told that we really needed to create a flow chart detailing every statement before writing any code. We also needed to start every line in column 8, and variable types were determined by the first letter of their name.

      1) They said that, but no one I knew actually did it.

      2) Column 7, not 8.

      • Well, it seems that decades of controversy over 4 vs 8 spaces for indents has completely overridden my memory on that point.

        • It's possible I was just a bad coder, but it was not particularly uncommon for at least one line in my Fortran programs to need more than 65 characters. So I got really familiar with columns 6 and 7.

          For those who aren't old - column 6 was used as a continuation flag. If there was something in column six, what followed was a continuation of the previous line. I *think* the convention was to use numbers in there which basically indicated how many lines that particular statement used.

      • When I was first taught to code in FORTRAN, we were told that we really needed to create a flow chart detailing every statement before writing any code. We also needed to start every line in column 8, and variable types were determined by the first letter of their name.

        1) They said that, but no one I knew actually did it.

        Well there was that first programming assignment in CS 101 Introduction to Computer Science where one did a flow chart (neatly using a plastic template), then wrote (as in pencil on paper) code on a Fortran Coding Form (graph paper like showing the important columns), and then after manually stepping through the code (simulating it) to debug it one typed the code on the punch card machine, submitted the punched card deck, and waited for a printout to be delivered to see if it compiled and ran and generated

    • by dbIII ( 701233 )
      Yes, it's a teaching tool.
      You only use those methods when they kount :)
    • by Nutria ( 679911 )

      When I was first taught to code in FORTRAN, we were told that we really needed to create a flow chart detailing every statement before writing any code.

      Well, flowcharts are useful -- damned useful, in fact -- when you have to type punch cards!

      Those days are long gone, and we now have languages with features that allow us to directly transcribe our ideas without intermediate formats

      Because of languages which developed at the same time that VDTs became common.

    • by sootman ( 158191 )

      > When I was first taught to code in FORTRAN, we were
      > told that we really needed to create a flow chart detailing
      > every statement before writing any code.

      My dad started programming in the late 60s. Back then, programmer time was cheap and machine time was expensive. :-)

      (Also, punch cards had a bit of latency compared to today's save-build-run.)

  • Does anyone know of a tool that will allow me to write a novel by scribbling with crayons in a coloring book?

  • All higher level logic ends up having side effects, just in order to be convenient, and relevant the way we use analogies/language.

    You'd end up with even bigger problems with flow charts, because the labels you'd add would end up confounding your expectations as you build more and more.

    The only way to avoid that is using very simple concepts in your flow chart. At that points, you're just creating circuits, which are not just below regular code, but below even assembly code in terms of the layers of abstra

    • by gtall ( 79522 )

      To some extent, what you say might be true. But I am not convinced that it is theoretically impossible to have a decent graphical language that does have higher order logical concepts. I don't believe functional programmers care or have the necessary subtlety in their thinking to accept diagrams for their stuff. That also one of the hurdles they have in pushing their religion. In a somewhat heretical book, Graham Hutton's Programming in Haskell does resort to diagrams to get his points across.

      Marten (used t

  • Flow charts are no more expensive than code. They just layer a visual syntax on top of the underlying forms instead of a textual syntax.

    You should be asking for tools to command the underlying forms that don't require you to input all the syntax; tools where you can describe how you want something to work in broader terms and let the software write the syntax, handle the scheduling optimization, prevent the bugs and security holes, and make sure all the corner cases and failure modes are covered.

    Where's th

    • by Kohath ( 38547 )

      Also needed: an autocorrect that won't change "expressive" into "expensive".

    • I might be a PHB and all, but visual expression is much easier for me to follow than code; done properly, it can quickly help me see the parts of interest at a point in time, and ignore the rest.

      That said, flowcharts are only effective in that end for a small set of conditionals.

      Can't we just stick to ladder logic diagrams?
  • by mnemotronic ( 586021 ) <mnemotronic@noSpaM.gmail.com> on Sunday June 04, 2017 @02:03AM (#54544825) Homepage Journal
    I'm a visually oriented person. For big-picture I can digest flowcharts and data diagrams easier than textual representations. I routinely use Visio. In the MSDOS days I used Interactive EasyFlow from HavenTree of Canada [wikipedia.org]. The copyright notice / license agreement was worth the price of admission.
  • by romiz ( 757548 )
    A critical requirement when programming is the ability to compare different versions of the same code. This is quite easy to do with text. With diagrams, it becomes much harder to do.
  • by TuringTest ( 533084 ) on Sunday June 04, 2017 @03:01AM (#54544941) Journal

    The open source DRAKON Editor [sourceforge.net] allows you to draw classic flow charts and generate template code in various target languages that follow the defined flow.

    It comes with the additional advantage of having been engineered around ergonomic practices, which makes it avoid the classic pitfalls of using flow charts. A flow diagram typically becomes a tangled mess, but DRAKON layout guidelines provide a structure to build diagrams in any scale.

    The DRAKON [wikipedia.org] language was created by people in the Russian space program as a way to avoid errors in defined procedures, and it was crafted and refined following the Russian school of Human-computer interaction. The flow diagrams built following their easy-to-learn layout guidelines are the most easy to read that I've ever seen.

  • First of all, Unreal Engine's blueprint system is quite excellent, but is also specific to its domain of being a game engine. But you can make your own blueprint modules in C++, so no reason you couldn't make boring business software with it.

    But there's already a great tool for boring business workflow, and that's BPMN. I've recently discovered it and it's so much better than endless meetings where no one knows or can agree about what is fully going on. I only have experience using it to model software at a

  • There is a Developper engine called "Flowcode" which allows to do programs for microcontrollers (PIC, AVR, ARM) using flowcharts. It's quite expensive (given that PIC/AVR dev tools are free).

    Basically, you've some "macro" blocks for more high level functions (like displaying on an LCD screen), rest is flowcharts.

  • Early in my career, 1992 onwards, I made multimedia (when that was still a cool new thing!) training and presentations in Macromedia Authorware which largely followed a flowchart metaphor - the idea being that it would help non-programmer content specialists to make multimedia training. There was some bigger power under the hood since you could add pascal like scripts to the icons. Very unfortunately the scripting language didn't support functions and procedures, you had to go to the icons flow for that.
    Sti
  • Yes there is. It's called CASE* and/or BPM* and/or DMI*. (Computer Aided System Engineering / Business Process Modelling / Direct Manipulation Interface).

    The Problem with many of these Systems is that writing code often is quicker and easyer. There are special scenarios where the tool mentioned above can be used and are extremely effective (well-built cleanroom ERP setups, cleanroom UI toolkits (end-to-end Visual Basic (guess why it's called visual), Glade, QTCreator, JBoss BPM, Flash IDE, Squeak, etc.). Sy

  • by allo ( 1728082 )

    When you finally have the language, you will realize that the hard part is not the syntax, but the logic. And that dragging boxes is way slower than writing keywords.

    • And the logic is easy to describe with graphics :D

      Anyway, drawing flow charts and converting them to code is out of fashion because now we have super power full IDEs.

      If you had only a lame text editor, it would be a challenge to write code instead of drawing a flow chart.

  • This stuff has been around since the 1990s if not before. I didn't use it but around that time some of the guys in my office used Excelerator. They didn't like it much.

    Clarification: are you asking if something does it, or if something does it better than a monkey could code it longhand?

  • Only for the last 30 years. And far more complex items than simple logic, fiendishly complex systems can be quickly generated from controls block diagrams using packages like SIMULINK, Many times, its too fiendishly complex to use in an end-item but certainly for simuations it can be very effective, It also has endless frustrating bugs, but that's not inherent in the concept.

  • It's a drag and drop environment with lots of options and the more software installed, the more options. So, that technically means you can't make an "automation" without hoping that the other person has the same applications. But, as long as you use what comes with a Mac by default, you'd be alright. Xcode developed software can be all drag and drop. There are some other "drag and drop" related software that are game engine related like Game Maker (Game Editor for open source clone), Unity3D, and Unreal En
  • Agilent VEE is pretty close to top-down flow charts. I've used it for years. Mainly used for test and measurement like Labview
  • by NetFusion ( 86828 ) on Sunday June 04, 2017 @09:28AM (#54545643)

    There are quite a few JBoss based tools that will let you do this and then auto deploy the app on tomcat etc

    https://tools.jboss.org/featur... [jboss.org]
    https://tools.jboss.org/featur... [jboss.org]
    https://tools.jboss.org/featur... [jboss.org]
    https://tools.jboss.org/featur... [jboss.org]
    https://tools.jboss.org/featur... [jboss.org]
    etc

    I use JBoss rules visual flowcharts editors for tweaking and testing a prek-12 vaccine compliance engine.

  • I think scratch is a flow chart-y language. Certainly is colorful.

    Of course, I wouldn't do anything serious in it. It's just a nice way to introduce a pre-teen to flow control and language basics.

  • by laughingskeptic ( 1004414 ) on Sunday June 04, 2017 @10:44AM (#54545933)
    There are many flow chart based Business Process Execution Language (BPEL) coding environments, including multiple open source options: http://orchestra.ow2.org/xwiki... [ow2.org] , https://eclipse.org/bpel/ [eclipse.org] .
  • It meant "Software Through Pictures" but we knew it affectionately as "Software Through Pain"
    https://en.wikipedia.org/wiki/... [wikipedia.org]

  • A lazy manager's dream; Disneyfication of complex stuff and let minions graft away.

    Visual programming works well until tedious stuff like exception handling and complex transaction processing kick in.

    Once I observed a well spoken, nice and bright guy implementing a relatively easy web service in something called TadeXpress. Every issue that could have come up did. Performance, exception handling, inability to easily link to stuff I wrote. Eventually TadeXpress was kicked out and good old programming wa

  • If you can't visualize the code, you can't write it. I don't care how you see it, but you must see it.

    • eh, exactly what visual things do you imagine? I don't visualize anything when coding.

      • I think the parent is assuming all people think the same way which doesn't appear to be true, at least based on my own personal discussions with others about how they think.

        Having acknowledged that, I will say that I do visualize when coding/problem solving, I can "see" things that represent the structure of data/objects and flow. What I can't say is whether that is just a side effect of how my brain works, or whether it is actually a mechanism that is adding value.
        • by Bengie ( 1121981 )
          People with strong abstract reasoning make use of nearly all parts of their brain at the same time and the different parts are more highly connected to each other that people with lower abstract reasoning. It was difficult to see this with older brain scans because high levels of abstract reasoning cause larger neural-activity bursts but of shorter duration. One of the first parts of the brain to connect to the frontal lobe is the visual cortex. It is not far fetched to think that people visualizing logica
  • Granted that was twenty some years ago, granted, but it was enough to give me insight into the concept.

    Basically, it sucks.

    A picture may be worth a thousand words, but that doesn't make pictures a substitute for language, as anyone who's tried to deal with a stroke victim will attest. Flow charts may have their uses, particularly to describe complex and somewhat arbitrarily constructed processes, but they're a lousy way to describe algorithms and calculations. That's why most people don't use them anymore

  • How do you think kids learn programming these days.

  • I would note that both of those are interfaces to Smalltalk, though it's not clear to me that they need to be.

    OTOH, I remember back long ago trying to program in Prograf, and there was an MSWind database system that was also programmed only graphically. YUCK!!! It wasn't that the logic was any harder, it was that you couldn't see nearly enough of the program to write anything sensible. Text can be a lot more compact, so you can see an entire function at once. Graphics takes up hugely more room, so you ca

Love may laugh at locksmiths, but he has a profound respect for money bags. -- Sidney Paternoster, "The Folly of the Wise"

Working...