Divide and Conquer

   

Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Chapter 5.  Methods


Not that I am endorsing this, or suggesting that you even try it, but how much effort do you think it would be to rip this book in half? There are approximately 1,000 pages in this book, so if you grab the top with your left hand and the bottom with your right hand and pull, can you rip the book?

Okay, I have seen those muscle men shows on television in the middle of the night when someone actually rips a phone book in half, but for the average man it is just too hard! Do you have any ideas about how you could rip the book in half without trying to do it all at once? Can you rip one page in half? Surely! How about ten? Probably.

So, if you divide the book up into one hundred, ten page segments, ripping the book in half is not a problem. What you have just done is called divide and conquer.

Whether it is in war or computer programming, the concept of dividing a difficult problem into smaller manageable problems is powerful. Computer programming divides a problem into modules called methods that perform a set of very specific functionality. Your programs will then be built from methods that you write, and methods that Java provides for you.


       
    Top
     



    Java 2 Primer Plus
    Java 2 Primer Plus
    ISBN: 0672324156
    EAN: 2147483647
    Year: 2001
    Pages: 332

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net