Programming

Programming is writing instructions for a computer. You write the instructions in a programming language that both you and the computer can understand. there are lots of other programming languages out there. PHP happens to be the best programming language for use in Web sites, the easiest to learn, and is the best language to use when teaching programming.

Sales people continually bombard us with products that promise some magic result without programming. When you read the instructions you find you are programming. The programming language may not look like the programming languages you see in magazines but it is still programming. In fact the programming languages you see in magazines do not look like the programming languages used back when the British invented electronic computers or the programming language Lady Lovelace invented for Charles Babbage's Analytical Engine back in the 1830s. Every type of computer and every type of programming activity brings a new language; often in a new form.

Early programming languages were binary because that was what computers understood. The programming languages were not much different to the punched cards invented back in 1801 to program Jacquard weaving machines. When computers became more powerful, the computers were used to translate human readable languages into the computer's binary language. Today many human readable languages are translated to an intermediate language then the intermediate language is translated to binary.

People who have never programmed, have created Microsoft Excel macros and other forms of programming, so yes, they have programmed. Some alarm clocks let you create a program because they let you set the time then the type of alarm, the duration, and volume of the alarm, and other options including the snooze interval. In effect you are telling the machine to perform a series of operations and to make decisions based on your parameters. Programming a large scale computer system is not much different, there are just a lot more options and you can add many more steps.

There are natural languages for describing programs in the language we speak every day (if you happen to speak like a computer). Natural languages are not natural because they have limited vocabularies and ranges of expression. You have to spend a lot of time thinking about how the computer will interpret your words and try to guess the right mixture of words to force the computer the right way.

Even if a computer could understand your language, most people say things in a shortcut way based on them assuming the listener knows part of the answer. When you ask your friend to buy some bread, do you tell them the type of bread, the address of the shop, or how much bread you want? A computer might buy 100 loaves of bread because the previous purchase was 100 loaves but the computer might not realise the last purchase was for your birthday and you do not need 100 loaves today when it is just you and the computer for lunch. Your friend can think about the number of people that might turn up (you and your friend), the type of meal (lunch), and work out that one loaf is enough.

The reason computer programming starts out so slowly is that you spend a lot of time telling the computer how to do simple things. After a while you build libraries of reusable instructions that save you time. The reusable instructions may be called macros, functions, classes, snippets, but they all contain something you wrote before and want to use again.

You can get libraries of reusable code from other people. Large collections of working code are applications. Collections of applications built to work together in a Web site are called content management systems. Some companies call their content management systems a portal in an attempt to make the software sound more important. Portals are just Web sites that pass you through to other sites; which has nothing to do with the software used to create the site.

Usable, reliable, dependable programs have a number of attributes including good program structure and coding practices. Occasionally I run workshops on the right way to do things and in most cases, the right way is also the easiest way in the long run. The best practices might add a few minutes to the first day of work but those practices are saving you hours by the end of the project.

Programming styles

Programmers often work to a specific style with names such as MVC and OO. I will expand on these two examples because they show two ends of the style spectrum.

OO means Object Oriented and is a good style for programming languages that allow the use of objects, something that generally does not apply to older programming languages. There are lots of styles within OO and many cases where OO is not appropriate. Most programmers agree OO is the best choice for large or complicated programs and OO of any style is better than no OO.

MVC is more of a special use and a fashion. MVC means Model View Controller. Read more in MVC. MVC splits applications into sections or layers, a good idea for anything large, and artificially defines the three sections. There is so much disagreement about what goes in each section that the segmentation becomes meaningless. The one part that everyone agrees on is separating presentation of data from everything else and most MVC based software achieves that but not necessarily any better than similar separation in non MVC software. Like OO, there are many different styles of MVC. Unlike OO, MVC has very few agreed principles outside of the general desire to separate presentation.

Conclusion

You can learn to program; you are probably programming devices already. PHP is the best programming language to learn if you want to build a Web site. For most Web sites, you will develop your Web site faster by skipping programming and going straight to a good content management system. Make sure the content management system is built on PHP so you can easily find people to extend the system when needed.