Learning a New Programming Language Part 2: Language Types
(Page 1 of 4 )
Every programming language comes with its own set of basic concepts and particular ways of getting the job done. Actually, most programming languages fall into one of three main types. While it may be easier to learn a new programming language that is of the same type as a language you already know, it is useful to understand all three types, because some are designed to do certain things better than others.
The three main types of programming languages are object oriented (OO), procedural and functional. Again there will be debate on this. Some languages do not fit neatly into these categories depending on who you talk to. The only way that you can get past the debate and get on with learning a language is to try to think in general terms.
Object Oriented Languages
Object oriented languages provide at least some of their functionality through objects. Objects in programming are much like real life objects. They have properties such as size and color and things that they do, which in the case of programming are called methods. Methods work in the same way that functions do in other languages.
A popular example is a motorcycle. A motorcycle has dimensions and colors. There are also types of motorcycles, such as chopper, dirt bike, and so forth. Motorcycles also do things, like start, stop, and so on.
This is where most languages that support objects agree. Beyond this are a lot of features such as classes and inheritance that are not supported by all languages that use objects.
This leads to a debate once again about what constitutes an object oriented language. Some programmers insist on a very specific list of features that a language must have to be declared OO. The debate isn't all that useful however, so once again let's try to keep thinking in more general terms.
A good example is Javascript. Javascript is generally used for client side scripting in a Web environment (Web browsers being the most common application). It is also used to provide automation services for larger applications such as Adobe Acrobat or Macromedia Fireworks. It is essentially a procedural language, but includes some features that are considered object oriented -- and in fact, in some cases Javascript is more useful in these situation than a pure OO language might be.
Presently Javascript does not directly support OO features such as classes or polymorphism. There are plans to make the next major version of Javascript fully object oriented, and in fact there are implementations of ECMA Script 262 on which it will be based, in the wild, in the form of Macromedia's Actionscript 2.0 and Microsoft JScript.NET. Still, what object oriented features Javascript does presently provide can be quite useful.
Next: Code reuse and inheritance >>
More Web Hosting How-Tos Articles
More By Chris Root