Greenfoot

For discussion of xTalk topics related to education.
Post Reply
User avatar
richmond62
Posts: 3297
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Greenfoot

Post by richmond62 »

is NOT xTalk, but what it offers is a subset of what xTalk can offer using Java or Stride.

Certainly the examples it offers can be imitated in terms of functionality 100% in OXT without any great difficulty, so they can be ripped-off with impunity to add to OXT educational resources:

https://www.greenfoot.org/door
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3297
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Greenfoot

Post by richmond62 »

So: I am working my way through a Greenfoot tutorial and trying to imitate its functionality in OXT.

This script in the crab scriptEditor made me feel 'all queer':
-
Screenshot 2023-12-10 at 13.46.12.png
Screenshot 2023-12-10 at 13.46.12.png (774.37 KiB) Viewed 3255 times
-
Just for fun I'll set up a similar stack in OXT Lite:
-
Screenshot 2023-12-10 at 13.52.38.png
Screenshot 2023-12-10 at 13.52.38.png (402.63 KiB) Viewed 3255 times
-
Funky terms that are new for me:

class definition

act method

the signature of the method

"The last three lines—the two curly brackets and anything between them—are called the body of the method.
We can replace the grey text in the middle with a command. One such command is

move(5);


Note that it has to be written exactly as shown, including the parentheses and the
semicolon. The act method should then look like this:
Screenshot 2023-12-10 at 13.56.45.png
Screenshot 2023-12-10 at 13.56.45.png (8.25 KiB) Viewed 3254 times
-
So, having done that, and COMPILED the thing, and clicked on the RUN button the crab moves to the right.
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3297
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Greenfoot

Post by richmond62 »

To achieve the same thing in OXT requires MORE code than in Greenfoot:
-
Screenshot 2023-12-10 at 14.03.00.png
Screenshot 2023-12-10 at 14.03.00.png (434.04 KiB) Viewed 3253 times
-
HOWEVER, I would argue that in OXT it is slightly easier to see what the code is meant to do.

As one can adapt that OXT code readily to have leftwards, upwards and downwards movement, it is interesting to see how one might achieve that in Greenfoot:
-
import greenfoot.*;

/**
* This class defines a crab. Crabs live on the beach.
*/
public class Crab extends Actor
{
public void act()
{
move(-5);
}
}


Moves the crab leftwards as should be fairly obvious.

What is NOT obvious at all is vertical movement.

Greenfoot has no readily searchable, inbuilt documentation.

This took 10 seconds:
-
Screenshot 2023-12-10 at 14.11.21.png
Screenshot 2023-12-10 at 14.11.21.png (129.79 KiB) Viewed 3252 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3297
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Greenfoot

Post by richmond62 »

I went over here:

https://www.greenfoot.org/doc/tut-2

and tried this:
-
Screenshot 2023-12-10 at 14.17.31.png
Screenshot 2023-12-10 at 14.17.31.png (40.68 KiB) Viewed 3251 times
-
And got the crab to go round in circles.

No fine-tuned control over size of circle.

OXT will produce degradation of the image if it is NOT an SVG.

The Greenfoot exercise contains inbuilt edge-detection, so the crab will not run over the edge of the 'sand' image: in OXT that has to be coded.

In xTalk the circular movement would probably best be effected by animating along a circular path . . . NO, not a circular graphic, but a graphic consisting of about 360 points.
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3297
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Greenfoot

Post by richmond62 »

This is relatively straightforward [especially if you were paying attention in year 6 at Primary school]:
-
Screenshot 2023-12-10 at 19.30.47.png
Screenshot 2023-12-10 at 19.30.47.png (352.76 KiB) Viewed 3245 times
-
Screenshot 2023-12-10 at 19.36.04.png
Screenshot 2023-12-10 at 19.36.04.png (507.01 KiB) Viewed 3243 times
-
You'll have to fart around a bit to make the crab face the middle of the circle (and, first, you'll need an SVG crab).
Attachments
TRACKER.oxtstack.zip
Stack.
(2.16 KiB) Downloaded 216 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3297
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Greenfoot

Post by richmond62 »

As I frankly cannot be bothered to do all sorts of clever things with radians I have used a list of angles to determine where the rotating crab faces:
-
Screenshot 2023-12-10 at 20.37.24.png
Screenshot 2023-12-10 at 20.37.24.png (848.32 KiB) Viewed 3242 times
-
And I had to go and fossick around on the internet to find a suitable SVG crab. 8-)
Attachments
Little Crab.oxtstack.zip
Stack.
(67.08 KiB) Downloaded 204 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3297
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Greenfoot

Post by richmond62 »

I would argue that the Greenfoot project leaves too many questions unanswered compared with something similar in OXT.

[After all, 'something', 'somewhere' is doing all the heavy lifting in Greenfoot that has to be hand-coded in OXT: this will give learners a distinctly false impression about how this sort of thing is effected.]
https://richmondmathewson.owlstown.net/
User avatar
OpenXTalkPaul
Posts: 1877
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Greenfoot

Post by OpenXTalkPaul »

Those are object oriented programming terms, some of those xTalk has other names for.

A 'class' is just a the type that an object it is, here we have an object that is of the class 'Turtle'.
A 'method' is like a 'handler' of an object, "command moveTurtle x,y"

https://www.indeed.com/career-advice/ca ... erminology

https://www.d.umn.edu/~gshute/softeng/o ... ented.html

https://medium.com/backticks-tildes/obj ... 8791badb92
User avatar
richmond62
Posts: 3297
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Greenfoot

Post by richmond62 »

To be honest I was looking at Greenfoot (which is being pushed in a big way in Great Britain at Primary Level) to see:

1. What it had to offer (as a component of a short course I might offer squabs next Summer).

2. Whether it offered any obvious advantages re helping children to learn basic computational thinking over OXT.

3. Whether anything in the Greenfoot 'course' that could be usefully imitated/copied for any short course in OXT.

Rapidly I came to the conclusion that move(5) was inferior to effecting the same thing in OXT because it was both too simplistic and left all sorts of things out which I feel it is necessary for young learners to consider . . . probably best explained by stating "When you play chess you can only move the pieces in specific ways, and you may not move them off the board."
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3297
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Greenfoot

Post by richmond62 »

https://www.d.umn.edu/~gshute/softeng/o ... ented.html

A while back (well, about 20 years ago) I went to a seriously low-end 'University' for a Master's degree in this sort of thing: and, apart from a woman who lectured us on Visual BASIC 5 and kept getting things wrong, the only things of any vague import that stick in my mind were 'Object Based' and 'Object Oriented', and these terms were just chucked "into the pot" with no explanation whatsoever. Funnily enough the lecturer on VB5 aksed me to take over the practical sessions after I rubbed her up the wrong way by duplicating every exercise in what was then called Runtime Revolution 2: she really did not have a clue.

Since then all that I have managed to work out is that xTalk is object-based (and as xTalk is full of pre-made objects it would be hard to disagree with that) and that languages like Python are object-oriented: and what that means I could never quite sort out beyond a feeling that Pythin does NOT give you objects, you have to make them yourself.

Greenfoot supplies objects and the language seems to have been simplified to the point where one can learn almost nothing transferrable whatsoever.

And, while xTalk (meaning HC - MC - RR - LC - OXT) maybe Object-based it seems that very little metalanguage is required to be able to program with it (and I never learnt any metalanguage for FORTRAN, BASIC, PASCAL, ZILOG, or TOOLBBOK either: perhps that was not necessary); and this metalanguage associated with Object-oriented languages seems to be more obfuscatory than explanatory.

My children, when we were in K.S.A. and U.A.E., being looked after by a wide variety of 'alternative' carers, picked up Tagalog, Singhalese, and Arabic WITHOUT anyone having to explain metalanguage such as 'verb', 'noun', 'gerundive', and so on.
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3297
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Greenfoot

Post by richmond62 »

Statements of this sort:

"Object-oriented programming is a software programming approach that uses data, or objects, as its primary structural element."

Do NOT make clear what is the difference between Object-Based and Object-Oriented programming.
https://richmondmathewson.owlstown.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests