Discuss Scratch

emma2o2o
New Scratcher
1 post

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

Hi there,

I'm curious!

Is Scratch procedural (like C), object-oriented (like JavaScript), functional (like Python) or some kind of combination?

Many thanks,
Emma.
Monna-Uka
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

I think it is a combination, but I can't really tell.
Maximouse
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

Scratch is a mostly procedural programming language, but clones are actually some kind of object-oriented programming.

emma2o2o wrote:

… object-oriented (like JavaScript), functional (like Python) …
JavaScript and Python support both object-oriented and functional programming. But I don't think Python is a good example of a functional programming language.
R4356th
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

Hi! Scratch is mostly procedural.
Maximouse
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

R4356th wrote:

Hi! Scratch is mostly procedural.
Isn't this what I said before?

Maximouse wrote:

Scratch is a mostly procedural programming language, but clones are actually some kind of object-oriented programming.
R4356th
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

Maximouse wrote:

R4356th wrote:

Hi! Scratch is mostly procedural.
Isn't this what I said before?

Maximouse wrote:

Scratch is a mostly procedural programming language, but clones are actually some kind of object-oriented programming.
Yeah.
ElsieBreeze
Scratcher
100+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

Maximouse wrote:

But I don't think Python is a good example of a functional programming language.
SML and OCaml good examples yes yes
--Velocity--
Scratcher
100+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

Maximouse wrote:

Scratch is a mostly procedural programming language, but clones are actually some kind of object-oriented programming.

emma2o2o wrote:

… object-oriented (like JavaScript), functional (like Python) …
JavaScript and Python support both object-oriented and functional programming. But I don't think Python is a good example of a functional programming language.
Python is OOP not functional.
__init__
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

i'd say Python is actually a better example of OOP than JavaScript, given its lack of primitive types, support for metaclasses, etc. JavaScript has this weird prototype-based model which is still OOP, but maybe not the first thing people think of when they think of OOP
A-E-
Scratcher
100+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

__init__ wrote:

… better example of OOP than JavaScript, given its lack of primitive types …
JS doesn't have primitive types. Maybe you're thinking of Java?
Maximouse
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

A-E- wrote:

__init__ wrote:

… better example of OOP than JavaScript, given its lack of primitive types …
JS doesn't have primitive types. Maybe you're thinking of Java?
If I understand correctly, @__init__ was talking about Python's lack of primitive types.
badatprogrammingibe
Scratcher
500+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

Nah, Scratch is barely procedural, if I had to call it anything I would call it structural.
__init__
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

A-E- wrote:

__init__ wrote:

… better example of OOP than JavaScript, given its lack of primitive types …
JS doesn't have primitive types. Maybe you're thinking of Java?
JS does have primitive types:

There are 6 primitive data types: string, number, bigint, boolean, undefined, and symbol.
A-E-
Scratcher
100+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

__init__ wrote:

A-E- wrote:

__init__ wrote:

… better example of OOP than JavaScript, given its lack of primitive types …
JS doesn't have primitive types. Maybe you're thinking of Java?
JS does have primitive types:

There are 6 primitive data types: string, number, bigint, boolean, undefined, and symbol.
Hmm, “… has no methods …” seems to be false. All except undefined have at least toString.
In addition:
false.__proto__.__proto__.constructor===Object
"".__proto__.__proto__.constructor===Object
(0).__proto__.__proto__.constructor===Object
BigInt(0).__proto__.__proto__.constructor===Object
Symbol(0).__proto__.__proto__.constructor===Object
// undefined has no properties
A-E-
Scratcher
100+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

A-E- wrote:

__init__ wrote:

A-E- wrote:

__init__ wrote:

… better example of OOP than JavaScript, given its lack of primitive types …
JS doesn't have primitive types. Maybe you're thinking of Java?
JS does have primitive types:

There are 6 primitive data types: string, number, bigint, boolean, undefined, and symbol.
Hmm, “… has no methods …” seems to be false. All except undefined have at least toString.
In addition:
false.__proto__.__proto__.constructor===Object
"".__proto__.__proto__.constructor===Object
(0).__proto__.__proto__.constructor===Object
BigInt(0).__proto__.__proto__.constructor===Object
Symbol(0).__proto__.__proto__.constructor===Object
// undefined has no properties
Also, does the MDN definition make
new Proxy({},{get:()=>undefined})
a primitive?
__init__
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

i'm not a javascript expert but i think the fact that types like string and number have to use wrapper objects (String, Number) for full functionality is enough to call them primitives.

edit: from some internet searching it looks like the methods like toString are methods of the object wrappers, not the primitive types. javascript coerces primitive types into objects whenever you try to call a method or access a property on one of them. (more info)

Last edited by __init__ (May 1, 2020 23:13:59)

Jonathan50
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

Scratch is an imperative programming language. (Imperative programming is programming by writing sequences of steps.) It's procedural, because it allows you to write procedures, or custom blocks.

It's not object-oriented; if it were, it would offer message passing and inheritance

It's not functional in the sense that it wasn't designed for functional programming. Functional programming involves neither assignments, which change the values of variables, nor mutation, which is changing an existing data structure. Python wasn't designed with functional programming foremost in mind, as Lisp, Scheme, and ML were, but it facilitates it much better than Scratch does because it allows you to write procedures which return values, and it offers first-class compound data and procedures.

Last edited by Jonathan50 (May 1, 2020 23:09:40)

Sheep_maker
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

Jonathan50 wrote:

It's not object-oriented; if it were, it would offer message passing and inheritance
Couldn't broadcasts and clones inheriting scripts and for this sprite only variable values be considered as message passing and inheritance, or do they mean something else?
Jonathan50
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

Sheep_maker wrote:

Couldn't broadcasts and clones inheriting scripts and for this sprite only variable values be considered as message passing and inheritance, or do they mean something else?
Yes, I'm pretty sure, but that's not a feature of Scratch.
Sheep_maker
Scratcher
1000+ posts

Is Scratch procedural, object-oriented, functional or some kind of combination? (CS50)

Jonathan50 wrote:

Sheep_maker wrote:

Couldn't broadcasts and clones inheriting scripts and for this sprite only variable values be considered as message passing and inheritance, or do they mean something else?
Yes, I'm pretty sure, but that's not a feature of Scratch.
But aren't broadcasts and clone inheritance Scratch features? Or do you mean that they aren't intended to be used for message passing and inheritance?

Powered by DjangoBB