Monday, June 28, 2010

Programmig like there is no MS Windows OS

There is nothing worse than a Delphi programmer programming like a Visual C programmer. Delphi programmers have the advantages of being able to create applications that are relatively isolated by the Windows OS. This is why most applications compiled for Windows 3.1 are still working on Windows 7.
However, there are some areas that Borland didn’t cover (non insulated code). One of them is Internet-oriented applications. For this kind of applications the Delphi coder has to rely on MS libraries. Well, there is the possibility to rely on complex 3rd party Delphi libraries but this is not better that relying of MS libraries. Maybe worse. We all know how many 3rd party libraries died or were left to be eaten by time and rust.

I have seen that some people (especially those that are not from Europe or other countries that have lawsuit against MS) imagine that any computer in the world has to have MS Office and Internet Explorer installed by default! Well people, it is not like that. You cannot just believe (religion has no place in programming) or even hope that the client has the latest Win 7 64 bit OS, service pack, IE, IE updates, XML libraries, dot NET, Java, etc, etc, etc, etc, installed in its machine. You need to start from the premise that they have none of them installed. Only then your application may be robust and working on all Win OS platforms.
So, depending on MS libraries is obviously pure evil for a Delphi programmer (and not only). But we still need to connect to Internet and do fancy stuff such as downloading files (well, for Delphi this is indeed fancy!) while keeping the application system-independent and robust. So, we have to choose between using a 3rd party library which will probably get obsolete and unmaintained sooner than later or to use MS libraries. The thing with using Delphi code to connect to internet based on MS libraries is that the code seems unreliable. It is not multithreaded and it lacks the support for detecting connectivity problems. The application may freeze to death if the, physical connection breaks, if the modem dies, if the ISP is down, if the web server is not responding, etc.
So, let’s see the advantages as disadvantages:

3rd Delphi party libraries:
* They may die and get obsolete.
* Large libraries (such as Indy) will increase the compilation time with several good seconds!
* Are difficult to maintain
* May have poor support (if any at all)
* Many of them that anti-freezing support

Code based on MS libraries (such as IE)

* May not work in all computers (especially in Europe)
* Have no anti-freezing support
* Difficult to use (no support also)

I actually don't know what it worst: application freezing (for a long while) while trying to connect to Internet or application not downloading the file until you convince the user to manually install stuff (MS internet related libraries) in its computer. Basically if you convince the user to go to MS web site and install stuff, then you will rather send it directly to your web site and manually download the stuff your program needs :) :) :) :) :)

Some may instantly fall into the sin of thinking that the “solution” is to deliver the libraries with the application, and install them when the application starts. Well, do you really mess up with user’s system? They are so possessive about their computers. As soon as they will see you installed stuff into their system core they will immediately start posting of forum how evil your application is and how you have tried to take over their system.

No comments:

Post a Comment

Post a Comment