Pages: 1
Topic closed
I'm just wondering.
For example, in AS2 you're basically running a loop over and over with a starting function and some functions that you can set.
And a 1 sprite 1 script project is kinda like that, apart from the lack of functions (or broadcasts in scratch).
So why does it teach bad programming habits?
Wouldn't a bad programming habit be using the wait block?
Last edited by juststickman (2010-05-01 05:57:16)
Offline
I don't think it teaches bad programming habits. In fact, using 1s1s projects encourages creativity with different types of projects, and actually teaches a good lesson in programming given that it has limits and all programming has limits. Trying to get around the limit is what programming is all about!
Offline
I won't necessarily say it is bad programming habit, I would judge on code itself... :-)
But what is seen as good programming habits by today standards is to break down a program in smaller units easy to understand, and to bring them together to do a complex task.
Apparently these 1S1S projects seem hard to manage and maintain, but hey, they look like fun and challenging, which is, after all, among the main purposes of Scratch, no?
Offline
You can't compare it with AS2 because AS2 lets you properly control everything from the main stage and scratch does not.
In some programs using 1sprite & 1script is acceptable because that is all that is needed. It teaches bad habits when you use 1 sprite and 1 script when you have to make something that requires specific workarounds. Some projects like platformers can be made more simple and efficient with many scripts/sprites. If you learn how to make projects that are more efficient with many scripts and sprites using 1 sprite/script then you are developing bad habits.
Last edited by archmage (2010-05-02 15:31:26)
Offline
you an do alot with 1s1s if you want to cram everything into one script
Offline
I've worked in IT for over 20 years on countless different programming languages and love Scratch for it's wonderful simplicity and that it lets my kids do stuff quickly without them sitting there scatching their heads (sic) trying to decipher stupid compiler errors or figuring out how to call some convoluted graphics API.
Now then... in commercial IT... the equivalent of a 1s1s would definitely be a no-no... one long piece of code with if-then-else blocks nested to the n'th degree is almost impossible to maintain.
Small discrete units of code that you know will work and can pretty much be forgotten about once they've been written and tested is the way forward
1s1s projects are an interesting academic exercise but don't teach you anything useful
Offline
Ratty1967UK wrote:
I've worked in IT for over 20 years on countless different programming languages and love Scratch for it's wonderful simplicity and that it lets my kids do stuff quickly without them sitting there scatching their heads (sic) trying to decipher stupid compiler errors or figuring out how to call some convoluted graphics API.
Now then... in commercial IT... the equivalent of a 1s1s would definitely be a no-no... one long piece of code with if-then-else blocks nested to the n'th degree is almost impossible to maintain.
Small discrete units of code that you know will work and can pretty much be forgotten about once they've been written and tested is the way forward
1s1s projects are an interesting academic exercise but don't teach you anything useful
This point completely sums up my feelings on the matter, I can't describe it more clearly and concisely.
Offline
Ratty1967UK wrote:
I've worked in IT for over 20 years on countless different programming languages and love Scratch for it's wonderful simplicity and that it lets my kids do stuff quickly without them sitting there scatching their heads (sic) trying to decipher stupid compiler errors or figuring out how to call some convoluted graphics API.
Now then... in commercial IT... the equivalent of a 1s1s would definitely be a no-no... one long piece of code with if-then-else blocks nested to the n'th degree is almost impossible to maintain.
Small discrete units of code that you know will work and can pretty much be forgotten about once they've been written and tested is the way forward
1s1s projects are an interesting academic exercise but don't teach you anything useful
I see what you mean. I especially agree with that last point - you've got me convinced! I never particularly tried for a 1 sprite 1 script project and the only times it ever came about happening was if it was a simple engine and only needed 1 sprite and 1 script.
Offline
wildplayer wrote:
you an do alot with 1s1s if you want to cram everything into one script
That isn't very helpful. I know you can do a lot, have you even been reading this thread? My question is why does it teach bad programming habits?
Offline
It teaches bad habits and good habits, because it requires you to think outside the box on how to make your game or other thing work, but it can also teach bad habits, because of the simplicity. I still don't think this is a strong reason, because I like making simplistic projects, and simplistic projects have some of the best on scratch, like Fall Down by M44. The simplicity of FMT's Snake Maze also makes it simple, but fun. I really don't think there are any bad things that come out of 1s1s, besides the thing I mentioned above, but that is still a weak reason.
Offline
juststickman wrote:
That isn't very helpful. I know you can do a lot, have you even been reading this thread? My question is why does it teach bad programming habits?
I don't think it teaches bad programming habits at all! Of course, it doesn't make sense to do in a "real" project, but it makes you think about the efficiency of your programs. I think if anyone had a gripe against this style of programming it would be because it suppresses some features of Scratch. With one sprite and one script you can't use broadcasts, which are an important part of many languages. Also, it's always a good idea to make your programs modular by putting different functionalities in different places where they're easy to access (like on a broadcast script!) You compared Scratch to AS2 in your first post, and I see what you mean, it's sort of like having a single onEnterFrame function to work with. (side note: one way I used to avoid this when using AS2 was to create a function that returned a new empty MC each time it was called.)
var count:Number=0 function evtListener():MovieClip { var m:MovieClip = this.createEmptyMovieClip("hello_"+count,count) count++ return m } evtListener().onEnterFrame = function() { trace("Hello numero uno!") } evtListener().onEnterFrame = function() { trace("Hello numero dos!") }
Last edited by fullmoon (2010-05-14 22:19:23)
Offline
In actionscript the code would ideally be in separate classes. Trying to maintain 500+ lines of code all bunched up is not practical.
Reasons why this 1sprite 1script projects develop bad habits have already been explained in earlier posts.
Offline
Topic closed
Pages: 1