|
Programming Language |
Object Oriented |
Strict Typing |
Exception Handling |
Garbage Collection |
Smart Block Syntax |
|
C |
no |
no |
no |
no |
no |
|
C++ |
mixed |
no |
yes |
no |
no |
|
C# (C sharp, .NET) |
? |
? |
yes |
? |
? |
|
Pascal |
no |
yes |
no |
no |
no |
|
Object Pascal |
yes |
? |
? |
? |
no |
|
Objective C |
yes |
no (dynamic) |
mixed |
no |
no |
|
Java |
yes |
yes |
yes |
yes |
no |
|
Perl |
mixed (>5/6) |
mixed (>6) |
yes (>5) |
yes (scripted) |
no |
|
PHP |
mixed (>4/5) |
no |
mixed (>5) |
yes (scripted) |
mixed (<3) |
|
Python |
mixed |
no (dynamic) |
yes |
yes (scripted) |
yes |
Numbers represent the major version number for which a feature is available.
Object Oriented mixed means that you often see applications with mixed imperative and object code. This is often the case for languages in which exception handling was added later.
Strict Typing Strict typing means that you explictly need to typecast variables from one type into the other, rather then that is done automatically for you by the compiler. Note that strict typing is only possible for static typed languages (in which the type checking is done at compile time), but not for dynamically typed language, such as Objective-C and
SmallTalk (in which type checking is done during runtime).
Exception handling mixed means that while you can make try{} constructs yourself, most built-in function instead still return a mixed type (for example, a positive integer on success and the boolean false or "-1" on failure) or require you to call a seperate error function, instead of throwing an exception itself. This is often the case for languages in which exception handling was added later.
Garbage Collection Automatic garbage collection; unused variables are automatically free()'d, so there are no memory leaks. This is important, because in most programmers are not up to handling memory management.
Smart Block Syntax Most applications use curly brackets { } to group statements, forming a block. However, this has the inherent problem that it is often a fight between style fanatics to either save space and write it on the same line as the condition, or style fanatics to write it on a seperate line, aligning the opening and closing brackets. There are better alternatives for curly brackets (most language designers feel that curly brackets where a terribly idea in the first place). Bellow are some alternatives.
/* C syntax with starting bracket on same line as the conditional statement */
if (x==
3) {
echo "three!";
return;
}
/* C syntax with the starting bracket aligned with the closing bracket */
if (x==
3)
{
echo "three!";
return;
}
/* C syntax, with Whitesmiths style C indentation, arguing that { and } are not part of the if statement */
if (x==
3)
{
echo "three!";
return;
}
/* Pascal Syntax: begin and end instead of { } */
if (x=
3) then
begin
echo "three!";
return
end;
/* PHP, shell syntax: using endif (of fi) as end statement, if automatically implies begin of a block */
if (x===
3) :
echo "three!";
return;
endif;
/* Python syntax: indentation implies nesting, no need for end or } syntax */
if (x==
3)
echo "three!"
return
There are no comments on this page. [Add comment]