Saturday, May 17, 2008

What is Programming?
Programming is a creative process done by programmers to instruct a computer on how to do a task. Hollywood has helped instill an image of programmers as uber techies who can sit down at a computer and break any password in seconds or make highly tuned warp engines improve performance by 500% with just one tweak. Sadly the reality is far less interesting!
So Programming Is Boring? No!:
Computers can be programmed to do interesting things. In the UK, a system has been running for several years that reads car number plates. The car is seen by a camera and the image captured then instantly processed so that the number plate details are extracted, run through a national car registration
database of number plates and any stolen vehicle etc alerts for that vehicle flagged up within four seconds.
With the right attachments, a computer could be programmed to perform dentistry. Testing that would be interesting and might be a bit scary!
Two Different Types Of Software:
Older computers, generally those with black and white displays and no mouse tend to run
console applications. There are still plenty of these about, they are very popular for rapid data entry.
The other type of
applications require a mouse and are called GUI programs or event driven programming. These are seen on Windows PCs, Linux PCs and Apple Macs. Programming these applications is a bit harder than for console but newer programming languages like these have simplified it.
Visual Basic
Delphi
C#
What Do Programs Do?:
Fundamentally programs manipulate numbers and text. These are the building blocks of all programs. Programming languages let you use them in different ways, eg adding numbers, etc, or storing data on disk for later retrieval.
These numbers and text are called
variables and can be handled singly or in structured collections. In C++, a variable can be used to count numbers, or a struct) variable hold payroll details for an employee such as
Name
Salary
Company Id Number
Total Tax Paid
SSN A database can hold millions of these records and fetch them very rapidly.
Programs Must Be Written For An Operating System:
Programs don't exist by themselves but need
operating system, unless they are the operating system!
Win 32
Linux
Mac
Before
Java, programs needed rewriting for each operating system. A program that ran on a Linux box could not run on a Windows box or a Mac. With Java it is now far easier to write a program once then run it everywhere as it is compiled to a common code called bytecode which is then interpreted. Each operating system has a Java interpreter, called a Java Virtual Machine (JVM) written for it and knows how to interpret bytecode. C# has something similar.
Programs Use Operating Systems Code:
Unless you're selling software and want to run it on every different operating system, you are more likely to need to modify it for new versions of the same operating system. Programs use features provided by the operating system and if those change then the program must change or it will break.
Many applications written for Windows 2000 or XP use the Local Machine part of the
registry. Under Windows Vista this will cause problems and Microsoft is advising people to rewrite code affected by this. Microsoft have done this to make Vista more secure.
Computers Can Talk To Other Computers:
When connected in a network, they can even run programs on each other or transfer data via
ports. Programs you write can also do this. This makes programming a little harder as you have to cope with situations like
When a network cable is pulled out.
Another networked PC is switched off.
Some advanced programming languages let you write programs that run their parts on different computers. This only works if the problem can use
parallelism. Some problems cannot be divided this way:
Nine women cannot produce one child between them in just one month!
Programming Peripherals attached to your Computer:
If you have a peripheral, say a computer controlled video camera, it will come with a cable that hooks it up to the PC and some interfacing software to control it. It may also come with
API
SDK that lets you write software to control it. You could then program it to switch on and record during the hours when you are out of the house. If your PC can read sound levels from the microphone then you might write code that starts the camera recording when the sound level is above a limit that you specified. Many peripherals can be programmed like this.
Games Are Just Programs:
Games on PCs use special libraries :
DirectX
XNA
SDL So they can write to the display hardware very rapidly. Games screens update at over 60 times per seconds so 3D games software has to move everything in 3D space, detect collisions etc then render the 3D view onto a flat surface (the screen!) 60 times each second. That's a very short period of time but video card hardware now does an increasing amount of the rendering work. The GPU chips are optimized for fast rendering and can do these operations up to 10x faster than a CPU can, even with the fastest software.
Conclusion:
Many programmers write software as a creative outlet. The web is full of websites with source code developed by amateur programmers who did it for the heck of it and are happy to share their code.
Linux started this way when Linus Torvalds shared code that he had written.
The intellectual effort in writing a medium sized program is probably comparable to writing a book, except you never need to debug a book! There is a joy to finding out new ways to make something happen, or solving a particularly thorny problem. If your programming skills are good enough then you could get a full-time job as a programmer.