Components: build, beg, or buy?

by Kent Reisdorph

Part of the power of C++Builder is the VCL and its components. Need a split window? Drop a few components on your form. Need a file open dialog? Drop a component on your form. Components make your life easier, plain and simple. The more components you have, the more efficient you are.

The VCL, however, is far from complete. There are many programming needs that are not covered by the VCL. For those needs you will either have to write your own components (build), use shareware or freeware components (beg), or purchase commercial components (buy). The route you go depends on a number of factors. I will explain some of those factors in this article.

Build

There are a number of reasons to go the route of building components:

·You have a programming need that is not addressed by available components.

·You work for a company that insists on everything being in-house.

·You feel you cannot afford commercial components.

·You simply want to learn how to write components.

Some of these are certainly valid reasons. If you have a programming need that is not covered by any available components, you may have no choice but to write that component yourself. Component vendors typically write components that can appeal to a large audience. Anything that applies to a small audience is probably not going to be available in the third party component market.

Some companies insist that all code be produced in-house to reduce reliance on third parties. Custom components will have to be written in cases like this.

Probably the poorest reason to write your own components is because you feel you cannot afford to purchase commercial components. Granted, it depends on whether you program for a living or you are a hobbyist programmer. Except for hobbyists, it rarely pays to write a component if one is otherwise available.

I like to use TurboPower’s AsyncProfessional as an example. AsyncProfessional is a set of components for serial communications. It includes components for basic serial communications, TAPI support (including voice modems), faxing via a fax modem and much more. At the time of this writing, the retail price of AsyncProfessional is $349.00 (US). It would easily take 10-12 man months to write the equivalent of AsyncProfessional. Do the math and you can see that it could cost from $50,000 to $100,000 to reproduce the features found in AsyncProfessional. Obviously, it does not pay to write components for full serial communications support when they can be purchased for a mere $349.00.

Writing components for the knowledge attained is certainly a viable reason to build rather than buy.

Beg

I used the word beg here simply because it fits with the alliteration used in this article’s title. What I mean by this is to obtain freeware or shareware components. Most shareware and freeware components are available as Delphi components but they can probably be used in C++Builder without much additional effort.

Shareware and freeware components are certainly an option, but some care must be taken when using this type of component. There are many good freeware and shareware components available. There are many more that are not up to the quality you have come to expect from the VCL components. You may have to kiss many frogs before finding that prince.

A common problem with shareware and freeware components is documentation and support. You may find a component with online help, but many won’t contain any documentation at all. Certainly it is rare to find a shareware component with printed documentation (if, in fact, one exists at all).

Installation is often a problem with shareware and freeware components. Some include pre-built packages but most are simply a collection of source files that you are expected to put into a package on your own.

Finally, consider that the hunt for a suitable freeware or shareware component may be more costly than purchasing a proven commercial component. Time is money. Consider the scenario where you spend several days finding, installing, and testing a component only to find that it doesn’t work as advertised. It looked like a good deal to start with but now you have lost valuable time and must start again. I recommend that you only use shareware and freeware components that come highly recommended by your peers.

I want to stress that there are many good shareware and freeware components. I don’t want to leave the impression that all components in this category are less than adequate.

Buy

Finally, you can buy commercial components. Buying commercial components has several advantages over building your own components and over shareware and freeware components. Some of those advantages are:

·Full documentation, often including printed documentation

·Technical support is almost always provided (free or fee-based)

·Professional component design and implementation

·Efficient cost vs. effort ratio

·Typically come with full source code

·Professional component installation

Most of these points are self-explanatory so I won’t go over them in detail. Buying commercial components is a good solution if you can find components that fit your needs. It is efficient from a monetary standpoint (buying is much less expensive than developing). Typically commercial components come with some form of tech support. Documentation is also provided with commercial components.

One of the most compelling reasons to use commercial components is that they often come with full source code (at least those from reputable companies do). This means that you are never stuck with a set of components that becomes outdated in the unlikely event the company from which you originally purchased them is no longer available. You have the source so you can modify it as needed.

All in all, commercial components allow you to implement a particular bit of functionality with the least amount of time and money involved.

A word about Delphi components

Most of the commercial, shareware, and freeware components you find will be written in Delphi. There are a number of reasons for this. First, Delphi was available several years before C++Builder. The Delphi component vendors were already established by the time C++Builder came on the scene. As a result, the majority of the VCL third party component market has a Delphi code base. Second, Delphi components can be used in both Delphi and C++Builder. The converse is not true; components written in C++Builder cannot be used in Delphi. Obviously, it makes sense for component writers to maximize their profit potential by writing components in Delphi.

The fact that most components are written in Delphi is, for the most part, inconsequential. Usually a professional installation is implemented. The component packages are installed directly into the IDE and you can begin using the components immediately.

Earlier I said that most commercial components come with source code. In all but a few cases you will find that source code to be Delphi code. Looking at Delphi code may put you off at first, but it doesn’t take long for the average C++ programmer to figure out what is happening in that code.

Conclusion

You may encounter situations where you must write your own components, and at that time you will have no choice but to write those components. Shareware and freeware components are an option, but one that comes with a degree of risk. Given the choice, I will opt to buy proven commercial components whenever possible.