How to get started in computer programming?

Introduction and Background

This article is pretty much focused toward the beginners and newbies in programming field. If you are a beginner in computer programming, have been in this field and don’t have any idea of how to turn the odds in your own favor, this post has got you covered. In this post I will try to share my own experience with you, to teach you how to get started on the right path in programming. Programming and programmers are the friendly ones you may think of. We do create a very friendly product, but it doesn’t mean we are also friendly and that we like to be bugged often. We don’t, and that is just the Rule #1!

In this post, I will share how to get started, what to learn, how to learn and in case you get trouble, what to do.

Keep calm and learn to code
Keep calm, it’s just the beginning!

How to get started?

Computer programming is a very interesting topic nowadays, many beginners just want to join computer programming for the sake of “show off”. It is not a bad thing to do, after all everyone wants to get some attention, some limelight and some fun to do. Computer programming is all of them! No one is left behind, no one is junior (unless they are hired) and everyone can share their knowledge with each other because the platform is very much concise and short.

Computer programming can be of many types, you may want to build software for native metal, you may want to build software for users, you may want to write a program that manages the networking and so on and so forth. The programming languages are also of many types, there are many paradigms involved and above all, there are many “confusing” concepts involved that may blow your mind off before you can even start. I am writing this article to categorize things a bit. 🙂

First of all, just ask yourself a question, what do you want to do with computer programming? There are many answers and every reader that reads this would have a separate opinion to be used. I understand, everyone has a separate perspective from where they see computer. The start of computer programming is by learning computer architecture. Just like cricket, to start playing cricket, you first of all learn what “cricket” is. You learn that this is a game, where two players are standing on pitch, waiting for a baller to ball and the rest are standing at random locations in the ground and so on. Then you start playing cricket, in the beginning you get out, you cannot catch the ball and many other mistakes. Which demonstrate your lack of experience. As time passes, you are experienced and you are a good player. You may be recruited by a “league” to play for them and you become professional.

In a similar manner, to start programming, you start by learning what a computer is! You start by learning about different components of computer. No computer programmer would be found, who doesn’t know where a variable is stored, what processes the commands and so on. If you are unaware of these, please read more about computer architecture.

pfig1
Computer architecture.

Not always, but mostly a computer is a machine that comprises these components. That definition, “A computer is an electronic machine that processes your input data and provides you with an output” is a very old one. Let go of it for a while and learn more about what is computer made of.

I would like to recommend some books and resources, please read them and learn more about computer architecture before diving any further.

Recommended books for Computer Architecture

  • Computer Organization and Architecture: Designing for Performance
  • Computer System Architecture by M. Morris Mano

You may also want to read some more in-depths on Wikipedia.

What is difference between program and programming?

If you are aware of computer, you would also know that a computer itself is not capable of doing anything at all. Computer needs to be taught to do something. Those instructions are “programs”. They are written in a programming language, in a way that is understood by the computer. Actually what happens is something different and in the coming sections, I will cover that.

Programming language is the language in which a program is written in. The language depends on the nature of program. If you want to create a program that controls the hardware from a very low-level, then chances are that you are going to use a programming language that is very close to the machine, otherwise, if you just want to make-up a beautiful GUI program then you will be using a high-level language. Since you are beginner, you will find it interesting to know that there are multiple language for each purpose, already defined and being used.

After all, programming is just like solving the puzzle.

images

Low-level programming vs high-level programming

In programming, you may also want to chose your side. There are types of software programs, some run in the background, where as some run in the front-end to maintain everything that user interacts with. You can then of them as services and buttons. Each button can turn on one service, user is not able to see how a service is performed, but he can see either button is turned on or off and so on.

Below are the descriptions for both, low and high level programming concepts. You can read them and consider choosing one of them wisely.

Low-level programming

Low-level programming is mostly done by “expert” programmers, they have big beard, no hairs on their head, big belly and, they have no sense of dressing. *No offense*

Low-level programming is done using a language that is very much closer to the metal itself. Machine language, Assembly language and C are a few examples of low-level programming languages. Most of the systems are written in Assembly language mixed with some of C programs. Kernel, file system managers, clock managers and similar stuff, they are all written in C.

C provides programmers with a very “solid” grasp over the hardware. You can write any program in C, that your machine is capable of executing. Most of the hardware devices, such as music players can be programmed in C itself. Linux kernel was written in C.

Characteristics of a low-level language:

  1. Smaller memory benchmark.
  2. Good performance.
  3. Easily understood by machine, thus executable.
  4. Smaller in size, not many libraries to work with.
  5. Has to be re-written for every platform.

High-level programming

Since low-level programming handles how computer actually processes, high-level programming focused on the make-over of these programs. High-level programming languages such as Java, C# or C++ focus more on how to create user-applications. Your web browsers, games etc. are written in Java or C# language.

High-level languages are human-readable and very much easy to learn and use for building daily-use applications. Java and C# for example, are very short and concise application programming languages. Languages are very much smart, most of the job is done by language itself.

Microsoft, Oracle and individual programmers have built such languages. Bjarne Stroustrup is one of such individuals. The frameworks they have built is a cross-platform platform. Which means that the same code block can execute on multiple platforms, unlike the previous languages.

Characters of high-level language:

  1. Easier to understand and use.
  2. IDEs process and manage most of the project configuration.
  3. Require compilation, before it can be executed.
  4. Cross-platform support.
  5. Memory-management and resource check-up included.

Reference and recommendation for further read:

You may consider starting learning programming languages from the following links (or books)

You may also consider reading online resources, such as from C# Corner, CodeProject or you may also read my blogs and articles. I have written a number of articles for beginners.

Great, so how to start programming?

If you have read above content, and you are reading to start programming. Please consider selecting a language. A language is more like a tool, or weapon that you are going to use on a war. Choose one wisely, master it and then use it to “program“. Below I will share my experience with some programming languages that I would suggest you to use, you can also share your own experience if you think mine is lacking something.

C programming language:

One of my favorite programming languages, ever built! C is a very powerful programming language and includes everything that you need to in a low-level environment. That’s right, C is used in low-level environment.

Compilers for C language come for free, GNU C compiler (GCC compiler) is one of these compilers. C programming language is used to write operating system kernels, where performance is a “must-have“.

// Sample Hello world program in C
#include <stdio.h>

void main() {
   printf("Hello world from C.");
}
  1. C is a very concise programming language.
  2. Performance factor is really very high!
  3. It can be used on any platform and environment. Highly portable.
  4. You need to manage the memory yourself!
  5. Can be used to write anything.

C++ programming language:

C programming language was designed to be very fast, efficient and portable. When Bjarne started working with C, he noticed that it did not include the concepts of Object-oriented programming. So, he added them in the form of classes, inheritance and overloading. Thus, C++ was born.

C++ is also a good programming language and is low-level and high-level. Both at the same time. Low-level because it is still C, it uses the same concept and philosophy, but can be used to create GUI programs on Windows, Linux and Mac OS X. That is why, it is considered both low and high language.

GNU compiler to C++ can be captured for free! Visual C++ compiler from Microsoft is also a free compiler in Express editions of Visual Studio. I would recommend using Visual C++ or G++ compiler.

// Sample hello world program in C++
#include <iostream>

void main() {
   std::cout << "Hello world from C++.";
}
  1. C++ is a great language to write programs in.
  2. Cross-platform support.
  3. Object-oriented programming language.
  4. Performance is still fast, but not as much as of C, because of the “++“.

Note: Never use Turbo C++ or Borland C++. They are not using or teaching standard C++. Read this post of mine for more on this.

Java programming language

Now we have reached a level above. High-level languages are very easy to learn, easy to write and the IDEs are very much smart that they tell you where there are problems in your source code. So you do not have to focus on anything at all, everything is managed. The code is compiled and streamed down to machine by the IDE itself.

Java was designed to be “cross-platform”, fast, portable and easy. Java uses a special type of compilation, just-in-time. Just-in-time compilation means that the code is compiled on run-time based on the architecture. This means that the code you compiled is never compiled to binary code. The code is compiled to “bytecode”, which is then compiled to machine code when application starts executing. Java uses a virtual machine to execute the code, JVM. This makes the code cross-platform, but also has a cost of performance. Java compilers can be downloaded from Oracle along with the SDK for Java.

Java also supports object-oriented programming paradigm. Java was actually developed to program sandwich toasters, not it is being used on Android operating system too. 🙂

// Sample hello world from Java
class Program {
   public static void main(String[] args) {
      System.out.println("Hello world from Java.");
   }
}
  1. Java is easy to learn and write.
  2. Java code is compiled to bytecode, which uses JIT compiler to compile to native code.
  3. Java uses memory-management to automatically clean up RAM and resources.
  4. Java is a short language, but the simplicity has costed performance a lot.
  5. JVM also requires some RAM to work, in most cases JVM costs 175MB of RAM for itself alone.

fig6_2
Process of compilation of Java source code.

C# programming language

Then comes the prodigal son, C# programming language. Initially C# was designed to work for .NET framework by Microsoft. C# gained popularity so fastly, that Microsoft started using C# for rest of their frameworks, such as Windows Runtime, ASP.NET and so on.

Just like Java, C# is also compiled down to bytecode, then it is compiled to machine code by .NET framework’s virtual machine. C# is similar to C++ in many ways, even their syntax is very much similar. Some say, C# is similar to Java, no it is not. It doesn’t even share the syntax.

C# uses Visual Studio as its IDE, Visual Studio Community edition comes free of cost for learners and self-starters. You can use Visual Studio to get started programming your applications in C# in no time. Visual Studio is one of the best things Microsoft has ever produced!

C# is used to write applications from low-level services (not kernel) to high-level GUI programs like browsers, music players and so on. C# has a great performance factor and is very easy to learn as compared to Java. I started learning programming using C# language and it was very easy for me to learn C#.

// Sample hello world from C#
using System;

namespace Example {
    class Program {
        public static void Main(string[] args) {
            Console.WriteLine("Hello world from C#.");
        }
    }
}
  1. C# is a very easy language and has a great community of helpers.
  2. C# is high-level language.
  3. C# has a great IDE, Visual Studio; world’s best IDE.
  4. C# can be used on multiple platforms (like Linux, OS X etc.) using Mono-Project.
  5. C# can be used to build web applications, software applications and many more programs.

bapp01f001
Process of compilation of C# source code.

Where to look for help?

I may sound a bit “friendly” to you, but I am not. Send me an email with subject “My code doesn’t run, says NullReferenceException”, and I will show the definition of “rage”. In such cases, when you stumble upon an error, do not ask questions. Because every programmer has went through the same stages, done the same mistakes, but they are very “egoistic” to accept that you are just like them. So am I!

In case if you get an error, please Google for it. For example the problem, “NullReferenceException error” (which is a C# exception), Google will return a number of “good” answers or solutions to this problem. You may also find my article in the Google results, What is a null error in code Execution. These articles, blogs and answers are already posted across the internet, for you to read and understand.

Programming is all about understanding. No one will ever spoon feed you! Because that is your own job, to feed yourself. If you are unaware of anything, don’t be shy. Just ask Google. Google will provide you with “excellent” articles and blogs by “expert” developers and programmers. Read them, try them and understand them.

If you still don’t get a good answer (provided that you have tried to Google for it at least once) you may continue to ask for a question at one of the following great communities.

  1. C# Corner
  2. CodeProject
  3. Stack Overflow

Chances are that you will get a good answer to your questions, very soon! 🙂

What’s next?

Computer programming doesn’t just stop there. Learning a programming language is just the beginning. The main part of computer programming is to use the concept of programming and to build something useful. There are many computer fields that require your interest.

  1. Graphics
  2. Networking
  3. Cryptography
  4. File systems
  5. Kernels

Many more similar things can be learnt, understood and built using a programming language at hand. C and C++ can be used mostly, but in many cases you might also want to use C# or Java.

Programming is all about solving a puzzle. Just the way you use Mathematics to find the area under curve, you would be using programming to solve a computer problem, like cryptography to ensure the data is secure. Once you have learnt these languages, continue to apply your knowledge and experience to these fields. That is where you belong, if you have learnt the basics of computer programming! Computer programming is all about making computers better. Computers, themselves, are just idiots. We are making them genius.

I have always focused my students on learning new things that they can do using programming languages. There are many things yet to be done, there are many things that can be done in a better way. There are many algorithms that can be made better and so on. Programming is not just about re-inventing the wheel. It is about making the wheel better in performance.

Point of Interest

Of course this won’t teach you anything, but this article would give you a good overview of learning programming, getting started and how to learn the language. I have shared my experience and “ideas” with you here. I am sure you will find your own things as you start learning!

Programming never ends, like a “cricket” match does. Once you reach a finish line or milestone, go for the next one. That is how C is turned into C++ and that is how J# is turned into C# and so on.

I wanted to tell you what these frameworks are, what high and low level languages are, I hope you get the idea. 🙂

Good luck!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s