How to Program

Understand comments., Use variables., Use control structures., Use data structures., Use proper syntax., Utilize tools.

6 Steps 3 min read Medium

Step-by-Step Guide

  1. Step 1: Understand comments.

    Comments are text which does not appear or affect the program in any way.

    These are used by programmers to leave notes or information for themselves or future programmers.

    Generally, one or a series of characters will tell the computer that text is a comment and not part of the program, though what those characters are will depend on the programming language being used.For example, using the Python language the hash or number sign indicates a comment.

    In C++, it’s //.
  2. Step 2: Use variables.

    Variables make up a large portion of any program code.

    These are how the program stores information.

    Essentially, you will create a tag for the information you are storing and then tell the program what the information is.

    This can look something like: spam = ‘LifeGuide Hub rocks’.

    Now whenever the program later searches for spam, it will know that that is LifeGuide Hub rocks.

    This type of code can be used, for example, to let a program learn someone’s name, by recording it from an earlier input and attaching it to a variable. , Basically, control structures tell your program how to navigate or what to do.

    If you’ve ever done a choose-your-own-adventure book, this is pretty much what control structures are.

    In programming, this usually takes the shape of statements that use “if”, “while” or “for” statements, for example.

    You will need to use these statements and use them correctly if you want to program correctly. , Data structures are a program’s shorthand for accessing a lot of information at once.

    This will keep you from having to type in lots of variables, as you can instead just type in any new information and attach it properly to the list using code.

    Examples of data structures you might use include lists or key/value pairs (sometimes called HashMaps)., Programming languages really are just like other languages in many ways.

    And just like other languages, there are rules that make programming ‘sentences’ either work or not work.

    Syntax refers to the specific order or layout of words, symbols, and numbers that make a programming language function.

    It is important that you learn the proper syntax for the programming language you are learning, since (unlike in spoken language) the computer will not automatically understand when you make a mistake and compensate for it. , There are a number of tools that can be used to help you write your code, such as IDEs.

    Programs like IDEs can allow you to better visualize your code.

    Make sure you research and know some of the tools that are available to you, as this can make programming much simpler.

    While most IDEs are specific to a particular programming language, others are more multipurpose, like Microsoft’s Visual Studio.
  3. Step 3: Use control structures.

  4. Step 4: Use data structures.

  5. Step 5: Use proper syntax.

  6. Step 6: Utilize tools.

Detailed Guide

Comments are text which does not appear or affect the program in any way.

These are used by programmers to leave notes or information for themselves or future programmers.

Generally, one or a series of characters will tell the computer that text is a comment and not part of the program, though what those characters are will depend on the programming language being used.For example, using the Python language the hash or number sign indicates a comment.

In C++, it’s //.

Variables make up a large portion of any program code.

These are how the program stores information.

Essentially, you will create a tag for the information you are storing and then tell the program what the information is.

This can look something like: spam = ‘LifeGuide Hub rocks’.

Now whenever the program later searches for spam, it will know that that is LifeGuide Hub rocks.

This type of code can be used, for example, to let a program learn someone’s name, by recording it from an earlier input and attaching it to a variable. , Basically, control structures tell your program how to navigate or what to do.

If you’ve ever done a choose-your-own-adventure book, this is pretty much what control structures are.

In programming, this usually takes the shape of statements that use “if”, “while” or “for” statements, for example.

You will need to use these statements and use them correctly if you want to program correctly. , Data structures are a program’s shorthand for accessing a lot of information at once.

This will keep you from having to type in lots of variables, as you can instead just type in any new information and attach it properly to the list using code.

Examples of data structures you might use include lists or key/value pairs (sometimes called HashMaps)., Programming languages really are just like other languages in many ways.

And just like other languages, there are rules that make programming ‘sentences’ either work or not work.

Syntax refers to the specific order or layout of words, symbols, and numbers that make a programming language function.

It is important that you learn the proper syntax for the programming language you are learning, since (unlike in spoken language) the computer will not automatically understand when you make a mistake and compensate for it. , There are a number of tools that can be used to help you write your code, such as IDEs.

Programs like IDEs can allow you to better visualize your code.

Make sure you research and know some of the tools that are available to you, as this can make programming much simpler.

While most IDEs are specific to a particular programming language, others are more multipurpose, like Microsoft’s Visual Studio.

About the Author

K

Karen Clark

Committed to making DIY projects accessible and understandable for everyone.

44 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: