Fundamentals of Programming: Part 1 – Introduction

by
Inf

Hello there! Welcome to my Fundamentals of Programming series of post. In this series, I will teach you about the basics of programming, i.e. the building blocks and what makes a program tick. I will NOT teach you Java, C++, PHP, Python or whatever pretty language you can think of. Instead, I’ll keep it language-independent so that even a complete beginner to programming will be able to follow.

I don’t know how many parts there will be and I don’t know if I’ll have time to write about everything I can think of at the moment.

Here is what I intend to cover. I may add other things afterwards:

  1. What is programming? Questions and IDEs
  2. Algorithms, Pseudo Code, Batch Jobs
  3. Style, Indentation and Comments
  4. Variables and Arrays
  5. Data Types
  6. Conditions
  7. Loops
  8. Functions
  9. Classes
  10. Libraries and Plugins
  11. Syntax and Programming Languages
  12. Errors and Bugs
  13. In Real Life

So please stick around and I hope you will enjoy reading my series of posts. Of course, your comments, questions and suggestions are welcome. I’d really like if my programmer friends, contacts and anonymous readers out there would provide some inputs in these posts to help beginners.

Without further delays, let’s start.

What is programming?

That.

Ugh! What are all those brackets?! What are those awful colors! Public WHAT?! My brain is melting!

Keep calm! Breath in. Breath out. Are you alright? Fine. Don’t worry about this at the moment. You’ll understand more as we go along so just be patient. At least, be positive! It’s in English!

Programming is basically giving instructions to a computer so that knows how to accomplish some task. Why would you need that? Well, everything you do on your computer, you’re doing it through programs. You’re currently viewing this page through a program that allows you to view webpages. You are using a program that gives you an environment to run other programs. Everything is a program. You are in the Matrix. Haha.

Well yes, programs are everywhere. And guess what? Each of these programs were written in some programming language. That thing you just saw above? That was a programming language. That’s what is used to make programs. That is, the “Firefox” or “Internet Explorer” or “Safari” or “Chrome” etc you are using to view this page at the moment? It was written in a language that resembles that one above.

Programming is writing programs in some language. There you have it.

 

Why do we need programming?

Simple! To make your computer understand what to do or what you want it to do. There’s a difference in that and we’ll see about it a bit later.

Computers are generally dumb machines of metal, silicon, plastic and lots of tiny little stuff that beep, light up and do other wonderful things. But they don’t really understand English. They only work with 2 numbers: zeroes and ones.

Programming is you telling it instructions, but you have to tell the instructions in some language the computer understands. If you think you have to write in zeroes and ones, you’d be correct but not completely.

Programming in zeroes and ones was done at the very start. It was hard as hell because, well, do you think something like 01001100 is meaningful to a human? Nope.

Some person thought it would be a good idea to translate some of those codes into meaningful words and have the computer translate this language into its zeroes and ones.

That person hence created a program that converts English words like “if” into computer-meaningful things like 01001100. Nowadays, you write English and your computer figures the rest out for you after you click a few buttons here and there. Then you see your shiny new program running and you’re happy.

This translation process, if you wish to know, is called “compilation”. There’s also “interpretation”. Both are basically translations, but compilation is done all-at-once while interpretation is done as-you-go.

 

How many languages are there?

Too many. Estimate? Above 4500. Be scared.

 

Waaait what?! How can I learn all that?!

You’re not supposed to. You’ll probably be fine learning one of them and you can write nice little programs. But why do we need so many languages? That’s because languages are created for specific tasks. For e.g. PHP is used to create dynamic web sites. That is, the web pages react to things you do, instead of being just boring, static, non-changing pages.

Other languages are for other things for e.g. C++ is used when there’s need for high speed of execution i.e. the program should run fast.

 

So how do I get started?

Well, you could read books on some language you want to learn. But if you don’t understand programming itself, it’s pretty much pointless to do that. Did you learn English by reading Shakespeare? OMG FOR REAL?!

Nah you probably started by learning letters. And made a mess on walls everywhere. Then you learnt words. Swear words I bet. Then you created sentences. Then you wrote your first paragraph etc etc until at the end, you can finally understand English pretty well.

Programming is like that too. You have to start from the start. What is the start? Letters.

Not really. Programming languages are mostly in English. Mostly. There are some truly weird things out there. But yes, mostly English. So you already have a head start. What you need to learn are the words actually. And that’s what this series of posts will try to teach you about.

You’re not expected to be able to write codes at the end of the series. That will probably be for another series some time later. But at the end, I hope you’ll be able to read a program and able to think about how to write your own program.

I’ll make sure to use plenty of examples while writing so you get to know how programmers think when they are confronted with a solution.

 

Is there any special equipment I need?

Not really. All you need is a working, powered-on computer, keyboard, mouse, screen and an Internet connection. For advanced programming, you may also want to look into pcb solutions. Since you’re here reading this, you’re all fine.

Ironically, you’ll be using programs to write programs. Interesting huh? First programs were actually “written” using punch cards so these were not really programs. Then after a whole lot of troubles and annoyances, we arrived at the languages we use today. Be happy you don’t have to program in binary. Zeroes and Ones, if you didn’t know what binary (2 numbers) means.

Programmers do use a number of tools to facilitate their task. You can use “Notepad”, that simple text-writing program in Windows that nobody likes. Love it, it’s a nice program. If you’re  using Mac or Linux or some other operating system, just find a text editor and use it.

When you become more familiar and get more powerful (HAR!), you’ll want to use more capable tools. We call these “Integrated Development Environments” (IDEs). Fancy term for “big program that allows me to write big programs”. It’s still a sort of Notepad. Just one on steroids.

You don’t need to bother about any of these for the moment, although you may want to check out Notepad since it makes writing the basic codes I’ll show you WAY easier.

 

Alright, that’s it for part 1, the Introduction. In the next part, we’ll move on to how programs are born. See you! If you have questions and comments, use the form below.

 

[seriesposts title=”In the same series:” titletag=”h3″ listtype=ul show_date=0]

 

Sources:

Picture