Pages of interest:
I've been programming computers as a hobby or job or both since 1983.
I started with
BasicLanguage and some assembly on the
CommodoreSixtyFour and
AppleIi. I discovered that the only way to keep large BASIC programs manageable was to impose rules on myself to keep the code organized. Then someone showed me
PascalLanguage and I realized that I was doing structured programming in BASIC all along.
My next "discovery" was how to implement
QuickSort in BASIC. You see, the C64 flavor of BASIC didn't have parameterized functions. Thus, doing recursion was non-trivial because none of your variables were saved on the stack frame, only the return address. Therefore, I used a stack to keep track of one side of the partition and looping to sort the other side (see
RecursionVsLoop). I thought I was pretty smart at the time, but I learned later that I was employing
TailCallOptimization and hand coding the other recursion. The technique was invented before I was born. Oh well.
After Pascal I switched to
CeeLanguage because I was in love with the Amiga and it had C as it's most native language. C was good to me for a number of years. Eventually I discovered that the best way to keep large C programs manageable was to impose rules on myself to keep the code organized. I built structures to hold data and wrote a set of functions that all took a pointer to said structure as their first argument, and I only allowed myself to access the structure via those functions. The structure and it's functions all went in a common header file by themselves, with a single .c file for the function implementations. Later I learned that this technique was called
ObjectOrientedProgramming. Actually, to be precise it's encapsulation (
EncapsulationDefinition), but that was when I started
ToGrok ObjectOrientedProgramming. Alas, this was also invented before I was born.
Naturally my next language switch was to
CeePlusPlus, and despite having used several other languages to some degree, C++ is still my preferred language for most things, although
CsharpLanguage looks good for doing GUI work on
MicrosoftWindows, and I've started to test the waters there.
I just wish the newer languages didn't all have
GarbageCollection. My problem with
GarbageCollection is that it treats memory as a privileged resource. First, this takes control away from the programmer, which means that when they do need to do special things with memory they are out of luck. Second, it tends to make managing non-memory resources more annoying because these languages do not easily support
ResourceAcquisitionIsInitialization. As a result we always have to remember to close our files, network connections, etc.
I ask you this, if a programmer cannot be trusted to release memory, what makes us think they can be trusted to close a file or a network connection?
[Discussion moved to
DeterministicResourceManagement]
.
CategoryHomePage