Computer Programming Fundamentals: Understanding How to Program
This article introduces major concepts in computer programming- vital for app developers, web site coders and anyone wanting to customize Wordpress blogs — prepared by ProgrammingHomework.dev programmers.
Computer programming used to be just for computer scientists working with huge mainframe computers in University labs or big companies.
Then, home computing took off with the likes of the BBC Micro (UK) and Atari, Amiga, Spectrums and eventually low-end PCs (with Windows 3.0!)
With the advent of multi-computer connectivity and the Internet, some of the geekiness went mainstream, and suddenly it was cool to have a blog, an email address, and a web site. This is a trend set to continue, and considering that all of today’s must-have online business channels (from social media to WordPress blogs) are dynamic, it’s well worth knowing a bit of programming.
PHP Powers the Web
If you’re not convinced — take a look at your average blog: it’s likely to be powered by WordPress, or one of the other popular CMS (Content Management Software) packages. Everything from Joop to Zoomla, TikiWiki and PHP-Nuke are powered by a simple server-side programming language called PHP.
Many spreadsheets have macros that help to manage the data entry, validation and calculation. These macros are written in Visual Basic, another programming language. Web pages have client side code in them to manage everything from menus to dynamic redirects. These are written in JavaScript.
In fact, it’s almost impossible to be involved with the Internet and World Wide Web without coming across the need to do a bit of coding. Even if you don’t plan to do it yourself, it’s worth knowing a bit about the process of programming to facilitate communication with third party contractors.
Programming Primer — Compiled vs. Interpreted
Programming is a just a way of describing something that we want a computer to do in terms that are unambiguous and precise. If something is compiled, then it can be delivered as a stand-alone application — office applications that are used offline (i.e. not in the cloud) and operating systems (such as Windows, MacOS or Linux) are compiled.
Interpreted languages, such as PHP, JavaScript and VBA are all turned into actions by an application — a web server, web browser or office application — and are usually quite specific to that application. This is changing, as Adobe AIR, for example, uses HTML/CSS and JavaScript to create compiled AIR applications, but generally interpreted languages are quite domain specific.
In between these two extremes are write-once-run-anywhere apps, which are usually created in Java, and then compiled to a special kind of code that can be interpreted by the Java runtime, be it on a phone, a tablet or a PC.
Structuring a Program
A program is usually a series of statements that are executed in a top-down fashion; one after the other. To help programmers manage the flow of control through their program, however, there are a number of different kinds of statements:
- Loops — these allow for repetition, either counted or uncounted;
- Conditional execution — statements that only execute if a condition is met;
- Named code blocks — bits of program that can be executed by name;
- Variables — somewhere to put information;
Counted loops will execute some code for a set number of times. These are usually called for loops. Uncounted loops will execute the code block until a set condition is reached. These are usually referred to as while or repeat until loops.
Conditional execution statements are usually called if statements, but may be extended to if…then…else statements. Named code blocks have several names, such as subroutine, procedure or function.
Finally, variables are just named boxes into which information can be put, and retrieved, rather like the memory function of a desk calculator.
Putting all these concepts together allows sophisticated programs to be built, and knowing a little about each will help you understand everything from the inner workings of your WordPress blog, to that funky macro that your accountant built in Excel to help with the annual tax return.