12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>C++</strong> Class Frameworks and the Visual Component Model<br />

The Visual Component Library: The New<br />

Kid on the Block<br />

In 1995 <strong>Borland</strong> <strong>in</strong>troduced a revolutionary new product called Delphi. It was an <strong>in</strong>stant hit.<br />

Delphi offered rapid application development (RAD) us<strong>in</strong>g someth<strong>in</strong>g called components.<br />

Components are objects that can be dropped on a form and manipulated via properties,<br />

methods, and events. It’s visual programm<strong>in</strong>g, if you will.<br />

The concept of form-based programm<strong>in</strong>g was first popularized by Microsoft’s Visual Basic.<br />

Unlike Visual Basic, though, Delphi used a derivative of Pascal as its programm<strong>in</strong>g language.<br />

This new language, called Object Pascal, <strong>in</strong>troduced OOP to the Pascal language. In a sense,<br />

Object Pascal is to Pascal what <strong>C++</strong> is to C. Delphi and Object Pascal represented the<br />

marriage of object-oriented programm<strong>in</strong>g and form-based programm<strong>in</strong>g. In addition,<br />

Delphi could produce standalone executables. Real programs. Programs that did not require<br />

a runtime DLL <strong>in</strong> order to run; programs that were compiled, not <strong>in</strong>terpreted; programs that<br />

ran tens of times faster than Visual Basic programs. The programm<strong>in</strong>g world was impressed.<br />

Delphi didn’t just throw Object Pascal at you and let you flounder. It also <strong>in</strong>troduced the<br />

Visual Component Library (VCL). VCL is an application framework for W<strong>in</strong>dows programm<strong>in</strong>g<br />

<strong>in</strong> Object Pascal. But VCL is not really comparable to OWL and MFC. Yes, it is a<br />

framework, but the core is very different. It is different primarily because it was designed<br />

around the concept of properties, methods, and events.<br />

You may be wonder<strong>in</strong>g why I’m talk<strong>in</strong>g about Delphi. The reason is simple—it’s because the<br />

very same VCL that is the heart of Delphi is also the heart of <strong>C++</strong>Builder. That may come<br />

as a shock to you. If you are com<strong>in</strong>g from a <strong>C++</strong> background, you might be scratch<strong>in</strong>g your<br />

head right now, wonder<strong>in</strong>g how that works. If you are com<strong>in</strong>g from a Pascal background,<br />

you’re probably gr<strong>in</strong>n<strong>in</strong>g from ear to ear. If you are com<strong>in</strong>g to <strong>C++</strong>Builder from any other<br />

type of background, you probably don’t care either way. In the end, it doesn’t really matter<br />

because it works. Let’s look a little deeper <strong>in</strong>to VCL.<br />

Components<br />

As I talked about on Day 1, “Gett<strong>in</strong>g Your Feet Wet,” VCL components are objects that<br />

perform a specific programm<strong>in</strong>g task. VCL components are wrapped up <strong>in</strong> Object Pascal<br />

classes. From this po<strong>in</strong>t on <strong>in</strong> this book, we will be encounter<strong>in</strong>g components on a daily basis.<br />

I won’t spend a lot of time expla<strong>in</strong><strong>in</strong>g every detail of components right now because you will<br />

see by example how components work as you go through the rest of the book. Tomorrow I’ll<br />

expla<strong>in</strong> components <strong>in</strong> more detail.<br />

139<br />

5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!