Top 10 most important things to know about GP before starting out

Setup, what to try first, tutorials

Moderator: MSandro

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

Re: Top 10 most important things to know about GP before starting out

Post by SvenJ » Jul 13th, '17, 11:41

SimpleSi wrote:
Jul 13th, '17, 10:59
I've been thinking about the weak/dynamic typing section

If GP same as Scratch/Snap - just miss it out.

Everyone knows Scratch is completely type agnostic so no need to mention that GP is as well?

We can get it down to 9 things then :)
Yeah I've been considering it, but it is a major difference compared to other programming languages learners may be familiar with. I think it's important to consider the possibility that not all users of GP have encountered Scratch and Snap before. For that reason, I decided to leave it in.

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

Re: Top 10 most important things to know about GP before starting out

Post by SimpleSi » Jul 13th, '17, 19:09

Yeah I've been considering it, but it is a major difference compared to other programming languages learners may be familiar with. I think it's important to consider the possibility that not all users of GP have encountered Scratch and Snap before.
I don't think many using GP will be going a route like Python -> GP or Java ->GP

They might go Scratch -> Python - oh look GP is available -lets switch to GP instead of Python but then they'd know all about weak/no/dynamic typing in block programming languages :)

Then they might go back to Python or Java or C++

Can we compromise? Make it a lot shorter - just a quiet mention and a link to more detail somewhere?

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

Re: Top 10 most important things to know about GP before starting out

Post by SimpleSi » Jul 13th, '17, 21:40

Actually probably better to leave all of it in just in case non-Scratcher/Snapper tries GP out - so ignore my previous suggestion :)

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: Top 10 most important things to know about GP before starting out

Post by JohnM » Aug 3rd, '17, 22:26

Let me chime in late to this thread with two points:

1. As Sven said, all data in GP is "first class". Every value in GP is an instance of some class, including booleans, numbers, strings, arrays, bitmaps (costumes), arrays of sound samples, user interface elements -- and everything else!

2. Scratch has two different types of slots, pointy ones for booleans and rounded ones for everything else. In Scratch, a boolean input slot will only accept a pointy boolean reporter block, not a rounded block. That means you can't store a boolean in a variable and then use a reporter block for that variable as the direct input, for example, an "if" block. (The workaround is to encode the boolean as 0 or 1 and put use a "myVar = 1" block in the if statement.) This design was intended to help users understand the role the booleans play in control structures, and it works well in Scratch. However, in GP, we wanted to make it more convenient to store booleans in variables or lists and use a variable or list reporter directly in control structures such as "if", without an additional comparision operator. So GP has only one kind of reporter, the rounded kind, and it can be used in any input slot.

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: Top 10 most important things to know about GP before starting out

Post by JohnM » Aug 10th, '17, 18:10

However, while GP is able to create files, it is (currently) not able to create folders - this means that any subfolder given to the blocks to use needs to exist at the time of execution.
Although they do not appear in the palette, GP actually does have a commands for creating folders (directories), renaming and deleting files, and listing files and folders. Here they are:

Code: Select all

   { makeDirectory 'newDirectoryPath' }
   { deleteFile 'fileName' }
   { renameFile  'oldName' 'newName' }
   listFiles 'path'
   listDirectories 'path'
An advanced user can enter developer mode, create a workspace, type one of the above commands into the workspace, select the text, and invoke the "blockify it" command from the workspace menu. The result will be a block that you can invoke or use in a script. Putting curly brackets around a command makes "blockify" create a command block rather than a reporter block.

For example, blockifying "listFiles 'path'" gives:
reporter.png
reporter.png (2.81 KiB) Viewed 1870 times
While blockifying "{ listFiles 'path' }" gives the not-so-useful:
cmd.png
cmd.png (2.47 KiB) Viewed 1870 times
Obviously the ability to delete or over-write files is powerful, so remember the Spiderman/developer mode motto if you use these blocks: With great power comes great responsibility.

Post Reply