ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming

Learning Programming - The Basics

Updated on June 27, 2016

What is programming?

First and foremost, to learn programming you must know what programming is. Programming is pretty much the process of taking an algorithm and rewriting it using symbols and a style of writing called a syntax in order to make a computer understand the instruction. Simply put, programming is just the process of helping a computer understand what you want it to do.

In order to do that though you must learn at least one programming language. A programming language is what you would rewrite the algorithm into so that the computer understands what you want it to do. Every program is written in a programming language. Everything you do on a computer was written in some sort of programming language. Once you begin to understand how a programming language works, you will be able to write your own programs!

Programming Languages

There are quite a lot of different programming languages. Some of the examples that we will demonstrate later will be written in a programming language called Java. Simple because it is some what on the easy side to learn. Some other good beginner programming languages are Python, Ruby, and C++. Listed below will be some pros and cons of each of those languages, along with some popular uses for those languages.

Programming Language Comparison

Major Uses
Mostly mobile/web applications.
Can be used everywhere.
Can be used everywhere.
Can be used everywhere.
Mostly used for web/servers.
Used to design websites.
Used to build layouts.
Used for servers.
Used for servers.

Easiest Language To Learn

5 stars for Python

Programming Language Basic Concepts

There are 5 basic topics you need to understand that have to deal with any programming language. That is:

  1. Variables
  2. Control Structures
  3. Data Structures
  4. Syntax
  5. Tools

After understanding these 5 basic subjects you will be well on your way to creating that ideal project you have had in your mind that brought you to this blog post!

Variables are just like Bucky said in the video, they are placeholders. Variables are essentially the backbone to every program ever created, also the backbone to any programming language. Variables are pretty much storage boxes that you gave a name and a type. Inside of that storage box you put the data or the value of it. So for example, if we wanted to store a users name to our website, we would set up a variable called userName and insert the user's name into that variable so we can call it later. As I said above, you would assign it a type as well. So in some languages such as C++ or Java you will have to define the variables type along with it's name. In python you simply just have to assign a name to the variable as you saw in the video above.

Here is an example of what defining some variables would look like:

- Java example:

string userName = "Brian"
int userAge = 27
string userGender = "Male"
double awesomenessLevel = 99.9

- Python example:

userName = "Brian"
userAge = 27
userGender = "Male"
awesomenessLevel = 99.9

As you can see, in Java you are required to define the variable type and name before giving it a value. In Python you would simply use the variable name, the language will do the rest for you. There are a lot of types when it comes to data types though, string, integer, and double, are the most popularly used types. So cool, we have these variables, now what can we do with them!? Well lets take a look at control structures and try to make some sense of all of this.

Control Structures

Programs run in a sequence structure. From top to bottom line after line. So it runs the first line of code then goes directly to the next. Control structures change that based on criteria or conditional criteria. So control structures are all about the flow control of the program. There are a few different types:

  • If-Then Statements
  • If-Then-Else Statements
  • While Loops
  • Do-While Loops
  • For Loops

Don't worry, these are quite simple to understand. For "if-then statements", if the variable is true, then do this task. An example:

x = 10
if x = 10:
	x += 1

As you can see the if statement checks to see if the variable equals 10 and then if it does it adds one to it.

For "If-Then-Else" statements, if the variable is true, then do this task, else do this. For example:

x = 10
if x < 9:
	x += 1
	x -= 1

For the "if-then-else" statement you can see that x = 10 but it is checking to see if x is less than 9, since it is not less than 9 it runs the code after the "else:" line, which subtracts one from the variable.

For "while loops", while the variable is true, do this or these tasks. For example:

x = 0
while x < 10:
	x += 1

As you can see above, while x is less than 10 it adds one to x, once x is equal to 10 the code will break out of the loop and continue moving forward.

For "do-while loops" it does the task first, and then checks to the criteria. For example (this one looks different because this is a java do..while because python doesn't have one):

int x = 0;
 System.out.printIn("x is : " + x);
while(x < 10);

Besides the confusing syntax, which you will read about shortly, you can see that the while check is done after the statements have been ran. You would use this when you want to be assured that the code that would be looped is at least ran once before the condition check.

The takeaway from all of this is that you can compare and check variables based on different criteria or control structures to make the program jump around your code to make it do different things.

Data Structures

Data structures are quite simple to understand. They are the way you store and organize data so that your program can be run more smoothly and efficiently. Simple, enough right? No. It sounds a lot easier than done for beginners especially.

The first time I wanted to create a bunch of contacts my code looked something like this:

contact1 = "Brian Peter"
contact2 = "James Bond"
contact3 = "Karate Kid"
contact4 = "Chelsea"
contact5 = "Dominic Lee"
contact6 = "Rocky Lee"
contact7 = "Lilly Anne"

Well, it looks right, and it is. It is one hundred percent correct, there are 7 contacts there with different string values. Though there is a much more efficient way to write that code. Instead of the program reading 7 lines of code, it can simply read one and have the same effect. (I know it doesn't sound like much but once your program is thousands of lines long, it begins to help.) Here is the one line example:

contacts = ["Brian Peter","James Bond","Karate Kid","Chelsea","Dominic Lee","Rocky Lee","Lilly Anne"]

So what we did was take those 7 variables and put them into one list. Much more efficient than reading 7 different lines of code. We restructured our data structure to make our program run more efficiently. As you begin to venture off into the language you wish to learn you will want to learn about data structure and what you can do to make your program more efficient. The other thing you are going to need to learn is the syntax.


Syntax is something that is tricky at first but once you play with it for a while you will understand it quickly. It is the way your symbols are combined to correctly structure that programming language. Some languages require semi-colons at the end of every line of code and some require opening and closing brackets around blocks of code and some don't.

This is where it is super handy to pull out that programming languages documentation and study the syntax as you are coding to ensure you aren't getting a silly error over and over simply due to syntax errors.

Here is "Hello World!" in JAVA and Python:

// Java example:

System.out.printIn("Hello World!");
# Python Example:

print("Hello World!")

Notice that the difference between the two are quite huge. Some languages require a lot more than others. So make sure you double check and even triple check the syntax of the language that you are learning!


This is a hard section for me to cover because I don't know what specific language you are wanting to dive into. So the biggest take away from this section is to do research in what the best tools are for that particular language. I will list a few for a couple of languages but again, do your research here and see if they will help you before you swear by them!


  • Java Development Kit (JDK) - Downloadable from the Oracle website.
  • Javadoc - This is a documentation generator


  • PyCharm - This is a notepad editor that helps with syntax!
  • Pydev with Eclipse - Another IDE of the free tier.
  • Pygame - if you want to make games!


That is it! That is it? Really? You can now program knowing those 5 basics. You will have your mind toolkit ready to rock and roll. Now just select a nice beginner language to begin with and dive right in. Just remember, don't forget the syntax! Commas and semi-colons tend to be the death of us!

Best of luck!

Why do you want to learn programming?

See results


    0 of 8192 characters used
    Post Comment

    • Brian Peter profile image

      Brian Peter 22 months ago from California


      Thank you very much! I was nervous because this was my first time ever doing something like this. So far it seems to have been doing pretty well. Time to begin the next!


    • Linda Robinson60 profile image

      Linda Robinson 22 months ago from Cicero, New York

      Hello Brian, so nice meeting you. And welcome to hubpages. Absolutely loved your hub, very informative and so well written and such in depth detail and interesting and easy to understand descriptions, awesome. You are an excellent writer and I look forward to following you and reading many more of your hubs. Linda