Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » ITopic: 5 Easy Steps to Becoming a Better Programmer
- Sigton
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
5 Easy Steps to Becoming a Better Programmer
I've decided to make a list of 5 things that help you be a better coder! These may not be the official way of doing things, but I've written what works best for me.

Sigton
I've decided to make a list of 5 things that help you be a better coder! These may not be the official way of doing things, but I've written what works best for me.
I hope that these tips help you. Leave support and suggestions down below
- Planning
Planning is always the most important part. You can't just jump right in and make it up as you go along. Always try to note down what you're trying to do, and how you're going to do it. Say you were to make a RPG. Before you even create the project, get a notepad or a piece of paper or just something to write on. Then jot down your theme, plot, characters, style, setting, etc. You then have the information you need to start, and move onto the next step!- Base Script
This is the script upon your entire game should run. It needs to run quickly, but still do everything in the project. I'd structure my script with as few blocks as possible, possibly looking something like this:when I receive [game loop v]I'd then feed the rest of the game off of the ‘tick’ broadcast, which broadcasts every frame. The only fault with this is ‘wait’ blocks, they slow the loop down and cause lag. I'm also calculating FPS (frames per second). This is very useful, as it lets you see how fast your project is running. Your wanting to aim for 28+ for a smooth project. Below 15 an it's very laggy.
repeat until <gameover condition :: Boolean grey>
change [tick v] by (1)
broadcast [tick v] and wait
calculate fps :: custom args
end
- Efficient Scripting
I know this does sound rather obvious, but it makes a huge difference. A really good trick I learned for efficient coding is only ever using one ‘When green flag clicked’ block per project. The reason for this is when you have multiple, which one runs first? You don't know, so if you just have one, you definitely know the order in which scripts run. Very useful trick. Another trick, which is sort of like step two, is use as few loops as possible at the same time. Loops are a big cause of lag, so having as few as possible is great, with one being ideal.- Compact Coding
Keeping scripts as small as possible really cuts down on lag. A great way of doing this is making each script a little bit smaller, and it all adds up, rather then hyper-compressing one script, which is very difficult and time-consuming. Also, combining scripts works too. Instead of havingwhen event happens :: hat eventsThese could be compacted to
hide
when same event happens :: hat events
switch costume to [costume1 v]when event happens :: hat eventsOf course this is only a basic example, but it can be applied almost anywhere, apart from when combining loops and wait blocks. That will pause the look unwantedly, so keep then separate!
hide
switch costume to [costume1 v]- Labelling
Actually a very important thing, especially in collaborations where others will use your code, labelling is add comments to explain what it is your code is doing. This makes it more understandable, and easier to read. For example, if I was doing some super-complex raycaster engine and didn't label my code, some remixer comes along and thinks, “What on earth does this do?” Not only does it help others understand your scripting, but writing about what your doing makes you understand it more yourself. Make sure to make those labels!

Sigton
- dolphin_24
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
Wow! These will help Unsure a lot! Thanks.
- rollercoasterfan
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
You know, I could help Unsure a lot xD Wow! These will help Unsure a lot! Thanks.
- dolphin_24
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
You are.You know, I could help Unsure a lot xD Wow! These will help Unsure a lot! Thanks.
- gtoal
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
#1 step to becoming a great programmer: write original code, and lots of it! Don't copy code, don't fork some large existing project, don't translate code from other languages, don't get someone else to write the hard bits for you … just sit down and program from scratch, 4 or 5 hours a day for 10 to 15 years. By the time you're 30 or so you'll be a pretty good programmer! :-)
- DeadGoldFish123
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
Ditto #1 step to becoming a great programmer: write original code, and lots of it! Don't copy code, don't fork some large existing project, don't translate code from other languages, don't get someone else to write the hard bits for you … just sit down and program from scratch, 4 or 5 hours a day for 10 to 15 years. By the time you're 30 or so you'll be a pretty good programmer! :-)
- ArurA
-
73 posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
I'll ditto the ditto.
Ditto #1 step to becoming a great programmer: write original code, and lots of it! Don't copy code, don't fork some large existing project, don't translate code from other languages, don't get someone else to write the hard bits for you … just sit down and program from scratch, 4 or 5 hours a day for 10 to 15 years. By the time you're 30 or so you'll be a pretty good programmer! :-)
- Sigton
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
Yeah, that would help. The problem with that is that it's not very short-term #1 step to becoming a great programmer: write original code, and lots of it! Don't copy code, don't fork some large existing project, don't translate code from other languages, don't get someone else to write the hard bits for you … just sit down and program from scratch, 4 or 5 hours a day for 10 to 15 years. By the time you're 30 or so you'll be a pretty good programmer! :-)

Thanks for suggesting anyway!
Sigton
- PeaInAPod
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
Nice one! I'm sure this will be very helpful to other people 

- Sigton
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
Thanks! Nice one! I'm sure this will be very helpful to other people
Sigton
- Penguin9090_new
-
500+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
Nice guide! I requested for it to be stickied.
- dolphin_24
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
I should do that. Nice guide! I requested for it to be stickied.

- Sigton
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
Thanks Nice guide! I requested for it to be stickied.

Sigton
- Sigton
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
Thanks you too!I should do that. Nice guide! I requested for it to be stickied.doing it.
Sigton
- gtoal
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
Yeah, that would help. The problem with that is that it's not very short-term
Thanks for suggesting anyway!
Sigton
Well, if you're in a hurry, you could always go study CS at Edinburgh for 4 years :-)
- Sigton
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
Yeah, that would help. The problem with that is that it's not very short-term
Thanks for suggesting anyway!
Sigton
Well, if you're in a hurry, you could always go study CS at Edinburgh for 4 years :-)

Sigton
- Paddle2See
-
1000+ posts
ITopic: 5 Easy Steps to Becoming a Better Programmer
Thanks for making this guide! I've added a link to it from this sticky topic.
- Discussion Forums
- » Help with Scripts
-
» ITopic: 5 Easy Steps to Becoming a Better Programmer