Website development and design blog, tutorials and inspiration

Introduction to Programming

Learn the basics of computer programming

By , 3rd December 2013 in Software Engineering

Computer Programming is a profession where somebody writes a set of instructions for a computer to process and return a result. You may be very surprised to learn that the first computer program was written in 1842 by Ada Lovelace, daughter of the famous poet Lord Byron.
 

Programming is often thought of as a geeky and nerdy profession, but it is also obvious that creating software requires a certain amount of creativity. At the highest level, it must be clever but not complex, intuitive and easy to use. At the lower levels, creativity also plays an important role. Every line of code is like poetry, every instruction requires consideration of what came before it, and what comes after it. In this respect, programming is like writing a book or painting a masterpiece. Ultimately you have a finished product, but it's the sentences and the brush strokes combined, which is where the book, masterpiece or program truly comes to life.

What is a Program?

A program consists of a number of layers, the first being the User Interface. This is the part that you see on your screen, the buttons you click and the boxes you type into. Beneath that you have the Logical Layer, this is where the processing occurs. It takes uses the information you enter in the User Interface, does some number crunching and returns the results back to the user interface. More often than not, the logical layer will interact with the third layer - the Data Layer. This is where data is stored. The where and how does not concern us at this time, just be aware that it exists and is used to store and retrieve information.

What is a Program Made Of?

A program is made up of statements, often likened to sentences and called "a line of code". On its own it has structure and purpose, but without the context of the other statements around it, it isn't meaningful. Like a book, a program runs from the first statement, to the last, at which point it finishes and is closed. Unlike a book, the program can repeat itself, jump backwards and forwards through the chapters, return to the start or jump to the end.

Groups of statements are known as blocks of code and are often separated into distinct functions. A function is a block of code with a specific job to do that can be re-used anywhere else. When a function is used, we often say that it is "called". An example would be a program to calculate income tax for five people. Rather than writing the tax calculation code five times - one for each calculation - we can write the code once, turn it into a function, and call that function 5 times. This not only saves a lot of typing, but it also ensures that each of the five calculations are performed in exactly the same way. We can also call the function 10 times, 100 times or even 1,000,000 times without having to write it over and over again. This is called structured programming.

Programming Languages

A programming language is the language used to code the program, much like the language used to write a book. Although the fundamental concepts and general practices remain the same, the overall grammar (programmers call grammar syntax) changes between languages. Some programming languages are very "human" orientated, and are written as it you were saying an instruction, while others are a bit more convoluted and require a bit of thought as to what they are doing. The BASIC programming language is one of the easiest to start learning as it is one of the most human orientated, although it is limited. C and C++ are some of the more powerful languages and they allow you to do a lot more than BASIC, however they are much more difficult to understand and to write.

Microsoft C# is a relatively new language and combines aspects of various languages to form an easy to use language, but also powerful. It combines the ease of use of BASIC and Pascal with the flexibility and power of C and C++.

I have written a series of tutorials for learning C# which should help you get started in programming using a modern, easy to use language.

Further Reading
Comments
  1. DoktorThomas™
    DoktorThomas™

    You write, "I have written a series of tutorials for learning C# which should help you get started in programming using a modern, easy to use language."
    Where is the link?

    1. Tim Trott
      Tim Trott

      Below the article. For some reason they were not showing, but they are there now.

      Thanks for pointing that out to me :)

Leave a Reply

Your email address will not be published.