49 comments

[ 3.3 ms ] story [ 114 ms ] thread
[stub for offtopicness - come on you guys, please don't do this here]

Edit: perhaps I should explain what the "this" is that you shouldn't do here. It's covered by this guideline from https://news.ycombinator.com/newsguidelines.html: "Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something." (as well as this one of course: "Don't be snarky.")

The trouble with shallow dismissals, such as reflexive reactions to a title, is that they don't contain enough information to be interesting, and they spread like weeds in a thread—especially a new thread, because those are so sensitive to initial conditions. If they spread too much, they choke out good discussion altogether.

I don't favor OO either! The HN archives of yore have a lot of me arguing about it and I like a good OO bitch session as much as anyone. But for a good HN thread, we need comments that are about the specific work being posted, and this is obviously interesting work on teaching programming to kids.

But I don't want my kids' minds being poisoned by OO paradigms. God forbid they start using design patterns everywhere!

Seriously, though - seeing how most adult programmers do OO poorly ...

It's like Pox Party. You're exposing them early so they get immune when they're adults from this disease.
ROFL, I remember that in the early 80s. Me and brother.

I wonder when our institutional/civilizational memory of this will fade entirely with childhood vaccination...

I can't agree enough. What other paradigm is so regularly implemented in a way that makes doing it poorly easy(Inheritance), doing it well hard(Composition), and requires a list of caveats so large that it effectively draws down to "only use it in these specific places"?

How does a paradigm like that survive? I might be a fan of functional, but I'm not even saying go that way- stay procedural! Learn your abstractions over time and only build them when necessary.

VBA's OOP doesn't have inheritance, so I had to use composition. Now I understand that the constraint resulted in better code.
How do implementations of OO make inheritance easier than composition?
(comment deleted)
I think the refrain has more to do with inheritance being heavily promoted as the reason for doing OO in the early 90's till the mid 00's. I believe even Bjarne Stroustrup said if you're not doing inheritance, it's not OO and you should stick to C.

Also, while one can do composition about as easily as inheritance, it still has its warts in languages like C++. If you want to unit test code, it's recommended to use dependency inversion instead of regular composition - there are other good reasons to do DI as well. But when you start coding the same stuff in non-OO paradigms, you realize that it's just much easier - stuff like DI was popularized to get around the flaws of the OO implementation in those languages. The same goes for most OO design patterns.

The number of languages that only support Inheritance and have no version of Composition(or severely compromised versions) is long. What's funny is how many of them make it easier to perform composition as long as you avoid the `class` keyword.
> doing it well hard(Composition),

suggest how this may be fixed

> and requires a list of caveats so large that it effectively draws down to "only use it in these specific places"?

I don't recognise this, can you explain please

Design patterns
IIRC OO is a design pattern. Just happens many langs support it directly.
(comment deleted)
> suggest how this may be fixed

Only allow composition. Allow composition techniques to add state, detect the presence of other composition types, etc.

(comment deleted)
Yet somehow Ruby, Python, Javascript, Java, C++ remain widely used languages that implement all kinds of software.
Of these, I would consider only Java to be a true OO language.

Python: Sure, everything is an object, but you don't need to know much about OO to use them. I program in Python professionally, and rarely do I write classes (unless I'm using a framework like Django that requires them). Also, if your language doesn't support data encapsulation, can you even call it OO?

JS: Wasn't OO a later addition to the language? You can get a huge amount done in JS without classes, and that isn't considered poor JS. The general push in JS is to go more functional, not more OO.

C++ is just C with an overly complex OO appended to it. Again, you can write fantastic code in it without relying on OO directly.

JS is a prototypal language, classes are just sugar on top of the prototypes. It's still a flavor of OOP (Self, the original prototypal language, was basically Smalltalk without classes). Ruby makes heavy use of OOP, but allows procedural style of programming similar to Python. You look at Python data science libraries built on top of Numpy such as Pandas, and you see plenty of class stuff.

The web DOM is object oriented. But sure, in these languages you don't have to write your own classes and methods, use inheritance, etc. But plenty of code has used it, and somebody is maintaining, using or extending that code.

The point isn't that OOP is inherently bad and should never be used, but that writing OOP code well (as opposed to merely using objects) is nontrivial. Hence the "seeing how most adult programmers do OO poorly" comment. We've had lots of problems with universities starting off with OOP in the introductory course. I would not deem it suitable for kids unless they are already good at procedural programming.

Of course good stuff has been written in OOP. I personally like that Django uses OOP - it's a good fit. Doing it well is not easy, though. And many problems are easier solved without it.

> JS is a prototypal language, classes are just sugar on top of the prototypes.

Is OOP now a vague term, akin to "functional programming"?

I still maintain that not having data encapsulation (i.e. Python) means it's not OO. (Not that I particularly want it to, either).

If that Chat Control thing is going to protect our kids from harmful content like this, then it might be a good idea actually!

Edit: apologies dang, you’re right obviously.

good god don't teach this to kids.

teach them something equally wrong but less harmful, like that there are four elements and they are fire, earth, air, and water.

As one of the offenders, I do not see it as that far off topic. If someone posted a video called "Parkour for kids", would you think it off topic if people pointed out that this is just a really, really bad idea?
That's not remotely comparable.

Getting triggered by a title and regurgitating pre-existing bile about OO (of all things) in the name of protecting children (of all things) was, yes, offtopic and more than a little silly.

My seven-year-old might be pretty into this. I'll give it a shot later this week and see if it sticks.

The visceral reactions to OOP here are interesting. There's nothing even about inheritance mentioned here.

The article was originally linked to this video, and that triggered a bunch of cheap shots about how object oriented programming will ruin your mind:

What is Object-Oriented Programming? | Coding for Kids | Kodable:

https://www.youtube.com/watch?v=X3cFiJnxUBY

This offers more information:

http://support.kodable.com/en/articles/417333-what-is-object...

There's also this video:

What are Classes | Coding for Kids | Kodable:

https://www.youtube.com/watch?v=IHyxevOMosw

The current video describing functions is a more basic (pardon the pun) procedural example of Kodable than the object oriented stuff, which it teaches later on.

What are Functions? Coding for Kids | Kodable:

https://www.youtube.com/watch?v=3JIZ40yuZL0

I've been playing around with Kodable and watching their videos, and what impresses me about it is how much it draws from Alan Kay and Seymour Papert's work, and that it teaches a well known, universal language: JavaScript.

I really loved the Factorio-esque drone automation approach to virtual pets that you can manually lavish attention, feed, groom, and train to do tricks, then program robots (like a hovering roomba) to monitor and satisfy your pet's needs, and even call functions you write with (rhythm game inspired) instructions for making your pets perform tricks!

Kodable reminded me about something Alan Kay said in a discussion about visually programming SimCity, particularly in reference to Warren Robinette's Robot Odyssey, and Thinkin' Things, collection 3, “Let’s Build a Halftime Show!":

https://youtu.be/gCFNUc10Vu8?t=24m58s

HN Discussion: Classic 1984 video game Robot Odyssey available online (robotodyssey.online):

https://news.ycombinator.com/item?id=17423719

https://snap.berkeley.edu

----

From: Alan Kay Date: Thu, 3 May 2018 07:49:16 +0000 (UTC) Subject: Re: Blocky + Micropolis = Blockropolis! ;)

Yes, all of these "blocks" editors sprouted from the original one I designed for Etoys* more than 20 years ago now -- most of the followup was by way of Jens Moenig -- who did SNAP. You can see Etoys demoed on the OLPC in my 2007 TED talk.

I'd advise coming up with a special kid's oriented language for your SimCity/Metropolis system and then render it in "blocks".

Cheers

Alan

------------- * Two precursors for DnD programming were in my grad student's -- Mike Travers -- MIT thesis (not quite the same idea), and in the "Thinking Things" parade programming system (again, just individual symbol blocks rather than expressions).

----

From: Don Hopkins Date: Fri, 4 May 2018 00:43:56 +0200 Subject: Re: Blocky + Micropolis = Blockropolis! ;)

I love fondly remember and love Thinkin’ Things 1, but I never saw the subsequent versions!

But there’s a great demo on youtube!

https://youtu.be/gCFNUc10Vu8?t=24m58s

That would be a great way to program SimCity builder “agents” like the bulldozer and road layer, as well as agents like PacMan who know how to follow roads and eat traffic!

I am trying to get my head around Snap by playing around with it and watching Jens’s youtube videos, and it’s dawning on me that that it’s full blown undiluted Scheme wit...

> The visceral reactions to OOP here are interesting.

The submission title originally was for OO.

As it was when I made that comment.
I would hate to get kids started on OOPS.

LOGO is a functional programming language for kids and might teach a better mindset. Another more modern option is MS MakeCode Arcade, which is Typescript and Blockly. You can switch back and forth between the two views of your code.

I'm a huge fan of Logo! I wrote a Logo Adventure for Terrapin Logo that they shipped on the C64, the point of which was to show off Logo's list processing and functional features, because most of the other examples were focused on turtle graphics. So I appreciate what you say about teaching the functional and abstract parts of Logo, as well as the procedural and graphical parts like turtle graphics.

https://donhopkins.medium.com/logo-adventure-for-c64-terrapi...

Blockly is actually a JavaScript library for rolling your own visual blocks based visual programming languages, from Google. They use it for App Inventor, but that's not all it's used for. It's not one particular language or execution model, but different applications can interpret or compile it into JavaScript or even shaders or WebAssembly.

Here's a wonderful example of a "Falling Sand Game" called "Sandspiel Studio" that uses Blockley for a specialized cellular automata oriented visual programming language, that let you define and play with your own sand/air/water/lava/seed/stem/leaf/flower/whatever particles:

https://studio.sandspiel.club/

Making Sandspiel HN Discussion (Max Bittker):

https://news.ycombinator.com/item?id=34555913

https://news.ycombinator.com/item?id=34561910

https://maxbittker.com/making-sandspiel

Making Alien Elements (with Todepond):

https://www.youtube.com/watch?v=48-9jjndb2k

The point that Sandspiel Studio so beautifully illustrates and Blockley so practically addresses is that there are many possible domains, execution models, data models, vocabularies, and user interfaces for visual programming languages: there is no universal VPL that's good for everything, but they're great for many different domains, so you need powerful flexible tools for rolling your own special purpose VPLs.

That's also why Blender supports generic "nodes" you can subclass and customize into all kinds of different domains like shader programing, 2d image composition, 3d content generation, animation, constraints, etc. There are third party and built-in Blender plug-ins that customize nodes into specialized visual languages for generating maps and cities, particle systems, and all kinds of other specialized uses.

Everything Nodes UX #67088:

https://projects.blender.org/blender/blender/issues/67088

Function & Particle Nodes:

https://wiki.blender.org/wiki/Source/Nodes

So Blockley and Blender Nodes are the visual equivalent of "yacc", for defining custom visual programming languages.

I'm also a huge fan of Snap!, which has all the advantages of Logo (Lisp without parenthesis) and Scratch / eToys / Squeak / App Inventor family of block based visual programming languages, but all the power of Scheme.

If you know Scheme, then it's easy to think about Snap!: it's just Scheme with a visual block syntax, but with some functions renamed to make them easier to learn, plus all the stage and turtle graphics stuff from Scratch, running in a web browser!

I didn't realize unt...

Hey, thanks for the pointers. Question: are you aware of any materials I can follow to teach kids how to program using Snap!? Snap! has indeed become quite powerful with time, but I struggle to come up with a lesson plan, examples, exercises... whatever will gradually bring kids up to a Scheme-like level of expressiveness and generality.
Definitely! To start with: Brian Harvey's magnum opus, "The Beauty and Joy of Computing", which was used for CS10 at Berkeley, and is "intended for non-CS majors at the high school junior through undergraduate freshman level".

https://snap.berkeley.edu/bjc

The Beauty and Joy of Computing (BJC) is an introductory computer science curriculum using Snap!, developed at the University of California, Berkeley and Education Development Center, Inc., intended for non-CS majors at the high school junior through undergraduate freshman level. It is a College Board-endorsed AP CS Principles course. It is offered as CS10 at Berkeley.

The curriculum BJC is available online at https://bjc.edc.org

Resources: You can find information about BJC, teacher preparation, and additional resources at https://bjc.berkeley.edu

And here is the Snap! reference manual:

https://snap.berkeley.edu/snap/help/SnapManual.pdf

I’ve evangelized about Snap! frequently on Hacker News over the years, and these links have more details and links to other Snap! extensions and projects (of which there are many amazing ones):

https://news.ycombinator.com/item?id=17594403

https://news.ycombinator.com/item?id=23053999

https://news.ycombinator.com/item?id=24782152

https://news.ycombinator.com/item?id=27396842

https://news.ycombinator.com/item?id=27397375

https://news.ycombinator.com/item?id=36755852

You can discover more of the things people are doing with Snap! in the Snap!Con2023 conference schedule:

https://www.snapcon.org/conferences/2023/schedule/events

And also the videos of the conference talk and other Snap! presentations:

https://www.youtube.com/@SnapCloud/videos

The embedded programming, iot, robotics, embroidery (TurtleStitch), and other tangible computing projects are especially engaging and inspirational for kids.

Much obliged for your help. Logo has the advantage of being immediately applicable to much younger learners (~7) than BJC (~16). There's a big mass of teaching resources (microworlds, etc) that are immediately usable at the beginning, with the possibility of progressing into more complex concepts (e.g., turtle geometry). Maybe, for small children, it'd be a matter of buckling down to port Logo examples to Snap!'s turtle graphics... I may try that.
What a terrific and thorough reply! If you haven't tried it already, have a look at MS MakeCode Arcade. It uses Blockly to render Typescript and you can switch back and forth. It's great for drawing imperative stuff and procedures with blocks, and then looking at the TS to see how they're really implemented.

Here's [0] a small game I wrote in MakeCode which you can play or edit live in the browser.

[0] https://arcade.makecode.com/59845-44370-91548-60605

Thanks! I've switched to that rather than https://www.youtube.com/watch?v=X3cFiJnxUBY, to try to dampen the title fever. (Submitted title was "Object-oriented programming for kids [video]" and it...did not work as a thread. I've swept the offtopic comments under the rug now: https://news.ycombinator.com/item?id=38014255.)

Edit: changed again to one suggested by a clever user who writes, I think “What are Functions?” should satisfy the object haters. ;))

Refreshingly they did not talk about InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState but tried to explain the reasons for separating code into objects and the difference between a class and an object. Could be useful for kids at a certain level.
What is the target age for this series? IMO I thought some parts could be a little slower (like "think of something you do every day..." - pause just a second or two for thought). Not that it matters as the series is 3 years old and I'm no child psychologist
Here is my review of this, there is java code thirty seconds into the video.
Do kids really respond to this material? Does it stoke their desire to learn? I feel like these videos take "adult programmer pedagogy" and wrap it in kid-friendly language. Kids don't care about grown-up rationales for programming language features.

Years back, I walked my nephew through a basic programming exercise. I asked him what he would like to see the computer draw. Because he liked trains and Minecraft, he said "a square train". So we booted up Python and used its turtle graphics module to draw a square engine with rectangular smokestacks, a right-angles-only cowcatcher, and square wheels.

Once we had drawn our first wheel, I showed him how to take that code and break it out into a function ("we call this refactoring!"), and how to abstract the x and y coordinates into parameters to the function, so square wheels can be drawn anywhere. Then I showed him how to define a "boxcar" function in terms of the wheel function, so boxcars with square wheels can be added to the train.

I don't know how much of it stuck, but I suspect some of it did because he's 12 now and wants to program space robots.

So we had a goal the kid wanted (a square train), and we worked to the goal, discovering problems along the way, and introducing tools programmers use to solve those problems (like functions and refactoring). OOP can be introduced similarly, with an environment that features multiple turtles, game sprites, or something, and the programmer must instruct a particular object to perform an action.

From what Don Hopkins says about the Kodable software itself, it does support some of these ideas which is cool. So maybe the videos work better as something supplementary to the app.

Yes, it comes with several different kinds of "microworlds" that are games in themselves, but with "levels" you can build, i.e. with tiles or objects, so many different (even user defined) scenarios are possible. Then it has lessons with gradually increasing complexity that you have to solve.

It's really a lot like Robot Odyssey (yet not as hard and limited), but you're learning a real programming language, byte by byte. Starting with drag-and-drops icons and boxes to represent sequences, then conditionals and branching and looping and functions.

The Hardest Video Game You've Never Played | Robot Odyssey

https://www.youtube.com/watch?v=iycj199McEg

Before "What is a Function?" you have to learn "What is Sequence?" and "What are Conditions?":

What is Sequence? | Coding for Kids | Kodable:

https://www.youtube.com/watch?v=v_Pc3UnePZY

What are Conditions? | Coding for Kids | Kodable

https://www.youtube.com/watch?v=dJYIRcsdHWg

Each of these lessons has corresponding levels that have different simplified visual approaches to programming.

The object oriented stuff comes later, and has some corresponding object oriented simulation game microworlds, like tower defense, virtual pets, and programmable drones, etc.

I wish there was a video showing the virtual pets and Factorio/Robot-Odyssey-esque robot drones you can program to take care of them -- that was really neat, and taught event based programming.