The PowerBuilder Foundation Classes (PFC) were introduced with
PowerBuilder 5 and enhanced in PowerBuilder 6. PFC is a set of PowerBuilder objects that
provide the basis for developing robust PowerBuilder applications. PFC objects provide a
consistent framework that can be used across PowerBuilder applications. PFC libraries may
be customized or extended to enhance the existing PFC functionality. The libraries also
include useful non-application routines, such as debugging and SQL trace objects.

PFC was written using PowerBuilder and delivered as PowerBuilder objects
with supporting PowerScript source code. PFC uses advanced PowerBuilder object-oriented
coding techniques and features a service-oriented design.

PFC provides a great deal of logic in ancestors and services. Having
this pre-built code provides a number of benefits:

it reduces the amount of code that you have to write to get a working
application

it tends to reduce the number of errors in your application. PFC logic is
pre-built and tested (and generally solid for a product its size). With less code to write
yourself, you should encounter fewer bugs.

it allows you to select from a series of "bells & whistles"
(e.g. dynamic sorting, filtering on any list, etc., etc.). There is a lot of useful
functionality that you probably wouldn't include in an application if you had to build it
from scratch yourself

it provides a solid structure for building your own company and
application specific ancestor code. This is done in the extension layer(s).

Early frameworks often used a "pure ancestor" approach where
all the common logic was placed into ancestors. Frameworks like PFC use a hybrid approach
where some functionality is provided in ancestor objects while the majority of logic is
placed into services. The pure inheritance based approach suffers from these
disadvantages:

on any particular descendant object, it is common that only a small
percentage of the ancestor functionality will actually be used. Therefore, the large (or
"fat") inherited ancestor approach results in significant wasted memory on the
client and a longer ancestor loading time.

It is difficult to group functionality in ancestor objects. The result is
ancestors that are large, unwieldy, difficult to maintain and hard to review.

If logic needs to be re-used by another application (especially a
non-PowerBuilder application), it is difficult to re-use or extract the relevant logic
from the ancestor.

A service-based approach places functionality into a non visual (or
custom class) object. Objects like a Window (or DataWindow) may break down their
functionality so that there is a main Window object which has 10-20 supporting services
available. Various services are turned on (i.e. loaded into memory) when the descendant
object specifically requires the functionality. The descendent object then specifically
uses functionality provided by the service.

With logic broken into user objects (which are loaded as needed), the
service based approach avoids the problem of "fat" ancestors where very large
ancestor objects must beloaded into memory (and have only a small portion of their
functionality actually used). Each service that is used does inflict a small performance
penalty since the service must be separately loaded into memory at runtime. Another key
benefit of service-based objects is that they are more easily reviewed and maintained
since each service is a logical bundle of related functionality.

PFC uses a combination of ancestor objects and services. Logic that is
very commonly used (e.g. CloseQuery) is simply placed into ancestor to avoid service
loading overhead. On the other hand, the bulk of the functionality (which is used only on
occasion) is placed into services.

No pre-developed class library can meet all the needs of a development
project "out of the box". PFC offers an extension (or PFE) layer which allows
for customization of PFC without modifying the underlying PFC code itself.

PFC implements an extension level in all its inheritance hierarchies.
These extension objects reside in separate PBLs so that they are unaffected by PFC or
PowerBuilder upgrades. The extension objects have access to all instance variables,
functions and events in the PFC ancestor library. Literally any functionality in any
object can be extended or overridden, if needed. PFC Extension Strategies are discussed else on this
site.

PFC could be used on the majority of PowerBuilder projects and be very
helpful. There are a few kinds of PowerBuilder project where PFC might not be suitable:

A small project (e.g. 10 windows or less). When using PFC, there is
certainly overhead in terms of learning curve, EXE/PBD size, etc. If you are only going to
develop only one or two small applications, the costs of PFC would outweigh the benefits.
Incidentally, if you only have a small project or two, then Visual Basic (VB) would
probably be a better choice than PowerBuilder. VB is "easier" to use for small
projects and it creates smaller executables. VB starts to become the weaker choice on
medium-sized projects and VB is just not the right tool for large projects where
PowerBuilder excels.

PFC version 5 doesn't work easily with 3-tier/n-tier architectures. By
default, PFC issues updates directly to the database (assuming the two-tier model) and it
takes some serious investigation and overriding to make PFC suitable work in a 3-tier
model. PFC version 6 introduced self-updating objects which should provide a much more
natural method for creating 3-tier applications.

If your project has a number of unique/non-standard requirements
(particularly related to the user interface), you might find that PFC doesn't meet a
number of your requirements. Although PFC can be extended, you might find that another
framework provides a better fit for how you are trying to build your application.

The truth is that if you haven't worked with a framework before (e.g. an
earlier PowerBuilder framework or possibly a C++ framework), it is difficult to fully
appreciate the "value" and the amount of work you save by using a framework.
Consider the following sources to improve your understanding of PFC and its benefits:

see the sample application(s) that come with PFC. By using these
applications, you can see a number of services in action.

consider buying one or both of the PFC Reference books that are available
at the www.amazon.com site. The Powersoft Foundation Class Library Professional Reference is written
by Block, Brown, Gasin, Green and the PFC Programmer's Reference Manual is written by
Richard (Rik) Brooks.

If you decide to use PFC, you should seriously consider using version 6
-- it comes with the PowerBuilder 6 Enterprise edition. The documentation with PFC 5 was
spotty and it is greatly improved in PFC 6.