Devs, I found some not-perfectly-ellegant pieces in the source code. Do you plan to "nice-ify" the code in 1.3?
Like:
objList _ submorphs select: [:m | m isKindOf: ScriptableScratchMorph].
and
(procs select: [:p | p isRunning]) size = 0 ifTrue: [^ self popStackFrame].
I feel it should be something like:
objList _ submorphs select: [:m | m isScriptableScratchMorph]
or, even:
objList _ submorphs select: #isScriptableScratchMorph.
and
procs detect: [:p | p isRunning] ifNone: [^ self popStackFrame].
There's probably more of it, I just browsed for a while since I want to understand the forever/broadcast/wait etc. behaviour.
Offline
Where does everyone even find the source code? I've looked everywhere to try and find it but can't.
Also, on topic, surely if the source code works there's no need to change it? I would suggest they change it if theirs was taking up, say, 10 lines instead of 1, but both lines are roughly the same length and they both work. Why change?
Edit: Then again, I'm not really classified to say much as I don't personally understand that code. I'm afriad HTML (xHTML), CSS and Ruby is as far as my coding knowledge goes.
Last edited by Kingbradley6 (2008-08-25 08:28:08)
Offline
Kingbradley6 wrote:
Also, on topic, surely if the source code works there's no need to change it? I would suggest they change it if theirs was taking up, say, 10 lines instead of 1, but both lines are roughly the same length and they both work. Why change?
Well, there's more to it.
1. There are no unit tests. :-(
2. If any larger project that evolves is managed with "don't touch it when it works" fashion, it will inevitably lead to big ball of mud, which you are unable to change any more without big hassle. No developer will like working on the project any more. It is just a matter of time. You MUST improve it, whenever you see fit. But without unit tests, everyone fears that he/she breaks something, which is, in effect, "don't touch ...".
3. These were only first-time catches. There are things which can be changed more than line for a line. Event dispatching, for example, should be done using polymorphism and VIsitor-like pattern, not nested ifs. Using same string (at least, use a symbol!) all over for discriminating mouseclicks and keypresses is sign that the code needs a big improvement.
4. I'm just kind of person that is very sensitive to code quality, this post doesn't mean I don't like Scratch and that I don't thank the team for bringing it.
5. #ownerThatIsA: killed me. Is this how one programs in Morphic? #firstOwnerSuchThat: is much closer to my heart.
Offline
If they can code Scratch then I'm sure it doesn't make a difference to them what they are looking at as long as it is bug free and works.
Like I said I can't really comment as I don't fully understand the source code. However I am a web developer and to me, as long as the code works I don't mind what the code looks like, whether it's 10 lines or 1 or whether it's HTML 4.0 or xHTML 1.
If you feel you can add to Scratch why not edit the source code and release your own version or create a program like Scratch from scratch?!
Offline
Hehe! Good points, deerel.
Isn't it comforting, though (and perhaps even revealing), that Scratch is the *only* completed, widespread end-user capable application developed in Squeak I'm aware of (okay, there's Etoys, Plopp and Sophie), that is done in Morphic without any fancy XP rituals involved (and even ignoring a few code-style "laws")?
Offline
It is still small project (I was surprised how small), but I think there is time for doing it right, at last (the code shows it was done to work, but many times in a hurry and without taking style into account). I believe beautifying would open new possibilities that may be hindered by today's slightly visible spaghettiness.
As for doing Scratch from the scratch, interesting idea, but I'd like to practice refactoring legacy code instead... it is bigger challenge.
Last edited by deerel (2008-08-25 17:02:10)
Offline
And so I took the Scratch image to the top of the mountain. Thus spake the blind augur: "Beware creeping elegance!"
Last edited by WidgetFarmer1 (2008-08-26 00:42:38)
Offline
We have made the Scratch source code available to those who are interested in exploring and experimenting with Scratch.
You can find it here: http://scratch.mit.edu/pages/source
Please read through to learn the terms of the Scratch source code license.
We understand that it might not be as "elegant" as other source code, but we must focus our development on making modifications to the software itself.
Since the source code is not intended for the public at large, we do not offer as much support.
If you have specific questions, we will try and answer them for you if you click on "Contact Us". To get answers to your questions in a more timely manner, we recommend you post questions in this forum to seek advice and share solutions with other developers.
Offline
mletreat wrote:
We have made the Scratch source code available to those who are interested in exploring and experimenting with Scratch.
You can find it here: http://scratch.mit.edu/pages/source
I know this is slightly off-topic...
If I wanted to learn to code in this would I need to download both Smalltalk and Squeak or just one of the two?
Also, is Smalltalk similar to Ruby as I do know that
?
Last edited by Kingbradley6 (2008-08-26 14:22:29)
Offline