Discuss Scratch

Sigton
Scratcher
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.
  1. 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!

  2. 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]
    repeat until <gameover condition :: Boolean grey>
    change [tick v] by (1)
    broadcast [tick v] and wait
    calculate fps :: custom args
    end
    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.

  3. 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.

  4. 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 having
    when event happens :: hat events
    hide

    when same event happens :: hat events
    switch costume to [costume1 v]
    These could be compacted to
    when event happens :: hat events
    hide
    switch costume to [costume1 v]
    Of 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!

  5. 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!
I hope that these tips help you. Leave support and suggestions down below

Sigton


dolphin_24
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

Wow! These will help Unsure a lot! Thanks.

rollercoasterfan
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

dolphin_24 wrote:

Wow! These will help Unsure a lot! Thanks.
You know, I could help Unsure a lot xD














when [chromometer altimeter v] = [5th length v] and [7th length v] with a [gap v] of (17) ::events hat
forge [chromometer v] altimeter until < (speed) = (velocity)> ::control cstart
switch places with (759 v) altimeters with value of (speed) ::looks
control [altimeter 1 v] at time (10):(17):(58) ::control
end
initialize sequence (24) so [object 3 v] moves to x (156) y (231) ::control
reveal [final answer v] and stop running this script ::events cap
dolphin_24
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

rollercoasterfan wrote:

dolphin_24 wrote:

Wow! These will help Unsure a lot! Thanks.
You know, I could help Unsure a lot xD
You are.

gtoal
Scratcher
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
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

gtoal wrote:

#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! :-)
Ditto

ArurA
Scratcher
73 posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

I'll ditto the ditto.

DeadGoldFish123 wrote:

gtoal wrote:

#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! :-)
Ditto

αяυяα • ρυяє αωєѕσмє

“Nothing will work unless you do.” —Maya Angelou
Sigton
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

gtoal wrote:

#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! :-)
Yeah, that would help. The problem with that is that it's not very short-term
Thanks for suggesting anyway!

Sigton


PeaInAPod
Scratcher
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
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

PeaInAPod wrote:

Nice one! I'm sure this will be very helpful to other people
Thanks!

Sigton


Penguin9090_new
Scratcher
500+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

Nice guide! I requested for it to be stickied.

CLICK PLZ: Games Art Particles Animations Others

There could be invisible text but probably not –>am i wasting your time? Don't click this link. Really. Don't. Click. It.
Click here to dislike my posts!
dolphin_24
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

Penguin9090_new wrote:

Nice guide! I requested for it to be stickied.
I should do that. doing it.

Sigton
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

Penguin9090_new wrote:

Nice guide! I requested for it to be stickied.
Thanks

Sigton


Sigton
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

dolphin_24 wrote:

Penguin9090_new wrote:

Nice guide! I requested for it to be stickied.
I should do that. doing it.
Thanks you too!

Sigton


gtoal
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

Sigton wrote:

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
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

gtoal wrote:

Sigton wrote:

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


Sigton
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

Bump

Sigton


Sigton
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

Bump

Sigton


Paddle2See
Scratch Team
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.

Scratch Team Member, kayak enthusiast, and servant to multiple cats.

;
Sigton
Scratcher
1000+ posts

ITopic: 5 Easy Steps to Becoming a Better Programmer

Paddle2See wrote:

Thanks for making this guide! I've added a link to it from this sticky topic.
Thanks so much

Sigton


Powered by DjangoBB

Standard | Mobile