Forgot your password?
typodupeerror
Programming Education GUI Technology

Ask Slashdot: Why Are We Still Writing Text-Based Code? 876

Posted by timothy
from the because-there-are-only-so-many-lego-in-the-world dept.
First time accepted submitter Rasberry Jello writes "I consider myself someone who 'gets code,' but I'm not a programmer. I enjoy thinking through algorithms and writing basic scripts, but I get bogged down in more complex code. Maybe I lack patience, but really, why are we still writing text based code? Shouldn't there be a simpler, more robust way to translate an algorithm into something a computer can understand? One that's language agnostic and without all the cryptic jargon? It seems we're still only one layer of abstraction from assembly code. Why have graphical code generators that could seemingly open coding to the masses gone nowhere? At a minimum wouldn't that eliminate time dealing with syntax errors? OK Slashdot, stop my incessant questions and tell me what I'm missing." Of interest on this topic, a thoughtful look at some of the ways that visual programming is often talked about.
This discussion has been archived. No new comments can be posted.

Ask Slashdot: Why Are We Still Writing Text-Based Code?

Comments Filter:
  • Lego Mindstorms (Score:5, Interesting)

    by mrbluze (1034940) on Friday February 07, 2014 @09:00PM (#46191741) Journal

    Try Lego Mindstorms and see whether you find it quicker or slower. It's easy to make something simple but once the algorithm gets complicated it is not much easier to decipher than text code, and no faster in my experience. As soon as you want to get serious with the system, you will wish it had a low level system that lets you lay it out in text instead of images.

    This is partly the reason why surviving languages use symbols representing sounds rather than images as the Egyptians used. It's faster to write, and possibly faster to read.

  • Re:Labview (Score:5, Interesting)

    by Garble Snarky (715674) on Friday February 07, 2014 @09:04PM (#46191785)
    I'm stuck on a several-month-long Labview project right now. It's been a terrible experience. I don't know if it's more because of the poorly designed editor, the language itself, or the visual language paradigm. But I'm sure all three of those are part of the problem.
  • by TheloniousToady (3343045) on Friday February 07, 2014 @09:07PM (#46191811)

    One practical example that I know of is Simulink, which can be used to generate code from diagrams. I did some testing years ago on Simulink-generated source code, and the code itself was awful looking but always worked correctly. Not a lot of fun to test when you had to dig into it, though. Also, testing seemed superfluous after never finding any bugs in it. All the bugs we ever found were in the original Simulink diagrams that the humans had drawn.

  • by maple_shaft (1046302) on Friday February 07, 2014 @09:19PM (#46191935)

    There have been a number of attempts at making coding easy enough that non engineering types will be able to conceive their requirements in software then communicate these through a tool, usually in a visual manner and turns this into functional software. This has come in many different forms over the years, Powerbuilder, FoxPro, Scratch, BPEL, etc...

    The fundamental flaw is one of the software development industry, especially when it comes to line of business applications. Analysts writing requirements have been and always have been an inefficient and flawed model as most requirements documents are woefully incomplete and tend to not capture the true breadth of necessary functionality that ends up existing in resultant software. Analysts are business oriented people and they will think about the features and functionality that are most valuable and tend to miss or not waste time on what are deemed as low value or low risk items. Savvy technical folks have needed to pick up the slack and fill in the gaps with non-functional requirements (Architecture) or even understand the business better than the analysts themselves for quality software for the business to even be realized.

    I have seen this song and dance enough. True story, IBM sales reps take some executives to a hockey game, show them a good time, tell them about an awesome product that will empower their (cheap) analysts to visualize their software needs so that you don't need as many (expensive) arrogant software engineers always telling you no and being a huge bummer by bringing up pesky "facts" like priorities and time. So management buys Process Server, snake oil doesn't do it justice, without consulting anybody remotely technical. Time passes, and analysts struggle to be effective with it because it forces them to consider details and fringe cases. Software engineers end up showing them how to use it, at which point it just becomes easier for the software engineer to just do the work instead of holding hands and babying the analysts all day. Now your company is straddled with a sub par product that performs terribly, that developers hate using, that analysts couldn't figure out and that saved the company no money.

  • This view is belied by the graphical tools used to design and layout hardware and chips. Higher level languages in particular are largely based on connecting the data flow between various pre-defined blocks or objects - function libraries.

      I actually built a primitive graphical Pascal pre-processor back in the late 1980s, which used the CMU SPICE circuit board layout program. Since the output of the program was text based, it could be processed into Pascal code. The model I used was that a function was a 'black box' with input and output 'pins', but also could be designed itself in a separate file.

    I never actually finished it, but it was pretty workable as a programming paradigm, and opened up some new ways of looking at programs. For instance, a 3-D structure could be used to visualize formal structure (function calls, etc.) in one axis, data flow in another.

    Also, the Interface Builder for the NeXT machine was more-or-less graphical, IIRC only 2-D. It made for very fast prototyping of a new user interface, and the 'functional' code could be put in later. (I saw a former schoolteacher, who had never used a computer until a few months before, demonstrate creating a basic calculator in Interface Builder in under 15 minutes. It worked, first time.)

    I think the real issue is in large part a chicken-and-egg problem. Since there are no libraries of 'components' that can be easily used, it's a lot of work to build everything yourself. And since there is no well-accepted tool, nobody builds the function libraries.

    Looking at this from a higher level, a complex system diagram is a visualization that could be broken down to smaller components.

    In practice, I believe that the present text-based programming paradigm artificially restricts programming to a much simpler logical structure compared to those commonly accepted and used by EEs. For example, I used to say "structured programming" is essentially restricting your flow chart to what can be drawn in two dimensions with no crossing lines. That's not strictly true, but it is close. Since the late 1970s, I've remarked that software is the only engineering discipline that still depends on prose designs.

  • by Todd Knarr (15451) on Friday February 07, 2014 @09:42PM (#46192133) Homepage

    Actually you can't tell your car to start by turning a key. Turning the key starts a complex series of interactions between the fuel pump, fuel-injection and air intake systems, ignition system and starter motor to get the engine turning over and then to manage disengaging the starter motor and switching from battery to alternator power once the motor's running until you let the key go from Start back to Run. You can ignore all that and talk only in terms of the key being turned if all you want to do is drive the car, but if you need to say diagnose why the car won't start or figure out why it's running rough and has no power you need to delve into the complexity behind just turning the key. You can no longer ignore it and abstract it away. That's the key: not whether it's code or a mechanical system, but the degree of abstraction involved. Most programming languages are seen as complex because they dive below the level of "start the car" and work at the level of "OK, how exactly do I design the drivetrain of the starter motor so it'll rotate the engine crankshaft until the crankshaft starts turning faster than the starter motor is, then automatically and instantly disengage so the engine won't strip the starter motor by trying to turn it faster than it's safe to?" (and that's just one small part of what's needed to make turning the key start the car, and not even the most complicated part).

  • That's still limited (Score:5, Interesting)

    by Anonymous Coward on Friday February 07, 2014 @09:48PM (#46192179)

    to what the programmer of the computer programmer envisioned.

    I think the story OP should learn some Lisp. Seriously. Just to grok it.

    Part of the frustration I had with many programming languages is feeling I was trying to build castles with toothpicks. If I moved the wrong way or wasn't utterly careful, the structure would fall.

    Maybe the OP feels the same way since he is talking about feeling a single level away from assembly.

    Like the most powerful editors (emacs and beyond) requires commandline. That's just how it is. If you want fast to learn, then you absolutely want a pretty GUI and all that nonsense, but a user will hit his head on a low ceiling if he's a fast learner. Because GUIs just don't do anything but the small tasks envisioned to them. OTOH, commandline is hard to learn but a much higher ceiling.

    Put another way, text is abstractions. I say cat, you the reader know roughly what I'm talking about. I didn't have to describe a small furry 4 legged animal. Now if I did a graphical representation of it, I would be limited to the parameters I gave the original cat - fur (there are furless cats like the sphinx), legs (some cats are missing legs), tails (the manx). How would a graphical representation take that into account? Through clunkiness if at all.

    It's kind of like the difference between an alphabet and a logographic system like kanji.

    Kanji seem like an awesome idea at first. You make a picture of the sun, and voila, you have the sun! And then a picture of the moon, and you have that idea. Moonlight? Combine kanji for moon plus kanji for light and you probably have moonlight!

    Awesome right? Yeah it's just fucking great until you realize you have to start making 30 strokes for one word, and that small pics start looking like each other, and that unless you know that very specific kanji, you have no clue how to write it out. And unlike the english alphabet which has 26 letters and once you learn them and combination you can sound out most words, you have to memorize thousands of kanji and even more kanji combinations or you'll get hung up reading highschool level newspapers.

    I view CLI like the alphabet and GUIs inevitably like the alphabet and kanji. One is more awesome than the other in theory but in practice...

  • by satch89450 (186046) on Friday February 07, 2014 @09:51PM (#46192199) Homepage

    I used to write articles for magazines as a full-time job. When I first started using the outliner MORE, I found that the task of writing became much, much easier: I would outline the article, then fill in text for each outline item. When I was finished, I would then export the text and there was my article. It let me design the articles top-down, just as a EE designs a circuit top-down. Moreover, as the article would develop, I could shift things around very easily without having to do massive cut-and-paste exercises.

    Software design? I do that top-down mostly. I design the top level with functions, then fill in the functions. Lather, rinse, repeat as many times as you need to. The result is a piece of software that is highly maintainable.

    One of my biggest complaints about "graphical" programming is that you can't have much on the display -- you end up paging *more* than with a text-based system. It isn't the text that's the problem; its the lack of top-down designing on the part of the human.

    Now, one system that I absolutely loved working with had an IDE (text-based) where you deal in layers. When you click on the function name, the function itself comes up in different windows. I found that paradigm encouraged small, tight functions. Furthermore, the underlying "compiler" would in-line functions that were defined only once automatically. (You could request a function be in-lined in all cases, like in C, if you needed speed over code size.)

  • Re:Lego Mindstorms (Score:4, Interesting)

    by EETech1 (1179269) on Friday February 07, 2014 @09:56PM (#46192231)

    The last place I worked went from hand written C code to using Simulink to generate the (C) code for use in their ECMs.

    The entire engine: airflow model, fuel injection, and emissions system was just a bunch of pretty pictures in Simulink. You can drill down by clicking on the high level diagrams to see the nitty gritty of each process if you so desire.

    It was not nearly as efficient as the hand coded version, but there were far less issues with bugs, and it allowed us to have (many more) math / simulation types coding instead of just a few C gods. There were libraries that Simulink hooked in to that let it configure the hardware, but those were hidden away from the day to day people diagramming code.

    Cheers!

  • by erice (13380) on Friday February 07, 2014 @10:18PM (#46192399) Homepage

    In practice, I believe that the present text-based programming paradigm artificially restricts programming to a much simpler logical structure compared to those commonly accepted and used by EEs. For example, I used to say "structured programming" is essentially restricting your flow chart to what can be drawn in two dimensions with no crossing lines. That's not strictly true, but it is close. Since the late 1970s, I've remarked that software is the only engineering discipline that still depends on prose designs.

    Funny that you should say that. For the last 20 years, the trend in Electrical Engineering is away from graphical entry and toward text based design languages. Hardly anyone designs logic by drawing gates anymore. We use languages like Verilog and VHDL, which look a whole lot like software languages. Even the analog designers make use of Verilog-A or even just Spice, all text based. When it comes down to building a circuit board or analog circuitry on a chip, there is still a manual "compile" step of drawing diagrams and polygons but that is only because the result is ultimately a three dimensional object (well, more lke 2.5D) and it is the only way to be sure you get what you intended. It is not because creating designs graphically is considered convenient.

  • by Megane (129182) on Friday February 07, 2014 @10:54PM (#46192629) Homepage

    Also, just try using source code management (such as svn or git) with graphical programming languages. Even if they save in something sort of text-based (like XML), it's much harder to track and merge changes. And it's impossible when they save code as binary blobs. (LabView, I'm looking at YOU.)

    This is the number one reason why graphical programming languages are dead in the water from the start for any but the smallest toy projects.

  • by skids (119237) on Saturday February 08, 2014 @12:40AM (#46193133) Homepage

    Why write three quick and dirty sentence-fragments on how to do it, when you can record a 10 minute video and post it to YouTube?

    This. And it's getting even worse -- even enterprise grade vendors are starting to do it to document their products while allowing their more formal manuals to languish.

    Anyone who wonders why we still use language instead of pictures really needs to spend some time trying to find information in a manual for a GUI-based application versus finding it for the CLI (or writing the two styles of manual, for that matter.) Yes, learnig to read well and type well takes a lot of practice. It is also worth every second.

  • Re:It's been done (Score:4, Interesting)

    by tlhIngan (30335) <slashdot@wor f . n et> on Saturday February 08, 2014 @03:12AM (#46193631)

    Why are we still writing books using text (for the most part)? Doing it with pictures or other methods is frequently not clear enough even for fiction. Text is concise, or at least more-so than other methods.

    Well, perhaps why are we still using text-only to code?

    I mean, the thing is, books are mostly text, but there are also illustrations (photos, artwork, graphs, charts, etc) that help enhance the content in the book.

    A picture is worth 1000 words does happen quite a bit, and it shows how one picture can remove a ton of wordy description in both clarity, conciesness and ease of expression.

    Heck, we can start with basic charts and tables - when you need to consult a chart or table, why do we have to literally code them in? Can't we just say "this is a chart with input X and output(s) y". and just include it, and the compiler automatically generates the code to handle looking up data? Same with a table of data - you put it in the code as a table, the computer figures it out and may even offer interpolation.

    Now you have source code where the chart is easy to understand and the amount of written code is less because the compiler generates the actual translations and encoding of the table.

You can tell how far we have to go, when FORTRAN is the language of supercomputers. -- Steven Feiner

Working...