![]() | A Wikibookian suggests thatCompetitive Programming bemerged into this book. Discuss whether or not this merger should happen on thediscussion page. |
Computer programming is the craft of writing useful, maintainable, and extensible source code which can be interpreted or compiled by a computing system to perform a meaningful task. Programming a computer can be performed in one of numerous languages, ranging from a higher-level language to writing directly in low-level machine code (that is, code that more directly controls the specifics of the computer's hardware) all the way down to writing microcode (which does directly control the electronics in the computer).
Using programming languages and markup languages (such asXHTML andXForms) require some of the same skills, but using markup languages is generally not considered "programming." Nevertheless, many markup languages allow inclusion of scripts, e.g. many HTML documents containJavaScript. There are exceptions where markup languages do represent programming such as SuperX++ (http://xplusplus.sourceforge.net/) and o:XML (http://www.o-xml.org/)
Computer programming is one part of a much larger discipline known assoftware engineering, which includes several different aspects of making software including design, construction and quality control. The subject of this book is software construction, that is, programming. Computer programming is also a useful skill (though not always necessary) for people who are interested incomputer science. Whereas software engineering is interested specifically in making software, computer science tends to be oriented towards more theoretical or mathematical problems.
![]() | Wikiversity has learning materials aboutComputer Programming |
Many people think they must choose a specific programming language in order to become a programmer, believing that they can only do that language. They ask themselves, "Should I be aC programmer or aJava programmer?" That's completely the wrong question. The right question is "How can I become agood programmer?" Unfortunately the employment market has contributed greatly to misconceptions about computer programming by companies advertising for employees with a specific (therefore limited) computer language skill-set and responses being handled by human resources(HR), without someone with a programming background.
There are a few points one can make about what a good programmer knows about specific computer languages. First - many languages are based on the same fundamental building blocks. Learning a language should be seen more as a way of acquiring those concepts than language or machine specific techniques. Second - good programmers are generally competent in more than one language because it is naturally interesting and useful to find different ways of solving problems. It is not necessary to master many different languages or even more than one—a programmer could excel in one language and have only a vague working idea how to program others. It is useful to know many different methods for solving computer problems, also known as algorithms. Analgorithm is a list of well-defined instructions for completing a task, and knowing several languages means having the ability to list the computer instructions in many different ways. Since computer programming languages have so much in common, it is generally easy to learn a new programming language once you have mastered another.
So how do you get started? One reasonable technique would be to just pick a language and run with it. Unfortunately, we cannot suggest what the right computer language might be for all people for all purposes. Ask ten programmers what language you should learn and you will get ten different responses. Given the collaborative nature of this wikibook, you'll probably get as many responses as there are programming language books on the site.
There is a common misconception by people unfamiliar with computer programming that all programming languages are essentially the same. In one sense this is true because all digital electronic computers translate programming languages into strings of ones and zeros called binary, orMachine code.
While mainstream, personal computer languages tend to be derived from a specific tradition and are very similar (hence the popularity of this misconception), some languages fall into different paradigms which provide for a radically different programming experience. Programming inJava is quite different from programming inassembly language, which is quite different from programming inHaskell orProlog or Forth, etc.
In the American Scientist article The Semicolon Wars[1], Brian Hayes classifies languages into four categories: imperative, object-oriented, functional, and declarative. Imperative and object-oriented languages tend to be used in the mainstream, whereas functional and declarative languages tend to be used in academic settings. Functional and declarative programming enthusiasts might argue that the paradigms are 20 years ahead of the mainstream and superior in many respects; however, mainstream language advocates would probably counter that such paradigms are hard to learn, or not very practical for their own unpopularity, among other things. We do not make any claims about who is right on this matter, but at the very least, we will suggest that building familiarity with the four major paradigms is an extremely valuable exercise.
When it comes to computers, all things are made, and function primarily by, programming. Although programming is an essential part of the functionality of any computer or application, not all programming languages are the same. In fact, they are very different from one another with different uses, functionality, and different levels of complexity. A programming language, in the most basic way, is a set of rules or guidelines that is used to write the computer programs. Even though you are writing the program, you may need a certain type of software or program for the language that you use. There are many different types of programming languages that can be used and each has a different set of rules. Programming has two basic categories. There are low-level and high-level languages, the difference between the two is that low-level languages often use 0s and 1s, and this works because it gives the computer the ability to quickly understand what needs to be done or executed. High level languages are easier to write because they are much closer to the English language and are much more flexible to write with, although there are also different levels of this readability as well and different categories of these languages that can be written. A few examples would be Visual Basic, C++, and Java.
Programming languages tend to have many general concepts in common. One can examine the recurring concepts and how they are expressed in various languages in the following table.
←
Table of language concepts and how they are expressed in various languages.
To see a comparison of syntax in various programming languages, seethese "Hello World" examples. For a list including various computer languages arranged together by syntax terms and patterns, seeWikipedia's lists of computer syntax patterns.
Computer programming is really just about solving problems. It turns out that a large number of the problems you encounter in the real world are really just special cases of a more general problem. Luckily for you, many of these problems have been studied by computer scientists for a very long time, sometimes leading to provably unbeatable solutions, or sometimes solutions which are "good enough" for every day needs. In short, learning a language gives you skills, but learning data structures and algorithms shows you how to use these skills wisely.
The following languages deserve special mention, being significant languages in the development of structured programming languages and object-oriented programming. They are worth understanding for the concepts they introduced.
An editor is simply a text program like Notepad. It is said that a programmer's best friend is the editor. A good editor is lightweight, has only essential tools and should support syntax highlighting for your language.
Examples of good editors for which we have teaching books are(alphabetically):
For more text editors, see Wikipedia'stext editor category.
Unix native
Windows "native"
Cross platform