by copsarebastards · 11y ago · 0 comments
When you create a learning language, you're inherently taking a bunch of concepts from modern programming, and you're dividing them into two groups: things that you think are necessary for what the student is doing to be called programming, and things that aren't necessary.
Somewhere along the line, Snap, and its precursor, Scratch, decided that text wasn't a necessary part of programming. The motivation for this decision seems to have been that they think that text is part of what scares some people away from programming. That may or may not be true, I don't know. But what I do know is that if you aren't using text, I have a hard time describing what you're doing as programming.
Sure, a lot of programming concepts can be expressed visually. But rapidly these visual representations break down when you try to build anything complicated out of them, because you start having to do more complicated things along the way. Version control is tied to text: you can't revert part of your changes to a flow diagram easily. As you learn more about a problem domain, you decide you want to rename a variable? Good luck with find/replace without text. Or are you just going to drop the concept of a variable? What's the visual representation of a type?
The result might be that you get people interested in something you're calling programming, but their interest is based on false premises. When you finally expose them to actual programming, all the parts that were too scary to show them to begin with are all there. All you're doing is losing them later.
I think that BASIC did a much better job of this back in the day. It gave you a lot up-front, and to do this, some of the concepts weren't ideally scalable, but there wasn't really any upper limit to what you could do with BASIC. The result is that all those scary concepts were there, but you didn't have to confront them all at once. Eventually you'd have to learn that, say, turtle graphics aren't the way we really draw things, but until you learned that, you could still do everything you wanted, it was just a little slow. I got all the way up to writing code for real, full-sized robots in BASIC (albeit by that time I had started learning C++). There's nothing that would have stopped me from writing real-world applications in BASIC (and indeed, many real-world applications are built in BASIC).
It may be that Snap or one of its ancestors will someday reach the level where you could build a real-world application in it. I hope that happens, and I hope it makes programming accessible to everyone. But for now, I don't think that what Snap teaches is really programming.
> But what I do know is that if you aren't using text, I have a hard time describing what you're doing as programming.
The thing is, kids using Scratch end up creating amazing stuff: I've seen recursive raytracers, real-time multiplayer-over-the-network FPS games, a chess AI (game tree + alpha/beta pruning), emulators for various video games… I can't really look at that and not describe it as programming.
> What's the visual representation of a type?
Shape. In Scratch and Snap!, a block that returns a boolean is diamond-shaped, and holes for boolean arguments are diamond-shaped. So you can't accidentally put a number into the condition for IF--the shape literally doesn't fit.
This beats TYPE ERROR: COULD NOT COERCE "INT" TO "BOOL" (LINE 12) any day.
> Good luck with find/replace without text.
I think it's easier to right-click a variable's block and select "rename…" from the dropdown than to run :%s/badname/goodname/g and hope you don't accidentally change non-variable instances of that substring. And since the block knows its scope, you know that only in-scope uses of that variable will be updated.
> Version control is tied to text
It turns out that version control with Snap! and Scratch projects is really easy, since the internal datastore is just XML and JSON, respectively, both of which play reasonably well with git. But when you're teaching someone to program in an introductory CS course, version control should be very low on your priority list. There are so many more exciting big ideas worth teaching.
> When you finally expose them to actual programming, all the parts that were too scary to show them to begin with are all there.
The way I see it, once you get them excited about computer science, the things that were too scary aren't scary anymore: they're exciting.
Okay, so why couldn't you do the same thing with text? If you can fit a bunch of blocks on the screen, why can't you fit a bunch of function names and keywords on the screen?
> The thing is, kids using Scratch end up creating amazing stuff: I've seen recursive raytracers, real-time multiplayer-over-the-network FPS games, a chess AI (game tree + alpha/beta pruning), emulators for various video games… I can't really look at that and not describe it as programming.
Okay, that is impressive. But are those same kids also writing C or Python? I've done some cool stuff with Scratch back in the day, but I don't think I could have done it if I hadn't already been pretty well-versed in HyperTalk, BASIC, and C++ (at the time).
> Shape. In Scratch and Snap!, a block that returns a boolean is diamond-shaped, and holes for boolean arguments are diamond-shaped. So you can't accidentally put a number into the condition for IF--the shape literally doesn't fit.
That's certainly easier to understand, but it's also far less capable. How can it handle structs (or classes)?
> The way I see it, once you get them excited about computer science, the things that were too scary aren't scary anymore: they're exciting.
I really hope this is true, I'm just not sure it is.
However, I really hope people keep researching this and prove me wrong.
The XML Snap exports to is a completely different language from Snap. You're not versioning Snap, you're versioning the XML that Snap exports to, and unless you're really planning to hand-code software in XML the composability is just not going to be there. Version control involves tying code changes to functionality changes, and unless you're directly writing the XML you have no way of being sure that such things are maintained.
Yes, you can version it, but you're versioning it as a black box, in the same sense as you would version an MP3 or a JPEG. The XML allows you better compression than a binary format, but it doesn't give you the ability to textually navigate changesets.
There's no absolutely reason why the Snap UI couldn't be feeding the XML to a version control system behind the scenes, and recovering previous versions from that system at will.
Oh really? What is the 1:1 representation of a diff on XML in the visual code?
Representation in a programming language is a huge feature of the language, and it's particularly ridiculous to claim that it isn't for a language whose key feature is having a visual representation rather than a textual representation. An alternative representation of a programming language is a completely different programming language.
> There's no absolutely reason why the Snap UI couldn't be feeding the XML to a version control system behind the scenes, and recovering previous versions from that system at will.
Yes, but that's not even the most commonly used functionality of version control. How do you propose we do visual merges? Or are you actually proposing that we write code directly in XML?