Visual coding

Posted:
in macOS edited January 2014
I know that with Tiger not even close to get released, it's a little early to start debating about future cool new features for Mac OS X, but still, here is something that looks like a killer feature for a future release of Mac OS X : visual coding.



Let me explain : a couple weeks ago, I had to create thumbnails for a website. 1500 thumbnails. Sounds easy, you say : just make a Photoshop script and voilÃ*, everything's ok! Sure... but those thumbnails were not just *usual* thumbnails in that they consisted in taking a random 80x80 pixels square from a 320x240 image.

Nothing to do this in Photoshop, except doing it on your own. But 1500 images! No way!

So what did I do? Coded a simple C program to do the stuff all at once. And it worked pretty fine.



Now ok, I know how to write C code, compile it and all. But what about the *average* user who doesn't even what is gcc or X11? He would have had to create the thumbnails one after another... and that's just a shame.

Then I saw Automator and thought : damn, would be HUGE if the same thing could be done for actual programming and not only scripting, allowing every kind of users to create small apps to do what they need, without writing a line of code, just like Golive does with HTML...



On the paper, it almost seems simple. Just need to take the example of the WYSIWYG HTML editors : build a comprehensive semantics for the program, that can be transformed in C (or C++ or JAVA or Objective C) code (for pre-compiling the app) but that's simple enough to be understood by the user and linked to some graphical metaphore.

For example, the semantics may define objects, actions on these objects, attributes of the object, relevant loops and conditions for the object, etc...



The source code for a program for inverting the colors of an image would then be (for example) :

open (type="image" name="img" open="dialogbox" format="any")

beginloop (type="everypixel" name="pixelloop")

value (object="img" attribute="currentpixel") = maxvalue (type="pixel") - value (object="img" attribute="currentpixel")

endloop (name="pixelloop")

save (format="same" location="same")



Of course you'd be able to create this code only with your mouse, via a nice GUI, and you'd be able to add user interface for your app, a la Interface Builder.



My question is : to what extent such a feature is feasible? Would you like it if it was released?

Comments

  • Reply 1 of 11
    bigbluebigblue Posts: 341member
    I would like it, but have only one objection: one of the main reasons there's so many virii on the Wintel camp are visual coders (a la Visual Basic). So this program your proposing should have some restrictions build in to avoid such malpractice. Wich on itself will limit it's possiblities somewhat ...
  • Reply 2 of 11
    johnqjohnq Posts: 2,763member
    AppleScript? Many things are possible with AppleScript. More to come assuming Tiger's AppleScript will have hooks into Core Image.



    PHP using GD lib? (I made some scripts which I trigger from a webpage running locally. Things like thumbnails, watermarks, timestamps, WANTED/CAPTURED stamps (police), etc.etc.



    Plethora of options already. No C required.



    Could even use RealBasic, that does a ton.



    Graphic Converter is good for certain automation tasks too.
  • Reply 3 of 11
    Quote:

    Originally posted by BigBlue

    I would like it, but have only one objection: one of the main reasons there's so many virii on the Wintel camp are visual coders (a la Visual Basic). So this program your proposing should have some restrictions build in to avoid such malpractice. Wich on itself will limit it's possiblities somewhat ...



    I'm not sure... I'd compare Visual Basic to Applescript, the difference being that there are fewer security holes in Mac OS X than Windows XP.

    Here, it would be like a VISUAL C++ (really visual, I mean, not the same kind of "Visual" as MS's one), the code would be compiled and everything, and that would produce the very same Mach-O file as the one you'd have created by writing the code manually (except for optimizations). Programming a virus is more like finding a security hole, figuring out a way to use it, and then, code the virus. So the process to code a virus would more or less be the same with both methods (except maybe, it would be easier to write the actual code, which I don't think is the most complicated part of the process... though I confess I've never tried writing a virus...!)
  • Reply 4 of 11
    Quote:

    Originally posted by johnq

    AppleScript? Many things are possible with AppleScript. More to come assuming Tiger's AppleScript will have hooks into Core Image.



    PHP using GD lib? (I made some scripts which I trigger from a webpage running locally. Things like thumbnails, watermarks, timestamps, WANTED/CAPTURED stamps (police), etc.etc.



    Plethora of options already. No C required.



    Could even use RealBasic, that does a ton.



    Graphic Converter is good for certain automation tasks too.




    Not PHP, not RealBasic. Imagine an even higher-level thing : no need to write a single line of code! Basically, at first, this could look like Automator with hooks to all the APIs of the OS, and then evolve into a real visual IDE, instead of an evolved workflow builder. Well, don't know if I'm very clear, but that's what I foresee as the future of Automator.
  • Reply 5 of 11
    johnqjohnq Posts: 2,763member
    Ahh, ok yes, I see now. Right, hopefully the preview we saw of the test app is a harbinger of really nice things to come for graphics/video production workflow. Hell they look 90% there, just need to organize it into not-all-in-one-popup-menu
  • Reply 6 of 11
    kickahakickaha Posts: 8,760member
    Oddly enough, my advisor and I were discussing this just yesterday. See, my research into software architectures has led to a neat possibility I call 'concept-oriented programming'. It uses the language of design patterns to construct the architecture for a software system without you having to write a single line of code. What you're talking about, building algorithmic entities through visual selection of pre-defined elements is a perfect complement, and has roots in fragment theory.
  • Reply 7 of 11
    ast3r3xast3r3x Posts: 5,012member
    I know this isn't what you are talking about...but PHP would be so easy to do this. Would probably be easily under 50 lines of code.
  • Reply 8 of 11
    xoolxool Posts: 2,460member
    I built a Fortran editor for an aging physicist that included GUI buttons that wrote Fortran code automatically. He could still edit the code and make changes, but for laying out a program, dealing with indentation, and automatic function calls (no typeos!) made this perfect for him.



    It would need to be more Automator-esque to be useful to real people though. The problem is, novices won't be the best at logical thinking. In the WWDC keynote Sal gives a demo of Automator and basically he thinks out the pseudocode he wants to implement -- what the steps are. Then he makes those steps in Automator. Its this process and other logic like if-then-else that novices are not accustomed too. Granted, its fairly simple stuff, but I don't see my Mom using Automator.



    For novice programmers, I still say a Hypercard-like environment would be the way to go.
  • Reply 9 of 11
    jaredjared Posts: 639member
    Quote:

    Originally posted by Xool

    For novice programmers, I still say a Hypercard-like environment would be the way to go.



    I think that is what The One to Rescue is getting at but based on Objects and on Core technologies like CoreAudio, CoreImage, CoreVideo, etc.



    I do not know how to code but I can make a pretty neat word processor in InterfaceBuilder....how to make it save the files and actually compile the interface to a program? I have no clue. I think this is what The One to Rescue is talking about....
  • Reply 10 of 11
    rogue27rogue27 Posts: 607member
    Quote:

    Originally posted by ast3r3x

    I know this isn't what you are talking about...but PHP would be so easy to do this. Would probably be easily under 50 lines of code.



    I wrote a script with PHP to generate thumbnails from every image in a directory, and it was about 6 lines of code. I figure randomly choosing a box from inside the image wouldn't add any more than 2 lines on top of that.
  • Reply 11 of 11
    Quote:

    Originally posted by Kickaha

    Oddly enough, my advisor and I were discussing this just yesterday. See, my research into software architectures has led to a neat possibility I call 'concept-oriented programming'. It uses the language of design patterns to construct the architecture for a software system without you having to write a single line of code. What you're talking about, building algorithmic entities through visual selection of pre-defined elements is a perfect complement, and has roots in fragment theory.



    Hey... Concept-oriented programming! That's the name that came from a conversation about what I tried to explain inb this thread, between a friend and myself yesterday! That's it, exactly.

    Anyway, I really believe that bringing this on the Mac platform would be THE killer feature.
Sign In or Register to comment.