Discuss Scratch

bharvey
Scratcher
1000+ posts

Snap! user discussion

BookOwl wrote:

IMHO, object oriented design is overrated.
No argument here; I much prefer functional programming for most purposes. But as a teacher, I want to be able to give students the experience of using OOP so they have more than one string to their bow, and that means that the programming language we use has to support OOP.

BookOwl
Scratcher
1000+ posts

Snap! user discussion

bharvey wrote:

BookOwl wrote:

IMHO, object oriented design is overrated.
No argument here; I much prefer functional programming for most purposes. But as a teacher, I want to be able to give students the experience of using OOP so they have more than one string to their bow, and that means that the programming language we use has to support OOP.
Fair enough. I still wish Snap! had algebraic data types and pattern matching though.

who needs signatures
bdilloughery
New to Scratch
1 post

Snap! user discussion

Does anyone know how (if you are able to) use Objects as inputs for a custom block?

I tried, but I just get the turtle icon. I can't drag a sprite onto it or click on it to select from a list.

In the Snap! reference manual it says this feature is to come in version 4.1 but I don't think this is released yet. Just curious if anyone has done this … such as a custom block to sense if sprite1 is touching sprite2 or sprite3. Something like this.

Thank you,
Brendan
xly
Scratcher
100+ posts

Snap! user discussion

ToBookOwl

Brian Harvey has got a worldwide reputation , particularly as the author of the reference book of Computer science: “Simply Scheme-Introducing computer Science.”Computer science does not mean just “to learn programming” , but to know all the scientific and theoretical basis of Computer Science, you see the difference? By grand-son is attending at Imperial College of London the course of Computer Science and Artificial Intelligence. He is just starting to learn Lisp. Although no programmer today will ever write an application with Lisp (*) . Anyway it is a “passage obligé” for Computer science students. All major day-to-day programming languages like Javascript have been invented by Computer scientists, not by “C” programmers ! The same, of course, for the revolutionary “artificial intelligence”. In fact Snap! is “just” a brillant modern adaptation of Scheme language. You like it or you leave it ! No need to say that Brian know very well all means of tackling "object programming. This has been already discussed at length here for years, and believe me, Brian has very strong reasons for having implemented in Snap! his OOP way.

* I've offered him the book of Brian to start with.
bharvey
Scratcher
1000+ posts

Snap! user discussion

BookOwl wrote:

I still wish Snap! had algebraic data types and pattern matching though.
Algebraic types: We do! The algebra is based on the set {pointer}. The identity element for type composition is pointer. Etc.

Pattern matching: Yes, that would be nice. Although writing a pattern matcher is a great programming exercise! When we get around to macros, I guess we're going to have to think about whether to implement syntax-rules, or whether to do old-fashioned fexprs, or both.

cycomachead
Scratcher
81 posts

Snap! user discussion

bdilloughery wrote:

Does anyone know how (if you are able to) use Objects as inputs for a custom block?

I tried, but I just get the turtle icon. I can't drag a sprite onto it or click on it to select from a list.

In the Snap! reference manual it says this feature is to come in version 4.1 but I don't think this is released yet. Just curious if anyone has done this … such as a custom block to sense if sprite1 is touching sprite2 or sprite3. Something like this.

Thank you,
Brendan

Yes, it's possible right now, but slightly unintuitive. Use the “my ()” block in the Sensing palette. You can report “my (self)” or select another sprite.

Really, input types are hints - you could drop in a JOIN block or a variable and it will work fine. It's very likely that you're passing that input to a block that accepts text OR an object. If you're using OF in the block definition, you can pass an object or text with the name of the sprite and it will work.

Last edited by cycomachead (Sept. 6, 2017 23:51:09)

bharvey
Scratcher
1000+ posts

Snap! user discussion

xly wrote:

the reference book of Computer science: “Simply Scheme-Introducing computer Science.”
:blush: No, no, the reference book of CS is of course Structure and Interpretation of Computer Programs. Matt Wright and I wrote Simply Scheme as a “prequel” to SICP. We used it in the CS course for non-majors at Berkeley until Dan Garcia talked me into building a version that would be more appealing to nontraditional CS students, and that meant having a visual language with the power of Scheme, and it turned out that Jens had written a big part of what we needed, although not yet with λ. So my real claim to fame is that I taught Jens about anonymous functions.

But anyway, BookOwl is not ignorant of computer science! He knows things that I don't know. (Not saying he knows more than I do. )

Last edited by bharvey (Sept. 7, 2017 05:37:20)


888cinicobaka888
New to Scratch
1 post

Snap! user discussion

Has other users had problems accessing their SNAP! projects?

Some of my students save their projects regularly, then one day they try to open their project and all the code is missing.

This just happened recently.

Any and all help or feedback will be greatly appreciated!!

Last edited by 888cinicobaka888 (Sept. 7, 2017 13:31:51)

quat1024
New to Scratch
11 posts

Snap! user discussion

BookOwl wrote:

IMHO, object oriented design is overrated. I prefer the ML/Haskell like approach where you create lots of small immutable data types and use functions to transform them into the result you need.
They both have their places. I don't think it's very feasible to write something like a large game in a purely functional language. Or, I guess you could, but it would likely be a pain to write and quite slow.

oop works best when you *actually* have things that should be objects. When you get into the AbstractBlahManagerFactoryFactory, yeah no, and I think that's where oop gets part of its bad rap from.

I'm learning about prototypical inheritance - sounds similar to what you can do in scratch/snap with the clone block.

The Scratch 3.0 thread is the worst thread on the forums. Personally I'd be fine with nuking the entire forums from orbit.
ae2d2bcb-e9e3-4f9c-a847-290d71bd8bfd 222ec087-6694-42cf-8c41-064e9066f004
bharvey
Scratcher
1000+ posts

Snap! user discussion

888cinicobaka888 wrote:

Some of my students save their projects regularly, then one day they try to open their project and all the code is missing.
The only situation I know about in which this happens is if someone loads a project with a ton of media, usually sound files but sometimes just a lot of costumes, and gets beyond a browser limit on memory use. Was that the case for your student?

birdoftheday
Scratcher
500+ posts

Snap! user discussion

If you're still unsure about how stupid OOP can get, try to figure out what an AbstractSingletonProxyFactoryBean is.

Or a InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState

Last edited by birdoftheday (Sept. 7, 2017 19:03:36)


わたくしは強靭な男でございます!!!!!!!!!!!
comp09
Scratcher
1000+ posts

Snap! user discussion

birdoftheday wrote:

If you're still unsure about how stupid OOP can get, try to figure out what an AbstractSingletonProxyFactoryBean is.

Or a InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
That's just Enterprise Grade™ Java.

(OOP when done reasonably can be fine.)

Thanks, Obama. You've been a great president.

Visit the website of Andrew Sun!



Play with a preview of the new Scratch Blocks: Horizontal | Vertical | Scratch VM | Scratch Render | Scratch GUI
bharvey
Scratcher
1000+ posts

Snap! user discussion

birdoftheday wrote:

Or a InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Oh that's hilarious. Unparodiable, sort of like Trump.

Boy, time was, I had to argue with people who thought OOP was the Only Right Thing, and now I have to stick up for it, withBookOwl. Are things changing out in the real world, or are you guys a self-selected functional programming minority?

Dale_Mahalko
New to Scratch
49 posts

Snap! user discussion

bharvey wrote:

Dale_Mahalko wrote:

but then the next question is how to get input back from those sprites.
Oh, you use CALL instead of RUN, and put a ringed reporter in the first slot.

We have library blocks TELL (for RUN) and ASK (for CALL) that hide the OF business. But it really does make sense; OF reports a script or an expression that's tied to the other sprite, and RUN or CALL evaluates it.

I don't completely understand what you're trying to do, but does CALL/ASK solve the problem?

What I am trying to do is to move all scripting into a single main script, rather than spreading out code fragments across many sprites. This has long been a limitation in Scratch that you can't have a single central script in the stage and command sprites to do stuff from that central script.

I don't know if I'm trying to push this limited language to try to act too much like a normal language, which may not have a concept of sprites but just stamps out bitmaps onto the background with every frame update, only checks for overlapping rectangles in code, and has no concept of “touching”.

Just doing this is a problem because AFAIK there is only the one background, and I can't create a floating drawing area over the background that can then be drawn on, and discarded when I am done with it.


The Say chat bubble for player interaction is very limiting. I've been contemplating trying to write some sort of GUI framework that uses tens to hundreds of tiny tiled sprites in a cluster to create clickable auto-resizable buttons with sprite-generated text labels inside them, and I'm trying to figure out a “proper” way to do it.

Last edited by Dale_Mahalko (Sept. 7, 2017 20:54:06)

blob8108
Scratcher
1000+ posts

Snap! user discussion

bharvey wrote:

Are things changing out in the real world
Yeah fam. Immutability(TM) and Functional Programming(TM) are Hot Topics in the JavaScript/ECMAScript 2017/Node.js world Right Now.
quat1024
New to Scratch
11 posts

Snap! user discussion

birdoftheday wrote:

If you're still unsure about how stupid OOP can get,
Oi, I gotta stop you right there, that's like me making functional spaghetti and going “Lol look at how stupid Haskell is!”

Local man discovers that the worst of $genre is, in fact, pretty bad.

Spring even says it's “Enterprise”.

Last edited by quat1024 (Sept. 7, 2017 22:30:32)


The Scratch 3.0 thread is the worst thread on the forums. Personally I'd be fine with nuking the entire forums from orbit.
ae2d2bcb-e9e3-4f9c-a847-290d71bd8bfd 222ec087-6694-42cf-8c41-064e9066f004
birdoftheday
Scratcher
500+ posts

Snap! user discussion

I said “can get”, not “is”. And I don't deny that Haskell can get stupid, in fact it probably can be more stupid, I don't know or care. But that doesn't change or lessen the stupidness of other things.

Last edited by birdoftheday (Sept. 7, 2017 22:39:15)


わたくしは強靭な男でございます!!!!!!!!!!!
djdolphin
Scratcher
1000+ posts

Snap! user discussion

blob8108 wrote:

bharvey wrote:

Are things changing out in the real world
Yeah fam. Immutability(TM) and Functional Programming(TM) are Hot Topics in the JavaScript/ECMAScript 2017/Node.js world Right Now.
Pretty lit fam. But now that they've caught the attention of the JS world for a whole seven seconds, it's only a matter of time before the Next Big Thing(TM) comes along and Functional Programming(TM) is stinky and untrendy again.
birdoftheday
Scratcher
500+ posts

Snap! user discussion

Yeah, nobody cares about functional programming anymore. It's not 2012 and my name isn't Charles Babbage. As a code artisan I have better ways to spend my time and money, like this newest full stack framework everyone's using. It's called bilge.js, and it's not bloated–the minified version is only 2GB, you know.

わたくしは強靭な男でございます!!!!!!!!!!!
BookOwl
Scratcher
1000+ posts

Snap! user discussion

quat1024 wrote:

BookOwl wrote:

IMHO, object oriented design is overrated. I prefer the ML/Haskell like approach where you create lots of small immutable data types and use functions to transform them into the result you need.
They both have their places. I don't think it's very feasible to write something like a large game in a purely functional language. Or, I guess you could, but it would likely be a pain to write and quite slow.

oop works best when you *actually* have things that should be objects. When you get into the AbstractBlahManagerFactoryFactory, yeah no, and I think that's where oop gets part of its bad rap from.

I'm learning about prototypical inheritance - sounds similar to what you can do in scratch/snap with the clone block.
Notice I said “preferred”. Obviously there isn't a single paradigm that will perfectly fit everything, but I think that a (non pure) functional language like OCaml (which also has objects, if you really, really need them) is a better fit for most projects.

Or you can just use Rust and let the compiler turn your beautiful functional code like
some_iterator.map(do_something).filter(|x| is_something(x) && !is_something_else(x)).take(an_amount)
into efficient imperative code.

who needs signatures

Powered by DjangoBB

Standard | Mobile