15.04.2018 Views

programming-for-dummies

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

102<br />

Saving Time with Third-Party Components<br />

Saving Time with Third-Party Components<br />

Programmers are naturally lazy and often look <strong>for</strong> the simplest way to solve<br />

any problem. So when faced with creating a program, programmers prefer to<br />

cheat by using third-party components, which are programs that somebody<br />

else has created already (and hopefully tested).<br />

Third-party components usually offer commonly needed features, such as a<br />

word processor, a spreadsheet, or a database, that you can plug into your<br />

own program. So instead of having to write your own word processor, you<br />

can buy a word processor component and plug it into your own program;<br />

now your program has word processing capabilities with little additional<br />

<strong>programming</strong> on your part.<br />

Third-party components can give your program instant features, but they can<br />

also give you instant problems, too. If the third-party component doesn’t work<br />

right, your program won’t work right either and you can’t fix the problem until<br />

the company that sells the third-party component fixes the problem. Basically,<br />

third-party components put you at the mercy of another company. If that other<br />

company stops updating and improving their component, you’re stuck with an<br />

outdated and possibly buggy component.<br />

Depending on the features, third-party components can range in cost from a<br />

few hundred dollars to a few thousand dollars or more. Most third-party<br />

components aren’t cheap, but because they can save you a lot of time, they<br />

may be worth the price.<br />

Optimizing a Program with a Profiler<br />

Not all parts of a program are equal. Some parts of a program may only run<br />

once or twice, whereas other parts of a program may run hundreds or even<br />

thousands of times. For example, suppose you have a program that stores<br />

names and addresses. To use this program, you must first type in your name<br />

and password be<strong>for</strong>e you can sort and search through the program’s list of<br />

names and addresses.<br />

In this example, the part of the program that asks <strong>for</strong> a username and password<br />

runs only once, but the part of the program that searches and sorts<br />

through your list of names and addresses may run multiple times. So which<br />

part of your program determines its speed? The part that runs once (asking<br />

<strong>for</strong> a username and password) or the part that runs multiple times (searching<br />

and sorting names and addresses)?

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

Saved successfully!

Ooh no, something went wrong!