A r t i c l e s
|
Elite Pascal Programmer Myths
|
Myth 1
Pascal source is self documenting or close to self documenting
Fact
These elitist and purist Pascal programmers should be hit on the head with a baseball bat. Pascal can be verbose at times and contain a lot of type conversions and casting, and can get obfuscated. It can also contain pointers and addresses which get obfuscated, along with pchar casts when interfacing to C libraries.
Although Pascal is a clean language, in no way is it self documenting and in no way should anyone write code without commenting it. I say this as a modern Pascal programmer myself, so do not assume I am being biased looking down on Pascal from some other language. Pascal is not self documenting.
I think this may be why Anders Heljsburg coded the TurboPascal in un-commented assembly code; egotistical people who assume their code is perfect and need not be explained. These people need to step off their high horses and they need to be struck with a baseball bat to knock some sense in to them. Sorry for being so violent, but I'm sick and tired of this elitist and false attitude. As Borland grew, by the way, Anders learned that his little selfish uncommented assembly code based compiler was not going to work at all for the entire team of developers in the future.
Myth 2
Modern Pascal is an object oriented language
Fact
Modern Pascal (fpc, delphi) is a hybrid language with both procedural style development along with nested functions (allowing partial lexical closures) and classes and objects. It has object and classes available as almost an extension to the language, but you wouldn't even know it was an extension as it is really built in.
Modern Pascal also contains built in types such as Ansistring which act as a glorified structure with special capabilities (one might even call it an object but you don't have to create it yourself or free it). It is hard to label modern Pascal a "object oriented language" when it is more of a compromise and a "real world language". Modern Pascal has no purist attitude that Java and Smalltalk have.
The object orientation available in modern Pascal does not intend to be a pure object oriented language (i.e. smalltalk style). Modern Pascal does not focus on message sending or passing only. Modern Pascal allows one to use regular procedures and routines without tying them to an object. The objects in modern pascal are more like glorified structures with a SELF. Every time one makes a call to an object method, it is very similar to calling a procedure or routine with a hidden self parameter pointing to a structure instance.
Modern pascal may be more of a glorified procedural programming with extended records or structures (how Wirth calls them). In my opinion, it is a good thing that Modern Pascal is not pure and object oriented since for one there is no such thing and for two, purism will cause the programmer to become a pretentious and anal retentive message passing idiot.
A hybrid language is a compromise. Real life programming always requires compromises and hybrids. Say no to object purism.
Myth 3
Since pascal is case insensitive and whitespace insensitive the code can be written any way we feel individually.
Fact
It gets hard on the eyes when 3-10 developers all use different coding styles in a source file package. Case insensitivity and whitespace insensitivity is useful when the code does not fit into the standard scheme in rare circumstances - such as a very long line of code that needs to be split up, or a very important variable that needs to be pointed out in some special way. Case insensitivity and whitespace insensitivity should not be abused all the time - it is only there as an extra useful feature for situations where code does not fit into a disciplined coding style.
For example, case insensitivity should not be used like follows:
begin
for i:= 1 to 4 Do
Begin
if i = 4 then BEGIN
for i:= 1 to 3 do
begin
end;
END;
end;
End;
Above we have a bunch of different indentations and capitalizations which makes the code inconsistent - and for what reason? Note the "Begin" versus "begin" versus "BEGIN", and inconsistent indentation styles.
It annoys the other developers who are part of the project if the code is not consistent. When whitespace and case insensitivity has been abused instead of utilized for a valid special purpose, it really is a shame. Just look at the freepascal compiler sources to see a horrible mess, for example.
|
|
About
This site is about programming and other things.
|