Class/instance/prototypes

Questions about GP commands and how to do things

Moderator: MSandro

Post Reply
SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Class/instance/prototypes

Post by SimpleSi » Jul 16th, '17, 13:01

Assumption: Scratch and its cloning mechanism are a form of prototyping

If this is true and GP wants to use the Class/Instance model instead then I don't think it should have default instances of classes - all instantiation should be done at program run-time or by manual addition by use of a + button

I've obviously only been thinking about this for a few weeks but I'm wanting to able to simply, consistently and clearly explain the new class/instance model to Scratchers

Having an automatic instance of a class seems to fudge the model being promoted and something inside me goes - this isn't quite right.

My Suggestion (always have a suggestion if you don't like something is something I always promote)

If (for reasons of low-barrier to entry) MyClass has to have a default instance, then when creating any other classes - don't have default instances

This way, we could maintain the initial friendliness shared by the other major block programming languages but quickly move on to using the class/instance model fully

For completeness, ability to remove the default instance (inc MyClass one) should be explicitly allowed (with possible warning that last instance is being deleted????)

SvenJ
Posts: 25
Joined: Jul 6th, '17, 08:03

Re: Class/instance/prototypes

Post by SvenJ » Jul 16th, '17, 19:11

SimpleSi wrote:
Jul 16th, '17, 13:01
Assumption: Scratch and its cloning mechanism are a form of prototyping

If this is true and GP wants to use the Class/Instance model instead then I don't think it should have default instances of classes - all instantiation should be done at program run-time or by manual addition by use of a + button

I've obviously only been thinking about this for a few weeks but I'm wanting to able to simply, consistently and clearly explain the new class/instance model to Scratchers

Having an automatic instance of a class seems to fudge the model being promoted and something inside me goes - this isn't quite right.

My Suggestion (always have a suggestion if you don't like something is something I always promote)

If (for reasons of low-barrier to entry) MyClass has to have a default instance, then when creating any other classes - don't have default instances

This way, we could maintain the initial friendliness shared by the other major block programming languages but quickly move on to using the class/instance model fully

For completeness, ability to remove the default instance (inc MyClass one) should be explicitly allowed (with possible warning that last instance is being deleted????)
GP in its current state seems to go for a hybrid system of representation:
On one hand, we have the traditional approach to object-oriented programming with classes and objects (known from text-based languages such as Java), and on the other hand, automatically creating the first instance of a class follows the prototyping concept found in Scratch and Snap. Essentially, if you consider the first instance of a class (the one that is automatically created for you) its prototype, then you can perfectly get by without having to re-think at all. Having said that, I do feel the difference should be clearer.
One possible way to do this is to stop instances from being automatically created when a new class is created. However, this would have to apply to the default class "MyClass. If it didn't apply to "MyClass" as well, I feel as though it could be very confusing for a learner having to distinguish: "MyClass has a default instance, but any other class I make doesn't? Why?", "What makes the class I just created different from "MyClass"?" etc..

How do you feel about this suggestion:
Default instances of all classes are removed, except for "MyClass", and a little "tutorial" to explain is added? It wouldn't need to cover too much information, just the basics, similar to this (if the tutorial does not open for you, open the menu in the top-left corner and click "start tutorial"). We could have a little window pop up and tell the user about the interface, how to put blocks together, how to create classes and instances, and say:

"Since this is your first project, your first class (and one instance of it) have already been created for you. You can create more classes and instances by using the corresponding "+"-buttons."

And have arrows point to the buttons. Then "MyClass" can still have default instances, but any class created by the user will not. Therefore, classes and objects behave more closely to how they do in other programming languages. Thoughts?

Post Reply