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.

48<br />

Designing Programs with Today’s Methodology<br />

Main Program<br />

Main Program<br />

Figure 2-8:<br />

Objectoriented<br />

<strong>programming</strong><br />

never<br />

physically<br />

copies a<br />

subprogram<br />

but “points<br />

to” or<br />

“inherits” a<br />

subprogram.<br />

Subprogram<br />

Copy #1 of subprogram<br />

Copy #2 of subprogram<br />

Copying a subprogram<br />

creates multiple copies<br />

of that subprogram.<br />

Object #2<br />

Object #1<br />

Subprogram<br />

Object #3<br />

Instead of making copies of a subprogram, objects “inherit”<br />

a subprogram. This leaves a single copy of a subprogram<br />

that can be used in multiple objects.<br />

Discover more about the details of object-oriented <strong>programming</strong> in Book II,<br />

Chapter 7. For now, it’s just important that you understand why programmers<br />

use object-oriented <strong>programming</strong>. Then you can worry about figuring<br />

out how to use object-oriented <strong>programming</strong>.<br />

Designing Programs with Today’s Methodology<br />

Each step, from spaghetti <strong>programming</strong>, to structured <strong>programming</strong>, to<br />

event-driven <strong>programming</strong>, to object-oriented <strong>programming</strong>, is meant to<br />

guide programmers into writing better-organized programs that can be modified<br />

quickly and easily. Today, object-oriented <strong>programming</strong> is popular, but<br />

tomorrow, another <strong>programming</strong> methodology will likely arrive to deal with<br />

the shortcomings of object-oriented <strong>programming</strong>.<br />

With the exception of spaghetti <strong>programming</strong> (which you want to avoid),<br />

structured <strong>programming</strong>, event-driven <strong>programming</strong>, and object-oriented<br />

<strong>programming</strong> can be used by themselves or together. You might use objectoriented<br />

<strong>programming</strong> to divide a program into objects, and then use structured<br />

<strong>programming</strong> to organize the commands you write and store inside<br />

each object. Finally, you can use event-driven <strong>programming</strong> to design a fancy<br />

user interface so people know how to use your program.<br />

By using each <strong>programming</strong> methodology’s strengths, you can create a welldesigned<br />

program, on time, that actually works. Given the track record of<br />

government agencies and Fortune 500 corporations, creating working software<br />

on time is the closest thing to a miracle that most people will ever<br />

experience in a lifetime.

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

Saved successfully!

Ooh no, something went wrong!