Imperfect World

From Programmer 97-things

Jump to: navigation, search

Contents

The Perfect World

When we take courses in Science a lot of times we are dealing with a perfect world. I remember in a physics course many years ago we had a swinging pendulum experiment and went through all the math to get the frequency of the swing and amplitude and so on. But no where was the issue of damping - that is how long will it take before the pendulum stops completely or maybe even gets to half the amplutude.

The damping can be attributed to a few external forces, some obvious some not.
1. The minute inflexibility of the string, that is, the energy required to bend the string.
2. The damping effect of wind resistance.
3. Possible readioactive particles from the earth and from out of space bonbarding the pendulum in a way as to make it stop.

Maybe I can go on, but you see the point. In no way will any system physical or even abstract that is set in motion be able to perfectly accomplish it's tasks.

The real world

As Software Engineers or any type of systems architect when we begin to create a system that has in it inherent complexities, we usually have ways to deal with those complexity. But eventually the task is accomplished. But, it will never be accomplished perfectly. Sometimes we get one in the batch with a flaw like a bad processor, or maybe the entire batch is flawed like the "Dan 0411 - Pentium II Math Bug" issue some years ago. Anyway, there will come a time when we just have to stop fixing possible issues and sell the damn thing or else we will be over engineering and that will be just too costly.

The four common thing programmers have to content with

The language of choice

Like any craft person, programmers must be able to express her/himself. This allows then to work! It takes the form of the language that they will ultimately choose to create their solutions.


The compiler of choice

Also a language must be implemented by a vendor of choice. Or maybe the practitioner chooses open source, regardless there will be a compiler or IDE that they must use to get the job done.


The operating system

A lot of times programmers have to implement their solution on a platform of choice An operating system. Maybe it can be multiple operating systems, maybe Unix - or a certain flavour. Or 'just' Windows. knowing that 'just' can imply Win2000, 2003 Server, XP, Vista and Windows 7.


The browser

Maybe it has to be web based so they deal with a browser or multiple browses. The idea of the browser is important since it is clear to any web developer that in dealing with multiple browsers there will be gotchas to content with.

What has to be done to the four

In any case when we deal with the language, or compiler or platform there will be lots of gotchas that we have to deal with. Therefore...


As practioners dealing with imperfect tools and environments,
we should avoid the 'bad' features and try to use the 'good'
features. We should try to research the flaws that exists in
the language, compilers, operating systems and browsers and
avoid those things that can make it difficult to maintain
or create a solution.


Language Example

A good example is the use of the 'C' function strcpy with a NULL pointer. In some cases this call will fail with an access violation, thus you should write your own version of strcpy or do specific checks against NULL pointers when using strcpy. Or simply avoid it - as is all the rage! And if you are a C++ Programmer lets not even talk about macros. The debate goes on forever. Bloated code v.s. Easier reading code, eccetra.


Vendor Example

An example is the apparent inability for Visual Studio 2008 to co-exists with Office 2010 (for which there is a fix). Or if you have experience with Borland tools in particular Borland C++ 6 (2002) this compiler used to access violate quite a bit during compiling and debugging.


Browser Example

For one, I.E. and Mozilla have different ways to initilize the Ajax engine. Also, keyboard event handling is 'very' different in some cases makes it difficult to get a common system that uses the arrow keys and functions keys together in a cross browser application.


Operating Systems Example

Windows use of Fibers. This is a technology created to make porting Unix code easier into Windows. There are certain conditions where the use of fibers may be 'bad' so you will want to use threads instead.

Also in Vista there is some evidence that finding a common place of storage via an API call may not exists. That is, if you want to write you own data files to disk outside the use of a database, say.

In Windows 2000, 2003 Server and XP, there was the Documents and Settings All Users Application Data folder. Now in Vista and Windows 7 it is not as obvious and API calls to find a common area is more ambigious.


In Summary


The idea is that you shoud be trying to learn as much as possible about the apparent flaws and weaknesses of the language, tools and environments around you, especially the newer ones that is supposed to fix some of these flaws. With this in mind you will accomplish your tasks with as little unknows as possible. Frankly these unknows can popup and can be quite embarassing, questioning your ability to deliver.

Just keep rummaging!

Personal tools