Wednesday, January 20, 2010

What is Computer Programming? (In plain English)

I thought I might address one of the most basic questions that some people might have when reading this blog: "What exactly is computer programming?" (On a side note, if you know what computer programming is, you'll probably want to read something else.)

Let me start out by throwing two metaphors at you (hopefully you'll catch one).
1. Computer programming is like writing a long novel.
2. Computer programming is like working on a very long math problem that takes up multiple pages. (Computer bugs can be viewed as small mistakes in the overall problem.)

Computer programming is the difficult task of trying to convey thousands, and even millions, of tiny details to the computer. Computer programmers use a variety of languages in order to convey the details to the computer such as C, C++, Java, Visual Basic, and C#.

(C is very popular and it actually came after a language named B if you can believe it. C++ just means "C plus 1", which is sort of a joke. Microsoft created C# which is another trendy way of saying "This is a C language but with improvements.")

Each specific programming language has pros and cons and “experts” will debate them but basically all programming languages are the same: they each let you "communicate" with the computer.

Computer programs are very, very long. Short programs consist of thousands of lines of code while programs like Word, Internet Explorer, and Firefox have millions of lines. "Bugs" in the computer program occur when something unexpected happens that the programmer didn't expect. Since most commercial computer programs have millions of lines of code, they will probably have a few bugs because of the enormous number of users. (Eventually a user will do something that the programmer didn't expect.)

Computer programs usually consist of two parts: the user interface (front end) and the "main logic" (back end). The user interface is everything that you see on the screen and can be very complicated to program. The “back end” is whatever the program is supposed to do. The “back end” for Word is moves words around and writes files to the hard drive.

And one last explanation, you’ve probably encountered the words “object” and “method”. An object is typically a noun, a good example would be a “Person” object which would hold data about a person. A method is part of an object that does a specific task like Person.getName() which would get the full name of the person. And just to make things *more* confusing the words “object” and “class” mean the same thing as well as “method” and “function”. (Hey, no one said learning this stuff was going to be fun, ha.)

If you are NOT a programmer and have read all of this well…consider yourself an honorary computer programmer (in training). Go print yourself a nice, big certification of completion in Word. :--)

p.s.
And just in case you have never seen real code, below is a simple Person class with the methods getName() and setName(). This example is written in Java.
class Person
{
private String name;

public String getName()
{
return name;
}

public void setName(String n)
{
name = n;
}
}

4 comments:

Silly Freak said...

i know this is a very common mistake, but classes and objects are NOT the same!

A class is like the blueprint for an object, it defines its shape and behavior. A card has a name and a cost, and can be played. however, a class has no values for these properties. One actual card can have a name and a cost, but not "card" itself, the class

Forge said...

I was trying to say that non-programmers can consider classes and objects to be the same, since a non-programmer will never be programming so they will only read the words "class" and "object" so in a sentence where they are essentially the same thing.

I might seem biased toward programmers but I'm not. Programmers just think of the world (of computers) differently than everyone else, so I have to either talk programmer-ese or to regular, computer people :)

Programmers actually think of the whole world (not just computers) differently, probably like how a car guy sees different vehicles. (I barely know my left tire from my right one, (ha, bad joke)).

Forge said...

This week I have one good article about a new version and one mediocre one. :-)

girls escort milano said...

It won't have effect in actual fact, that's what I suppose.