SlideShare a Scribd company logo
Learning Cocoa with Objective C 2nd Edition James
Duncan Davidson download pdf
https://ebookfinal.com/download/learning-cocoa-with-objective-c-2nd-
edition-james-duncan-davidson/
Visit ebookfinal.com today to download the complete set of
ebook or textbook!
Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Learn Objective C for Java Developers 1st Edition James
Bucanek (Auth.)
https://ebookfinal.com/download/learn-objective-c-for-java-
developers-1st-edition-james-bucanek-auth/
Objective C phrasebook 2nd ed Edition David Chisnall
https://ebookfinal.com/download/objective-c-phrasebook-2nd-ed-edition-
david-chisnall/
Objective Proficiency Student s Book with Answers with
Downloadable Software 2nd Edition Annette Capel
https://ebookfinal.com/download/objective-proficiency-student-s-book-
with-answers-with-downloadable-software-2nd-edition-annette-capel/
Learning PowerShell DSC 2nd Edition James Pogran
https://ebookfinal.com/download/learning-powershell-dsc-2nd-edition-
james-pogran/
Engineering Design with Polymers and Composites 2nd
Edition James C. Gerdeen Phd Pe (Author)
https://ebookfinal.com/download/engineering-design-with-polymers-and-
composites-2nd-edition-james-c-gerdeen-phd-pe-author/
Learn Cocoa on the Mac 2nd Edition Jack Nutting
https://ebookfinal.com/download/learn-cocoa-on-the-mac-2nd-edition-
jack-nutting/
Objective C Programmer s Reference 1st Edition Carlos
Oliveira (Auth.)
https://ebookfinal.com/download/objective-c-programmer-s-
reference-1st-edition-carlos-oliveira-auth/
Objective C Quick Syntax Reference 1st Edition Matthew
Campbell (Auth.)
https://ebookfinal.com/download/objective-c-quick-syntax-
reference-1st-edition-matthew-campbell-auth/
Combined Standards Glossary 4th ed Edition Ann C. Davidson
https://ebookfinal.com/download/combined-standards-glossary-4th-ed-
edition-ann-c-davidson/
Learning Cocoa with Objective C 2nd Edition James Duncan Davidson
Learning Cocoa with Objective C 2nd Edition James
Duncan Davidson Digital Instant Download
Author(s): James Duncan Davidson, Inc. Apple Computer
ISBN(s): 9780596003012, 0596003013
Edition: 2
File Details: PDF, 6.03 MB
Year: 2002
Language: english
• Reviews
• Examples
• Reader Reviews
• Errata
Learning Cocoa with Objective-C
By Apple Computer, Inc. , James Duncan Davidson
Publisher: O'Reilly
Pub Date: September 2002
ISBN: 0-596-00301-3
Pages: 382
Copyright
Preface
Audience
About the Example Code
How This Book Is Organized
How to Use This Book
Conventions Used in This Book
How to Contact Us
Acknowledgments
Part I: Cocoa Overview and Foundation
Chapter 1. Introduction to Cocoa
Section 1.1. The Mac OS X Programming Environment
Section 1.2. Cocoa Defined
Section 1.3. The Cocoa Frameworks
Section 1.4. Languages
Section 1.5. The Foundation Framework
Section 1.6. The Application Kit Framework
Chapter 2. Cocoa Development Tools
Section 2.1. Installing the Developer Tools
Section 2.2. Interface Builder
Section 2.3. Other Tools
Section 2.4. Exercises
Chapter 3. Object-Oriented Programming with Objective-C
Section 3.1. Introducing Objects
Section 3.2. Creating and Using Objects
Section 3.3. Methods and Messages
Section 3.4. Objective-C-Defined Types
Section 3.5. Creating New Classes
Section 3.6. Overriding Methods
Section 3.7. Other Concepts
Section 3.8. Exercises
Chapter 4. The Cocoa Foundation Kit
Section 4.1. Strings
Section 4.2. Collections
Section 4.3. Memory Management
Section 4.4. Exercises
Part II: Single-Window Applications
Chapter 5. Graphical User Interfaces
Section 5.1. Graphical User Interfaces in Cocoa
Section 5.2. Designing Applications Using MVC
Section 5.3. Create the Currency Converter Project
Section 5.4. Create the Interface
Section 5.5. Define the Classes
Section 5.6. Connect the Model, Controller, and View
Section 5.7. Implement the Classes
Section 5.8. Build and Run
Section 5.9. Exercises
Chapter 6. Windows, Views, and Controls
Section 6.1. Windows and the Window System
Section 6.2. The View Hierarchy
Section 6.3. Coordinate Systems
Section 6.4. Controls, Cells, and Formatters
Section 6.5. Targets and Actions
Section 6.6. Exercises
Chapter 7. Custom Views
Section 7.1. Custom View Creation Steps
Section 7.2. Create a Custom View
Section 7.3. Drawing into a View: Behind the Scenes
Section 7.4. Draw Strings into a View
Section 7.5. Draw Paths into a View
Section 7.6. Exercises
Chapter 8. Event Handling
Section 8.1. Events
Section 8.2. Dot View Application
Section 8.3. Event Delegation
Section 8.4. Notifications
Section 8.5. Exercises
Chapter 9. Models and Data Functionality
Section 9.1. Protocols
Section 9.2. Key-Value Coding
Section 9.3. Table Views
Section 9.4. Table View Example
Section 9.5. Saving Data: Coding and Archiving
Section 9.6. Using Formatters
Section 9.7. Sorting Tables
Section 9.8. Exercises
Part III: Document-Based Applications
Chapter 10. Multiple Document Architecture
Section 10.1. Architectural Overview
Section 10.2. Building a Document-Based Application
Section 10.3. Exercises
Chapter 11. Rich-Text Handling
Section 11.1. Cocoa's Text System
Section 11.2. Creating a Rich-Text Editor
Section 11.3. Enabling the Font Menu
Section 11.4. Text Storage and Attributed Text
Section 11.5. Enabling the Text Menu
Section 11.6. Handling Embedded Images
Section 11.7. Exercises
Part IV: Miscellaneous Topics
Chapter 12. Printing
Section 12.1. Printing a View
Section 12.2. Using Print Operations
Section 12.3. Setting Margins
Section 12.4. Exercises
Chapter 13. Bundles and Resources
Section 13.1. Peeking Inside Bundles
Section 13.2. Using Bundles
Section 13.3. Exercises
Chapter 14. Localization
Section 14.1. Mac OS X Language Preferences
Section 14.2. Localizing Resources
Section 14.3. Localizing Nib Files
Section 14.4. Localizing Strings
Section 14.5. Exercises
Chapter 15. Defaults and Preferences
Section 15.1. How Preferences Work
Section 15.2. Using Defaults
Section 15.3. Command-Line Preferences Access
Section 15.4. Using Unique Application Identifiers
Section 15.5. Exercises
Chapter 16. Accessory Windows
Section 16.1. The Role of File's Owner
Section 16.2. Making an Info Window
Section 16.3. Exercises
Chapter 17. Finishing Touches
Section 17.1. Tidying Up the User Interface
Section 17.2. Providing an Icon
Section 17.3. Providing Help
Section 17.4. Customizing the About Box
Section 17.5. Tweaking Compiler Settings
Section 17.6. Packaging for Distribution
Section 17.7. Closure
Section 17.8. Exercises
Part V: Appendixes
Appendix A. Exercise Solutions
Section A.1. Chapter 2
Section A.2. Chapter 3
Section A.3. Chapter 4
Section A.4. Chapter 5
Section A.5. Chapter 6
Section A.6. Chapter 7
Section A.7. Chapter 8
Section A.8. Chapter 9
Section A.9. Chapter 10
Section A.10. Chapter 11
Section A.11. Chapter 12
Section A.12. Chapter 13
Section A.13. Chapter 14
Section A.14. Chapter 15
Section A.15. Chapter 16
Section A.16. Chapter 17
Appendix B. Additional Resources
Section B.1. Documentation on Your Hard Drive
Section B.2. Printed Documentation
Section B.3. Getting Sample Code
Section B.4. Web Sites
Section B.5. Mailing Lists
Section B.6. Partnering with Apple
Appendix C. Using the Foundation and Application Kit API References
Section C.1. Cocoa Browser
Colophon
Index
Book: Learning Cocoa with Objective-C
Copyright © 2002, 2001 O'Reilly & Associates, Inc. All rights reserved.
Printed in the United States of America.
Published by O'Reilly & Associates, Inc., 1005 Gravenstein Highway North, Sebastopol,
CA 95472.
O'Reilly & Associates books may be purchased for educational, business, or sales
promotional use. Online editions are also available for most titles (http://safari.oreilly.
com). For more information contact our corporate/institutional sales department: 800-998-
9938 or corporate@oreilly.com.
Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered
trademarks of O'Reilly & Associates, Inc. Many of the designations used by manufacturers
and sellers to distinguish their products are claimed as trademarks. Where those
designations appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark
claim, the designations have been printed in caps or initial caps. The association between
the image of an Irish setter and the topic of Cocoa is a trademark of O'Reilly & Associates,
Inc.
Apple Computer, Inc. boldly combined open source technologies with its own
programming efforts to create Mac OS X, one of the most versatile and stable operating
systems now available. In the same spirit, Apple has joined forces with O'Reilly &
Associates to bring you an indispensable collection of technical publications. The ADC
logo indicates that the book has been technically reviewed by Apple engineers and is
recommended by the Apple Developer Connection.
Apple, the Apple logo, AppleScript, AppleTalk, AppleWorks, Carbon, Cocoa, ColorSync,
Finder, FireWire, iBook, iMac, iPod, Mac, Mac logo, Macintosh, PowerBook, QuickTime,
QuickTime logo, Sherlock, and WebObjects are trademarks of Apple Computer, Inc.,
registered in the United States and other countries. The "keyboard" Apple logo ( ) is used
with permission of Apple Computer, Inc.
While every precaution has been taken in the preparation of this book, the publisher and
the author assume no responsibility for errors or omissions, or for damages resulting from
the use of the information contained herein.
Book: Learning Cocoa with Objective-C
Preface
Like a finely tuned BMW, Mac OS X is the ultimate programming machine.
Under the hood lies a powerful Unix engine, named Darwin, developed via Apple's open
source initiative and based on FreeBSD 4.4 and the Mach 3.0 microkernel. On the outside
is a highly polished graphical user interface (GUI) whose usability can't be touched by any
desktop environment on the planet, including GNOME and KDE for Linux, as well as
Windows XP.
The newest cat on the block-Mac OS X 10.2 (code-named Jaguar)-takes desktop and
network computing to a new level. Jaguar, first introduced to developers as a pre-Alpha
release at Apple's Worldwide Developer Conference (WWDC) in May 2002 and later
released to the public on August 24, 2002, brings many changes and improvements to the
legacy set forth by the previous Mac OS X releases. These changes include several
additions to the Cocoa application programming interfaces (APIs), known as the Cocoa
frameworks, arguably the best GUI application development environment on the face of
the planet. An integrated set of libraries and runtime, Cocoa provides a rich infrastructure
on which to build great user applications.
On Codenames and Cats
As mentioned earlier, Mac OS X 10.2 was code-named Jaguar during its
development and testing phase. Earlier releases of Mac OS X included Puma
(Mac OS X 10.1) and Cheetah (Mac OS X 10.0). Software developers like to
give their projects names that evoke some emotion or theme for the release being
worked on. A little research shows that the cheetah is the world's fastest land
mammal, while the jaguar, unlike many other big cats, has no predators save for
man. Worthy goals indeed.
Apple became so enamored of the Jaguar name that they ended up putting it onto
the box in which Mac OS X 10.2 is released, complete with a jaguar fur motif.
When it comes to building Cocoa applications, developers can choose from three languages
to work with the Cocoa APIs: Objective-C, Java, and AppleScript. This new edition of
Learning Cocoa, retitled as Learning Cocoa with Objective-C and thoroughly revised and
updated for Jaguar, shows you how to get started with building Cocoa applications for Mac
OS X using the Objective-C binding to the Cocoa frameworks.
As an introductory book on Cocoa development, Learning Cocoa with Objective-C
accomplishes the following:
● Introduces you to the concepts of object-oriented programming with Objective-C
● Shows you how to use Apple's Developer Tools, in particular, Project Builder and
Interface Builder
● Introduces you to Cocoa's frameworks-Foundation and the Application Kit-by
having you build simple applications along the way
The concepts learned in one chapter spill over to the next, and the sample programs you
build while reading along get more complex as you go deeper into the book. By the end of
the book, you will have learned enough about Cocoa and Objective-C to set you on your
way to higher learning, and for that, there are plenty of other books available:
● Building Cocoa Applications: A Step-by-Step Guide, by Simson Garfinkel and
Michael K. Mahoney (O'Reilly & Associates, Inc.)
● Cocoa Programming for Mac OS X, by Aaron Hillegass (Addison-Wesley)
● Cocoa Programming, by Scott Anguish, Erik Buck, and Donald Yacktman (Sams)
While these books also deal with Cocoa programming with Objective-C, each book takes a
slightly different approach. Programming is a funny art, and sometimes it is invaluable to
see several approaches to the same subject matter. To be a true master of the craft, you'll
probably want to read each of these books and glean from each what you can.
[1]
In addition to this and the previously listed books, you also have a vast resource of
information at your fingertips in the form of Apple's own documentation. Installed on your
system along with the Developer Tools, Apple's docs can be found in /Developer /
Documentation in both PDF and HTML format. If you have a fast or constant link to the
Internet, you can save some space on your hard drive by dumping these docs in the Trash
and using the online documentation found at http://developer.apple.com.
When Apple updates their documentation, they often first post
the revisions online, so you might want to keep that URL handy.
Additionally, there are some online resources-mailing lists and web sites-that you should
subscribe to and read frequently. A listing of these resources can be found in Appendix B,
located at the back of this book.
[1]
Learn the ways of the Force, Luke-just stay away from the Dark Side.
Book: Learning Cocoa with Objective-C
Section: Preface
Audience
As the title implies, this is a "Learning" book-a book for newcomers to Cocoa and
Objective-C. This book assumes you have a basic knowledge of ANSI C and that you're
open to learning the concepts of object-oriented programming. If you're not familiar with C
and you haven't programmed with Java or some other compiled language, you might want
to hold off on reading this book just yet. Likewise, if you're already familiar with Objective-
C or have programmed for NeXTSTEP, chances are this book will be too basic for your
liking. Not that you can't pick something up from reading it, but this book is better suited
for newcomers.
Who Should Read This Book
As mentioned earlier, this book was written for programmers who are interested in learning
how to develop Cocoa applications using the Objective-C language. It assumes that you
have some experience with C programming, as well as a basic understanding of computer-
science concepts. If you're familiar with C or Java, you should have no problem picking up
Objective-C.
Who Should Not Read This Book
Of course, one book can't be everything to everyone. Some people will find this book too
basic or too advanced for their liking. For example:
Novice programmers
If you have never programmed before and want to learn the basics of programming,
you should start off reading an introductory programming text. To learn C, the
language upon which Objective-C is based, we recommend the following books:
❍ The C Programming Language, by Brian W. Kernighan and Dennis M.
Ritchie (Prentice Hall)
❍ Practical C Programming, by Steve Oualline (O'Reilly)
These books will introduce you to the concepts of programming with C, giving you
the foundation you need before reading this book.
Experienced NeXT developers
If you have worked with OpenStep or NeXTSTEP, you will probably find the
material in this book too basic. You might use this book as a refresher to come up
to speed, but it probably won't be the Nirvana you're searching for.
Java developers
This book covers Cocoa using the Objective-C language. If you are a Java
developer and don't mind learning a new language (learning new languages is
always good for you!), then you will do fine with this book. However, if you want a
strict treatment of Cocoa with Java, this book is not for you.
What You Need to Know
Extensive programming experience is not required to complete the examples in this book.
Since the Objective-C language is a superset of ANSI C, experience with the C
programming language is helpful. If you have experience with an object-oriented
programming language such as Java or Smalltalk, you should find the concepts of
Objective-C easy to comprehend. If you don't have experience with object-oriented
concepts, don't worry; we will try our best to guide you through the terminology and to
give you pointers to other texts and reference material.
No prior experience programming on Mac OS X is necessary to complete the tutorials in
this book. We'll show you how to use the Developer Tools that come with Mac OS X and
show you how to build your first Cocoa application in no time.
At some point you should explore the wealth of developer documentation that Apple
installs with the Developer Tools. This documentation covers the Mac OS X system
architecture, developer tools, release notes, the Objective-C language, the Cocoa API
references, and so on. There are four places you can access Apple's developer
documentation:
● The /Developer/Documentation folder on your system. Specifically, most of the
Cocoa documentation is located in the /Developer/Documentation/Cocoa folder.
● The Help menu in Project Builder (/Developer/Applications), which is one of the
development tools you will use as you work your way through this book.
● Mac Help from the Finder. After launching Mac Help and clicking on the "Help
Center" toolbar item, you'll be able to find the Developer Help Center link.
● Online at http://developer.apple.com. As mentioned earlier, Apple often posts
updates to its documentation online first, so you should check here if a document
on your system doesn't have the answer for which you're looking.
Book: Learning Cocoa with Objective-C
Section: Preface
About the Example Code
You will find many examples in this book. The code for these examples is contained within the text, but you
may prefer to download a disk image (.dmg ) of the examples rather than typing all that code in by hand. You
can find the code online and packaged for download at http://www.oreilly.com/catalog/learncocoa2.
[2]
You
may also want to visit this site for any important notes or errata about the book.
All of the examples have been tested using Mac OS X 10.2, Project Builder 2.0, and Interface Builder 2.1. If
you use this book with a later release of any of these products, the user interface and features may be different
from those shown in the book, but everything should work. However, because the examples utilize many
features first introduced with Jaguar, such as GCC 3
[3]
and the AddressBook APIs, you should not use an
earlier release of Mac OS X with this book.
In some of the examples, we put a number (or letter, depending on the other elements on the page) on the right
side of any line of code that we explain in detail. Numbered explanations appear below a listing, as shown in
the following example:
int row = [itemList selectedRow]; // 1
NSString * newName = [[itemList selectedCell] stringValue]; // 2
1. The index of the row is obtained by passing the selectedRow message to the itemList object.
2. The newName string is obtained from the cell by using the stringValue message.
[2]
This book does not come with a CD-ROM. Bundling a CD would increase the cost of production and the cost to
you. It is our belief that anyone reading this book has access to an Internet connection and would rather save money
by simply downloading the example code off the Web.
[3]
GCC 3 introduces support for the C 99 standard, allowing us to make our example code more readable and easier
to understand.
Book: Learning Cocoa with Objective-C
Section: Preface
How This Book Is Organized
This book consists of 17 chapters and 3 appendixes, organized into 5 parts. The first three
parts are organized so that each chapter builds upon the previous one. You should start at
the beginning and proceed sequentially until you've read through the last chapter.
Most chapters contain example applications for you to work through, as well as exercises
that build upon the material covered. Each chapter's applications and exercises are self-
contained and do not spread across chapters.
Part I
Cocoa Overview and Foundation introduces the Cocoa frameworks and describes the high-
level features they provide application programmers, as well as how they fit with other
Mac OS X frameworks. It also includes a brief introduction to object-oriented
programming, the Objective-C language, and Apple's development tools.
Chapter 1
Places Cocoa in the context of the Mac OS X programming environment and
introduces the frameworks and classes that make up the Cocoa API.
Chapter 2
Introduces Project Builder and Interface Builder, Apple's tools for Mac OS X
development. The chapter then goes on to describe the wide array of tools and
utilities available to assist in building, debugging, and performance-tuning
applications on Mac OS X.
Chapter 3
Explains the benefits of object-oriented programming practices (as compared to
procedural programming) and provides an introduction to the terminology and core
concepts needed to use the Cocoa frameworks effectively. It also includes a primer
on the Objective-C programming language.
Chapter 4
Provides a series of mini-tutorials to introduce the Cocoa Foundation, including
strings, arrays, collections, utility functions, and memory management.
Part II
Single-Window Applications covers the basic building blocks of any Cocoa application that
displays a single GUI window to the user. This section uses a series of examples to
illustrate the concepts presented. The techniques and concepts you learn in each chapter
will lay the foundation for the next chapter.
Chapter 5
Introduces the Model-View-Controller (MVC) pattern and how Cocoa programs
are structured and developed. You will also learn about nib files and how to use
them in your applications.
Chapter 6
Goes into detail about how the windowing system works, as well as how to create
View and Controller objects to present a user interface.
Chapter 7
Cocoa's default set of controls covers most of the common UI needs that
applications have, but they can't cover everything. Your application may need to
present a specialized view onto a data source or simply draw arbitrary content to
the screen. This chapter shows how to create these custom views.
Chapter 8
Introduces the event loop and explains how events propagate along the responder
chain. It also covers how events are queued and dispatched, as well as how event
delegation works.
Chapter 9
Shows how to work with the data-bearing objects of an application. The chapter
also shows how this information can be utilized with the Controllers and Views of
an application and how it can be read from and written to storage.
Part III
Many applications today, such as word processors and web browsers, are built around the
concept of a document. Creating an application that can handle multiple documents is
tedious in the best of times. Luckily, Cocoa provides the ability for an application to handle
multiple documents with ease. Document-Based Applications shows how to use Cocoa's
document architecture.
Chapter 10
Presents the basic concepts of the document-handling architecture and how
documents are managed. The chapter guides you through the process of creating an
application that takes advantage of the architecture.
Chapter 11
Shows advanced text-handling abilities of Cocoa, such as handling fonts, working
with layout managers, enabling rulers, and working with attachments.
Part IV
Miscellaneous Topics covers a variety of Mac OS X and Cocoa features that are important
to delivering finished applications and giving them their finishing touches. The chapters in
this part of the book cover diverse topics and can be read in any order.
Chapter 12
This chapter shows you how to add printing functionality to your application.
Chapter 13
Here we describe how bundles, application or otherwise, are structured, how icons
and document types are defined, and how application signatures work.
Chapter 14
Once you build an application, there are several ways to customize the interface to
accommodate users in different parts of the world.
Chapter 15
Mac OS X provides comprehensive management of user preferences. This chapter
explains how to work with this system to store information that can be used across
multiple invocations of your application.
Chapter 16
Applications will often have more than just one interface component. Inspectors
and palettes abound in modern applications. This chapter shows in detail how to
store your user interface in multiple nib files to improve performance and ease
maintainability and localization.
Chapter 17
Once you build an application, there are several important things you should do to
make it ready for distribution. Cocoa provides default copyright strings and About
boxes that need to be edited, and you should probably create some sort of Help
documentation for the application. Finally, this chapter shows how to create an icon
for your application and add that to the application bundle as well.
Part V
The Appendixes include quick-reference material for learning more about Cocoa's
Objective-C classes and list resources that are beyond the scope of this book for expanding
your Cocoa development horizon.
Appendix A
Provides solutions to all of the exercises found at the end of each chapter.
Appendix B
Provides a valuable list of Cocoa-related resources and where to find them,
including Mac OS X's "built-in" developer documentation, books, mailing lists, and
web sites.
Appendix C
Provides a guide to the various API references available to you as a developer, as
well as some tools that will help you search and browse the available
documentation.
Book: Learning Cocoa with Objective-C
Section: Preface
How to Use This Book
Our recommendation is that you read this book from cover to cover, particularly if you're
new to Cocoa and need to learn more about object-oriented programming (OOP). As you
read through the book, you should work on the sample programs along the way. Doing so
will give you the foundation you need to understand what Objective-C is (and isn't) and the
concepts of OOP, most notably the MVC paradigm that aids in GUI application design. We
try to take the approach of teaching you small things first and then building on those small
concepts throughout the rest of the book.
If you have experience with Java or Smalltalk, we recommend that you read this book from
front to back as well. Since you have experience with object-oriented concepts and
programming, there are some sections that you will be able to skim. However, be careful
not to skim too fast, as you might miss some important details.
Book: Learning Cocoa with Objective-C
Section: Preface
Conventions Used in This Book
The following is a list of the typographical conventions used in this book:
Italic
Used to indicate new terms, URLs, filenames, file extensions, directories,
commands and options, program names, and to highlight comments in examples.
For example, a path in the filesystem will appear as /Developer/Applications.
Constant Width
Used to show code examples, the contents of files, or the output from commands.
Constant Width Bold
Used in examples and tables to show commands or other text that should be typed
literally.
Constant Width Italic
Used in examples and tables to show text that should be replaced with user-
supplied values.
Menus/Navigation
Menus and their options are referred to in the text as File Open, Edit
Copy, etc. Arrows are used to signify a navigation path when using window
options; for example, System Preferences Login Login Items means that
you would launch System Preferences, click the icon for the Login control panel,
and select the Login Items pane within that panel.
Pathnames
Pathnames are used to show the location of a file or application in the filesystem.
Directories (or folders) are separated by a forward slash. For example, if you see
something like, " . . . launch Project Builder (/Developer/Applications)" in the text,
that means that the Project Builder application can be found in the Applications
subdirectory of the Developer directory.
A carriage return ( ) at the end of a line of code is used to denote an unnatural line
break; that is, you should not enter these as two lines of code, but as one continuous
line. Multiple lines are used in these cases due to printing constraints.
%, #
The percent sign (%) is used in some examples to show the user prompt from the
tcsh shell; the hash mark (#) is the prompt for the root user.
Menu Symbols
When looking at the menus for any application, you will see some symbols
associated with keyboard shortcuts for a particular command. For example, to
create a new project in Project Builder, you would go to the File menu and select
New Project (File New Project), or you could issue the keyboard shortcut,
Shift- -N.
You should pay special attention to notes set apart from the text with the following icons:
This is a tip, suggestion, or general note. It contains useful
supplementary information about the topic at hand.
This indicates a warning or caution. It will help you solve and
avoid annoying problems.
Book: Learning Cocoa with Objective-C
Section: Preface
How to Contact Us
We have tested and verified the information in this book to the best of our ability, but you
may find that features have changed (or even that we have made mistakes!). As a
newcomer to Cocoa and a reader of this book, you can help us to improve future editions
by sending us your feedback. Please let us know about any errors, inaccuracies, bugs,
misleading or confusing statements, and typos that you find anywhere in this book.
Please also let us know what we can do to make this book more useful to you. We take
your comments seriously and will try to incorporate reasonable suggestions into future
editions. You can write to us at:
O'Reilly & Associates, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
(800) 998-9938 (in the U.S. or Canada)
(707) 829-0515 (international/local)
(707) 829-0104 (fax)
You can also send us messages electronically. To be put on the mailing list or to request a
catalog, send email to:
info@oreilly.com
To ask technical questions or to comment on the book, send email to:
bookquestions@oreilly.com
The web site for Learning Cocoa with Objective-C, Second Edition lists examples, errata,
and plans for future editions. You can find this page at:
http://www.oreilly.com/catalog/learncocoa2
For more information about this book and others, see the O'Reilly web site:
http://www.oreilly.com
Book: Learning Cocoa with Objective-C
Section: Preface
Acknowledgments
First and foremost, I'd like to thank my editor, Chuck Toporek, who talked me into writing
the new edition of this book (twice even) and alternately utilized the editor's whip and kind
words of encouragement to guide me toward its completion. Without him, his advice, and
his faith in me to get the job done, this book would not have happened. Also at O'Reilly, I'd
like to thank Jeff Holcomb, the copyeditor for this book; David Chu, who assisted Chuck in
pulling this book together for production; Brenda Miller, who produced the index; Derrick
Story, who encouraged my early efforts with Cocoa by letting me write for the O'Reilly
Network; and finally Tim O'Reilly, Michael Loukides, and Bob Eckstien, who always
knew that I would write a book for O'Reilly & Associates some day.
Thanks as well to all the people at Apple, especially to the original NeXT and Apple
documentation teams. For this new edition, we've changed the title, stripped the book down
to bare metal, and built it back up. Without the foundation provided by the original
documentation teams, the job would have been much harder. Also thanks to the many
Cocoa engineers at Apple for taking the time to hash over the outline for the revision, and
for reviewing drafts of the manuscript along the way. You guys know who you are.
Many thanks to the independent reviewers of this book, including Jo Davidson (who gave
up part of the Memorial Day weekend to help us meet our deadlines) and Mike Barron.
Special thanks to Jason Hunter, who gave me an author's insight into the writing process,
for helping me find the right metaphors in Chapter 3, and for always being there when
needed. In addition, many thanks to Wilfredo Sánchez Vega, who got me hooked on Mac
OS X in the first place after my Windows laptop went through one of its periodic
meltdowns.
Music from many creative and talented people fueled the writing of this book. Among the
artists in heavy rotation in iTunes and on the iPod: Tori Amos, Bedrock, Blue Man Group,
BT, The Chemical Brothers, The Crystal Method, Darude, DJ Amber (from the San
Francisco Bay rave scene), DJ Dragn'fly (from the Sacramento rave scene), Brian Eno,
Fatboy Slim, The Future Sound of London, Juno Reactor, Moby, New Order, The Orb,
Orbital, Mario Piu, Prodigy, Rinocerose, Sasha, Squarepusher, Underworld, Paul van Dyk,
and many others.
And finally, thanks to all my family and friends who lent support to the book writing
process and who encouraged me to chase my dreams: Dad, who taught me everything I
needed to know after all; Mom, who brought me into the world; Mahaila, who probably
never expected that I-of all the people in the family-would write a book; my sisters Susan,
Illona, Joli, and Heather, as well as my friends Justyna Horwat and Jim Driscoll. Last, but
not least, I want to thank Eleo, who ended up thoroughly addicted to the wireless network I
Random documents with unrelated
content Scribd suggests to you:
realization of noble ethical ideals. He is anxious, at all events, that
his purely rational arguments shall not carry him too far, as, on one
occasion, after a long disquisition, the undoubted purport of which is
to refer oracular inspiration to subterraneous fumes and exhalations,
or, as one of the speakers says, “to accident and natural means,”
Plutarch (“Lamprias” here is clearly a thin disguise of Plutarch
himself) is disturbed and confused that he should be thought
desirous of refuting any “true and religious” opinions recognized with
respect to the Deity; and he forthwith proceeds to prove that it is
quite possible to investigate natural phenomena for secondary
causes, while recognizing a final cause in the creative Deity.[152] Not
only does Plutarch sympathize with those who accept with pious
simplicity the tenets of the “ancient and hereditary Faith;” not only
does he deprecate too severe a handling of religious questions; but
he is also eager to support his view of a subject by showing that it is
not out of harmony with the traditions or prescriptions of the national
belief. Concluding that consolatory letter to his wife upon the death
of their little daughter, which is the most humane and natural
expression of sympathy left us by antiquity, he tries to show that
those who die young will earlier feel at home in the other world than
those whose long life on earth has habituated their souls to a
condition so different from that which exists “beyond the gates of
Hades,” and he says that this is a truth which becomes clearer in the
light of the ancient and hereditary customs.[153] No libations are
poured for the young that are dead. They have no share in earth, nor
in the things of earth. The laws do not allow mourning for children of
such tender years, “because they have gone to dwell in a better
land, and to share a diviner lot.” And he adds, “I know that these
questions are involved in great uncertainty; but since to disbelieve is
more difficult than to believe, in external matters let us act as the
laws enjoin, while within we become more chaste, and holy, and
undefiled.”[154] It must not be overlooked that Plutarch was long a
priest of the Delphian Apollo, and that the duties of this position
responded to some internal need of his soul, and were not regarded
by him as a merely official dignity, is proved by the manner in which
he alludes to the subject. He is speaking on one occasion of the
many indications which the shrine gives of resuming its former
“wealth, and splendour, and honour,” and he congratulates himself
on the zealous and useful part he has taken in aiding the work of this
revival.[155] He mentions two friends as co-workers in the sacred
task, and appears also to felicitate a certain Roman Governor of
Achaia on similar grounds. But he reverently proceeds to make it
quite clear that it is the god himself who is the ultimate cause of
these returning blessings. “But it is not possible that so great a
transformation should have taken place in so short a time through
human activity, unless the god were present and continuing to
inspire his oracle,” and he concludes by censuring those who, in
their inability to discern the motive actuating the divine methods with
mankind, “depart condemning the god, instead of blaming us or
themselves, that they cannot, by reason, discover the intention of the
god.”[156]
Plutarch’s attitude of more than tolerance to the “ancient and
hereditary Faith,” an attitude which is, of course, not inconsistent
with his desire to place that Faith on a rational basis, is partly
explicable in the light of his emphatic gratitude to the existing political
constitution of the Græco-Roman world. He would have been an
admirable co-worker with Mæcenas—πρόθυμος καὶ χρήσιμος[157]—
in carrying out the religious reforms of Augustus. He regarded the
welfare of Society and the State, of the family and the individual
citizen, as bound up with a belief in the gods whose agency was so
clearly visible in bringing the world to that state of perfection which it
now enjoyed, and which promised to be eternal. No one now even
dreamed of doubting the identity of the gods of Rome with those of
Greece, and Plutarch carries the identification to the extent of
including the gods of almost every people constituting the Roman
Empire.[158] These universal powers had the world in their
providential care, and Rome was the divinely chosen instrument of
their beneficent purposes. The Emperor is the depository of the
sacred governing power of the world.[159] When Tiberius shut
himself up in Capreæ, this divine potency never left him. And though
expressions of this kind may be interpreted as a merely formal
recognition of the official dignity of the Head of the World, Plutarch’s
many eloquent descriptions of the blessings of the Pax Romana
leave us in no doubt respecting the character of his views on this
subject. “I welcome and approve,” says Theon, “the present position
of affairs, and the subjects about which we now consult the oracle.
For there now reigns among us a great peace and calm. War has
ceased. Expulsions, seditions, tyrannies, are no more, and many
other diseases and disasters which tormented Greece, and
demanded powerful remedies, are now healed. Hence the oracle is
no longer consulted on matters difficult, secret, and mysterious, but
on common questions of everyday life. Even the most important
oracles addressed to cities are concerned with crops and herds, and
matters affecting the public health.”[160] In the “Præcepta Gerendæ
Reipublicæ” he is still more outspoken in his praise of the Roman
administration, and in his recognition of the opportunities which it
gives for the culture of the individual character within the limits of a
greatly generous sway. Plutarch, as is well known, was gifted with a
patriotic regard for the old achievements of the Hellenic name, but
he recognizes with so keen an insight the great work being
accomplished by Rome in the fostering of municipal institutions, and
the establishment of a peace which meant the undisturbed
happiness of millions of obscure families,[161] that, in the sphere of
practical politics, he deliberately turns away from the group of
inspiring ideas connected with ancient Hellenic patriotism. He
alludes coldly, perhaps even sneeringly, to such of his
contemporaries as fancied they could apply the ancient traditions of
glory to those late and unseasonable times, like little children who
would try to wear their father’s sandals;[162] counsels a complete
submission to the duly appointed Roman authorities; fully persuaded
that within the limits of their supremacy there is as much freedom as
a reasonable man could desire to enjoy; and honestly claims to find
scope, in a little Bœotian township, for such political ambition as
could be safely and wisely indulged.[163] It is not difficult to sneer at
the prudential limitation of patriotism to such petty, insignificant, and
meagre efforts as the superintendence of bricks and mortar and the
carting of municipal rubbish; but the wiser thing is to note that
Plutarch’s opposition to vain fancies of the revival of the ancient
Hellenic splendour, except perhaps in such a form as a Hadrian
might be inclined to revive it in an artificial Panhellenium, is based on
the conviction that happiness depends upon the free development of
individual character, the unrestricted enjoyment of domestic peace,
the undisturbed intercourse of social life; and he knew that the
Roman sway made it possible, for Greeks at any rate, to enjoy these
blessings to a degree never previously known in their chequered
history.[164] With a clear recognition of the historical causes of the
political decadence of Hellenism, he regards civic discord as the evil
which most demands the attention of those who still seek
opportunities for public action, and he is particularly grateful to the
strong hand of Rome for controlling the internecine animosities of
Greek cities. “Consider,” says he, “our position with regard to those
blessings which are counted as the greatest that a city can enjoy:
Peace, Freedom, Fertility of Soil, Increase of Population, Domestic
Concord. As regards Peace, our peoples have no present need of
politicians. Every Greek war, every Barbarian war, has vanished from
among us. For Freedom, our peoples enjoy as much as their rulers
allow them, and a greater share would perhaps not be any better for
them. For fine seasons and plentiful harvests, for families of ‘children
like their sires,’ and for gracious aid to the new-born child, the good
man in his prayers will invoke the gods on behalf of his fellow-
citizens.”[165] As for civic concord, that, he says, is in our own power,
and those who desire a life of political activity could not do better
than devote themselves to the task of spreading harmony and
friendship among their fellow-citizens. The peace which the Romans
have established in the world makes it possible to develop character
on these social lines, and he recognizes, in a pregnant comparison,
that the freedom which the Greeks enjoy is sufficient to allow the
fullest play to the development of their own moral character. The
drama is composed and staged: the prompter stands behind the
scene ready with the cue: but the player can give his own
interpretation of the character he represents, though remembering
that a slip may meet with a worse fate than mere hissing in the
audience.[166]
Plutarch is clearly of opinion that this state of things is best for his
fellow-countrymen. He is as firmly convinced of the divine mission of
Rome as ever was Virgil or any other patriotic Roman.[167] In his
tract “De Fortuna Romanorum,” he discusses the question whether
the greatness of Rome was due to Τύχη or Ἀρετή, or, as he
expresses the antithesis in another place, to Τύχη or Πρόνοια—to
Chance or to Providence, we may translate, if we recognize that
here Chance is the divine element, and Providence the human.[168]
In other words, is the grandeur of Rome the result of human virtue
and forethought, or is it a direct gift of the Deity to mankind? He
decides in the latter sense, though conceding much to the valour of
individual Romans; and his incidental expressions of opinion bear as
much evidence to the divinely inspired and divinely guided character
of Roman administration as is borne by his definite conclusion. He
says that, whichever way the question is decided, it can only
redound to the glory of Rome to be the subject of a discussion which
has hitherto been confined to the great natural phenomena of the
universe—the earth, the sea, the heavens, and the stars. His very
words are curiously reminiscent of Virgil’s rerum pulcherrima, Roma
(τῶν ἀνθρωπίνων ἔργων τὸ κάλλιστον),[169] as he tells how Time, in
concert with the Deity, laid the foundations of Rome, harmonizing to
that end the influence of Fortune and Virtue alike, thus establishing
for all the nations of mankind a sacred hearth, a harbour and a
resting-place, “an anchorage from the wandering seas” of human
stress and turmoil, a principle of eternity amid the evanescence and
mutability of other things. He describes with great vigour of language
the instability of the world under the domination of other Empires,
until Rome acquired her full strength and splendour, and brought
peace and security and permanence among these warring elements.
[170]
Being so satisfied with the constitution of the world, it is natural
that Plutarch should have nothing but reverent words for the eternal
powers whose guidance had led to so happy a disposition of human
affairs. However much Philosophy should endeavour to free the
mind from the crude and vulgar elements in the “ancient and
hereditary Faith,” she must never be tempted to profess other than
the most pious belief in its fundamental truth and right; and the
ultimate aim of Philosophy must be to strengthen and revive the
ancient Religion by freeing it from inconsistencies and crudities
which, so long as they appeared to be an essential part of the
system, only existed to shock the pious and to encourage atheism.
Plutarch’s attitude towards the ancient Faith may thus be defined
as one of patriotic acceptance modified by philosophic criticism; not
that criticism which tries everything from the fixed standpoint of a set
of rules logically irrefutable: but that which is really the spirit of
rationalism pervading all philosophies alike. If Plutarch’s attitude is
that of a Platonist, it is that of a Platonist whose experience of
ordinary human affairs, and whose recognition of their importance in
Philosophy, have compelled him to modify the genuine teaching of
the Master into something like the spirit of compromise
characterizing the later Academics. His teaching is not the
philosophic despotism of Plato; it might easily be characterized as
“plebeian,”[171] as Epicureanism was by Cicero, or “commonplace,”
as Aristotle has been described by Platonists. It breathes that free
spirit of truth which bids every man, whether he is a practised
philosopher or not, or even if he has not studied mathematics, to
give a reason for the faith that is in him: to apply the touchstone of
his own practical experience and native intelligence to the domain of
Ethics and Religion as to the domain of every-day life, because, as a
matter of fact, the domain of every-day life is the domain of Religion
and Ethics. The dictum of Hesiod, enforced by Aristotle and applied
in practice by the Epicureans, and by the Stoics, is the keynote of
the teaching of Plutarch:—“He is most excellent of all, who judges of
all things for himself.”
CHAPTER V.
Plutarch’s Theology—His conception of God not a pure metaphysical abstraction,
his presentment of it not dogmatic—General acceptance of the attributes
recognized by Greek philosophy as essential to the idea of God—God as
Unity, Absolute Being, Eternity—God as Intelligence: Personality of
Plutarch’s God intimately associated with his Intelligence—God’s Intelligence
brings him into contact with humanity: by it he knows the events of the Future
and the secrets of the human heart—From his knowledge springs his
Providence—God as Father and Judge—the De Sera Numinis Vindicta—
Immortality of the Soul.
It will readily be understood that on no question of Religion is
Plutarch more willing to act as “Arbitrator” than on that concerned
with the Nature and Attributes of the Deity. He knows and, as we
have seen, recognizes to the full the discordant nature of the
elements which, by force of circumstances, have been driven into
some kind of cohesion in the formation of the popular belief, and it
must be admitted that his efforts to harmonize them into a rational
consistency are not completely successful. His own conception of
the Divine nature resembles the popular notion in being a compound
of philosophy, myth, and legalized tradition. From Philosophy he
accepts the Unity of God; from popular Mythology he accepts certain
names of deities, and certain traditional expressions, which he
understands, however, in a sense quite different from any
interpretation current in the popular views, while, at the same time,
he never uses these names and expressions without an air and
attitude of the most pious regard. The philosophical part of his
teaching on the nature of God is largely Greek, but by no means
entirely so, and neither is it the teaching of any particular school of
Greek philosophy. The Demiurgus of the Timæus: the One and
Absolute of the Pythagoreans: the Πρῶτον κινοῦν, the νόησις,
νοήσεως νόησις of Aristotle; the material immanent World-Soul—the
λόγος ὁ ἐν τῇ ὕλῃ—of the Stoics:—one and all contribute qualities to
the Plutarchic Deity, and show how irresistible the necessity for unity
had become in the spiritual, as in the political, world. The
metaphysical Deity thus created from these diverse elements is
made personal by the direct ethical relation into which He is brought
with mankind (as in the punishment of sin), while the suggestion of
personality is aided by the use of the Greek popular names of the
deities to describe the attributes of the One Supreme God. Thus it
has already been noted that while Plutarch is ostensibly discussing
the attributes of Apollo he is actually defining his position with
reference to abstract Deity. This ill-harmonizing combination of
metaphysics and popular belief is further placed in contact with
views originated by Oriental creeds, with Zoroastrianism, with
Manichæism, with “certain slight and obscure hints of the truth,
which are to be found scattered here and there in Egyptian
Mythology,”[172] the whole presenting a strange conglomeration,
which appears to defy any attempt to make a consistent theology of
it, until we see Plutarch’s method conspicuously emerging with its
twofold aim, of proving that all these different views of God are
merely different ways of striving after belief in the same Supreme
Power, and of inculcating a sympathetic and liberal attitude of mind,
which is far more conducive to unity than a detailed agreement on
points of minor importance.[173] This endeavour after unity is
supported by a strenuous and sincere belief in what at first sight
appears to be a principle of diversity—the belief, namely, in Dæmons
—but which Plutarch uses to great effect in his attempts after unity,
by assigning, with Pythagoras,[174] every recognized tradition
unworthy of the Highest to these subordinate beings whose influence
is everywhere felt in nature and in human life, and whose presence,
at any rate, interpenetrates and overruns the whole of Plutarch’s
views on religion.[175]
It is no unfitting circumstance in a priest of Apollo that his noblest
utterances respecting the nature of God should be contained in
discourses connected more or less with the temples and traditions of
the god. In the discussion, for instance, on the syllable “E” written
over the narrow entrance of the Amphictyonic Temple at Delphi,
Ammonius is represented as expressing views of the Divine Nature
which are unsurpassed for sublimity in any other part of Plutarch’s
writings, or even in Greek literature generally. We quote them here
as embodying Plutarch’s beliefs on the Unity, Eternity, and
Absoluteness of the Divine Nature. “Not then a number, nor an
arrangement, nor a conjunction or any other part of speech, do I
think the inscription signifies. It is rather a complete and concise form
of address, an invocation of the God, bringing the speaker with the
very word, into a conscious recognition of His power. The God
salutes each of us, as we approach His shrine, with the great text,
‘Know thyself,’ which is His way of saying χαῖρε to us; and we in our
turn, replying to the God, say εἶ—‘Thou art,’ thus expressing our
belief in His true and pure and incommunicable virtue of absolute
being.[176]... Now we must admit that God absolutely is; not that he
is with reference to any period of time, but with reference to an
immovable, immutable, timeless eternity, before which there was
nothing, after which there is nothing, in respect to which there is
neither future nor past, than which there is nothing older or younger.
But being Unity, the Unity that he is now is the same Unity with which
he occupies eternity; and nothing really exists but that which is
endowed with the same absolute existence as he—neither anything
that has come into existence, nor shall come into existence, nor
anything which had a beginning, or shall have an end. In
worshipping him, therefore, we ought assuredly to salute and
address him in a manner corresponding to this view of him; as, e.g.,
in the phrase already used by some ancient philosophers, the
phrase, ‘Thou art one.’ For the Divine principle is not many, as we
are, each of us compacted of countless different passions, a mingled
and varying conglomerate of assembled atoms. But Being must
necessarily be Unity, and Unity must be Being. It is Diversity—that is,
the principle of discrepancy from Unity—which issues to the
production of non-Being, whence the three names of the God are
one and all appropriate. He is Apollo (ἀ πολύς), because he
repudiates and excludes the many (τὰ πολλὰ); Ieius (ἵος = εἶς)
because he is Unity and Solitude; and Phœbus, of course, was the
name given by the ancients to anything that was pure and
unsullied.... Now Unity is pure and unsullied; defilement comes by
being mixed with other elements, as Homer says that ivory dipped in
purple dye ‘is defiled,’ and dyers say that colours mixed are colours
‘corrupted,’ the process being called ‘corruption.’ A pure and
incorruptible substance must therefore be one and whole.”[177]
—“The Inscription εἶ seems to me to be, as it were, at once the
antithesis and the completion of the inscription, ‘Know thyself.’ The
one is addressed in reverence and wonder to the God as eternally
existent, the other is a reminder to mortality of the frail nature that
encompasseth it.”[178]
Nowhere is the necessity which Plutarch feels for believing in one
supreme ruler of all the imaginable universe more apparent than in a
passage in which he is seeking a regulating Intelligence for an
admitted plurality of worlds, to account for whose administration a
Greek of almost any period would have been constrained to resort to
the hypothesis of a plurality of gods, supreme as each individual god
might be in his own individual world. The passage in question
initiates a discussion on this subject somewhat episodical to the
main argument of the “De Defectu Oraculorum.” Plutarch himself is
the speaker, though he represents his interlocutors as addressing
him by the name of Lamprias.[179] He is inclined to agree that there
may be more worlds than one, though repudiating an infinity of
worlds. “It is more consonant with reason to assert that God has
made more than one world. For He is perfectly good, and deficient in
no virtue whatsoever, least of all in those virtues that are associated
with Justice and Friendship, which are the fairest of all virtues, and
those most appropriate to the divine nature. And as God is not
wanting in any respect, so also He possesses no redundant or
superfluous characteristics. There must exist, therefore, other gods
and other worlds than ours, whose companionship furnishes a
sphere for the exercise of these social virtues. For it is not upon
Himself, nor upon a part of Himself, but upon others, that He
discharges the claims of justice, kindliness, goodness. Hence it is
not probable that He is unneighboured and unfriended, or that this
world of ours floats alone in the emptiness of infinite space.”[180]
Plutarch, however, is merely on tentative ground here; the plurality of
worlds was an abstract academic question no less in those days
than in these. Admitting a plurality of worlds, it does not necessarily
follow that each should be under the dominion of a separate Deity.
“What objection,” he asks, in answer to the Stoics, “what objection is
there to our asserting that all the worlds are beneath the sway of the
Fate and Providence of Zeus, and that He bestows His
superintendence and direction among them all, implanting in them
the principles and seeds and ideas of all things that are brought
about therein? Surely it is no more impossible that ten, or fifty, or a
hundred worlds should be animated by the same rule of Reason, or
should be administered in accordance with one and the same
principle of action, than that a public assembly, an army, or a chorus,
should obey the same co-ordinating power. Nay, an arrangement of
this kind is in special harmony with the Divine Character.”[181]
Plutarch cannot get away from his fixed belief in the absolute Unity
of God, and with God’s Unity, as we have already seen, his Eternity
and Immutability are involved. But Plutarch re-asserts this truth in
various places and forms. In the tract “De Stoicorum Repugnantiis,”
though chiefly dealing polemically with the inconsistencies and self-
contradictions of Chrysippus and other early Stoics, he clearly
exhibits his own views in several passages. In one place[182] he
asserts that even those who deny the benevolence of God, as the
Jews and the Syrians, do not imagine him as other than eternally
and immutably existent, and quotes with approval a sentence from
Antipater of Tarsus, to the effect that God is universally regarded as
uncreate and eternal. A little later in the development of the
argument[183] he adopts the Stoic position—which Chrysippus is
represented as contradicting—that the idea of God includes the
ideas of happiness, blessedness, self-sufficiency, which qualities are
elsewhere shown to exist absolutely and independently of all
conceivable causes of opposition.[184] “They are wrong who assert
that the Divine Nature is eternal because it avoids and repels
anything that might tend to its destruction. Immutability and Eternity
must necessarily exist in the very nature of the Blessed One,
requiring no exertion on his part to preserve and defend them.”
The intermingling of the doctrines of various philosophic sects is
interestingly conspicuous throughout these discussions on the
nature of God; and not less than elsewhere in the noble observations
of the Platonist Ammonius, which have been quoted from the “De Ε
apud Delphos.” It is equally interesting to note that all the speakers
in that dialogue, while looking with their mind’s eye far beyond any
individual member of the Olympian Pantheon to that divine power
whose functions correspond with the essential requirements of the
loftiest monotheism, yet use the name of Apollo as the professed
nucleus of their religious beliefs, and thus bring themselves into
formal harmony with the demands of the “ancient and hereditary
Faith.” The same tendency, at once orthodox and unifying, is visible
in the philosophic import attached, in accordance with the Stoic
practice, to the popular names for the god in his various functions. In
other tracts and essays the same aim is conspicuous, the same
method of treatment is applied. In his fascinating account of the
Egyptian myth of Isis and Osiris—which will be dealt with later from
the material which it furnishes for investigating Plutarch’s attempts to
identify foreign gods with the gods of Greece—he uses both these
divine names as a means of approach to the Divine Nature, that One
Eternal, Absolute Being, which is the real object of the philosopher’s
clarified insight—πολλῶν ὀνομάτων μορφὴ μία.[185] The true object
of the service of Isis, for example, is “the knowledge of that First and
Supreme Power which is compact of Intelligence; that Power whom
the goddess (Isis) bids her servants seek, since He abides by her
side and is united with her. The very name of her temple expressly
promises the knowledge and the understanding of Being, inasmuch
as it is called the Ision (εἰς—ἰὼν), indicating that we shall know Being
if we enter with piety and intelligence into the sacred rites of the
goddess.”[186]
The passage just quoted shows the intimate connexion between
Being and Intelligence—the “Supreme Power is compact of
Intelligence;” and we are left in little doubt respecting Plutarch’s
views on this second aspect of the Divine Nature. The conception of
the Deity as νοῦς, an ancient abstraction in Greek philosophy, is at
once strengthened and brought nearer to the intelligence of
humanity by Plutarch’s simple treatment of it, and by his connecting
it, wherever possible, with the traditions of the popular creed. God is
not only Intelligence, but intelligent. “The Divine Nature,” says he, “is
not blessed in the possession of silver and gold, nor mighty through
the wielding of thunders and thunderbolts, but in the enjoyment of
knowledge and understanding; and of all the things that Homer has
said concerning the gods, this is his finest pronouncement:—
‘Yet both one goddess formed
And one soil bred, but Jupiter precedence took in birth
And had more knowledge’[187]
—a pronouncement in which he gives the palm for dignity and
honour to the sovereignty of Jove, inasmuch as he is older in
knowledge and wisdom. And I am of opinion that the blessedness of
that eternal life which belongs to God consists in the knowledge
which gives Him cognizance of all events; for take away knowledge
of things, and the understanding of them, and immortality is no
longer life, but mere duration.”[188] The free, unfettered exercise of
intelligence is therefore a function of the Divine Nature; but although
Plutarch is clearly thinking of the νοῦς of Anaxagoras as embodied
by Plato in his conception of the Chief Good, yet he succeeds in
bringing the Divine Nature, by the exercise of intelligence, into an
intimate relation with humanity which the Platonic Demiurgus never
attains. The true successors of Plato in the realm of Idealism were
the neo-Platonists, who maintained that “the sum total of the Ideas
exists in the Divine nous, not outside of it, ‘like golden statues,’ which
God must search and look up to before He can think. It is not to be
supposed that He must needs run about in search of notions,
perhaps not finding them at all, perhaps not recognizing them when
found. This is the lot of man, whose life is spent often in the search,
sometimes in the vain search, after truth. But to the Deity all
knowledge is always equally present.”[189] The vicious weakness of
Platonism, whether Old or New, lies in the fact that no real reason
exists why God should ever leave the contemplation of “worlds not
realized” to create this world after an eternally existing pattern, in the
intellectual contemplation of which he was already happy.[190] The
“absence of envy” is not a philosophic reason: it is a Platonic leap
over an unbridged chasm. The aloofness of the Epicurean gods in
their sedes quietæ is the logical outcome of this aspect of Platonism.
Plutarch gives the Divine Intelligence an interest in the beings He
has created. Apollo (here again the popular name is used for the
Divine Being) knows all the difficulties that trouble the public and
private lives of humanity, and he knows their solutions also. “In
private matters we inquire of Apollo as a seer, in public matters we
pray to him as a god. In the philosophic nature of the soul he is the
author and inspirer of intellectual difficulties and problems, thus
creating therein that craving which has its satisfaction in the
discovery of Truth;”[191] e.g., “when the oracle was given out that the
altar of Delos should be doubled, the god, as Plato says, not only
conveyed a particular command, but also indicated his desire that
the Greeks should study geometry; the task assigned involving an
operation of the most advanced geometrical character.”[192] In
another place this paternal interest in the doings of mankind is
attributed to the Deity direct without the intrusion of any traditional
name for a particular god. “It is not, as Hesiod supposes,[193] the
work of human wisdom, but of God’s, to discriminate and distinguish
predilections and antipathies in character before they become
conspicuous to the world by breaking out into gross evil-doing under
the influence of the passions. For God is assuredly cognizant of the
natural disposition of every individual man, being, by His nature,
more fitted to perceive soul than body: nor does He await the
outbreak of actual sin before He punishes violence, profanity,
obscenity.”[194] Thus, although Plutarch accepts the philosophic
phrasing current respecting the nature of the Deity, his ardent,
sympathetic temperament brings down the philosophers’ Deity from
its majestic isolation, and makes it “meet halfway” the gods of the
popular faith, so that both may be of service to humanity, the latter
being purified and elevated, the other actualized and humanized. We
discern with sympathy Plutarch’s attempt to satisfy the eternal
craving of men for a mediator between themselves and the
unapproachableness of the Highest; and we are prepared for his
exposition of the doctrines of Dæmonology. This tendency to give
warmth and life to philosophic abstractions is occasionally visible in
an unconscious attempt to assimilate the qualities possessed by the
Deity to those displayed in a less degree by mankind. Thus, he
implicitly accepts the Platonic position that Eternity is all present to
God,[195] a position which is also accepted by modern European
Theology: but he elsewhere regards the Deity (formally using the
name of Apollo) as a scientific observer, with infallibly acute
reasoning powers directed upon phenomena retained in an
unshakable memory. His predictions of events are, therefore, really
predictions, not statements of present facts; and the “rigorous
certainty and universality” which they possess are the certainty and
universality attaching to the human discoveries of the laws of
geometry and the law of causation, and not to a divine insight which
is omniscience because it is always regarding events as present,
whether they are actually past, present, or to come. “Apollo is a
prophet, and prophecy is the art of ascertaining the future from the
present or the past. Now nothing exists without a cause, and
prediction, therefore, depends upon reason. The present springs
inevitably from the past, the future from the present. The one follows
naturally upon the other by a succession which is unbroken from
beginning to end, and, accordingly, he who knows the natural causes
of past, present, and future events, and can connect their mutual
relationships, can predict the future, knowing, in the words of Homer,
‘things that are now, things that shall be, and things that are over.’
The whole art of Dialectics consists in the knowledge of the
Consequent.”[196]
Already in these passages, which represent philosophers as
discussing God in the terms familiar in Greek philosophy, we can
discern a gradual breaking down of that metaphysical exclusiveness
which had hitherto marked the philosophic conception of the Deity.
We see God again becoming personal, and reverting to that interest
in the affairs of mankind from which the philosophers, starting with
Xenophanes, had, in their revulsion from the anthropomorphic
realisms of the Epic traditions, excluded him. We can already note
that Plutarch believes in the “goodness” of God in a sense quite
distinct from the “absence of envy” distinguishing the Platonic
Creator, or even from the sense involved in Plato’s admission that
the gods love the just, since one always loves that which is made in
one’s own image.[197] We can see him going further, indeed, than
Aristotle, who compares the love of men for the gods to the love of
children for their parents, a love which is based upon a recognition of
their goodness and superiority, and of their having been the authors
of the greatest benefits to humanity.[198] But we are not left without
many explicit texts asserting the goodness of God to mankind in
emphatic phrases. Plutarch agrees with those statesmen and
philosophers who assert that the majesty of the Divine Nature is
accompanied by goodness, magnanimity, graciousness and
benignity in its attitude towards mankind.[199] We have already seen
that Justice and Love are regarded by Plutarch as the most beautiful
of all virtues, and those most in harmony with the Divine Nature,[200]
and many isolated sentences could be quoted to demonstrate how
firmly the belief in God’s goodness to man was fixed in Plutarch’s
mind. We are fortunate, however, in possessing a special tract in
which the personal character of the Divine Goodness is so clearly
exhibited that a modern translator of the tract, writing from a
“Theological Institution,” is able to say, “I am not aware, indeed, that
even Christian writers who have attempted to defend the same truth
within the same limits of natural theology, have been able to do
anything better than to reaffirm his position, and perhaps amplify and
illustrate his argument.”[201] The tract referred to is, of course, the
famous production known as the “De Sera Numinis Vindicta.” It is a
bold and beautiful attempt to reconcile the existence of an actively
benevolent Deity with the long-continued, often permanent, impunity
of wickedness in this world; an endeavour to solve the question
raised, especially by Epicureans, but not unfraught with solicitude for
philosophers of other schools, respecting the patent fact that human
virtue and human vice have no natural and necessary connexion
with human happiness on the one hand and human misery on the
other. Christian translators of the piece, from Amyot down to the
writers just quoted, have hailed it as an effective vindication of the
ways of God to man, and Comte Joseph de Maistre, whose
paraphrase is designed, as he says, to please “ladies and
foreigners,” is quite convinced that such a justification could not
possibly have been written by one who was not a Christian.[202]
Even Wyttenbach, whom de Maistre attacks for repudiating this view,
is willing, with all his scholarly caution, to admit that Plutarch, in this
tract, touches the excellences of the Christian faith.[203]
The position which Plutarch sets himself to overthrow is that which
is expressed most concisely in the famous verses of Ennius:—
“Ego deum genus esse semper dixi et dicam cœlitum,
Sed eos non curare opinor quid agat humanum genus;
Nam si curent, bene bonis sit, male malis, quod nunc abest”
—a sentiment in exact harmony with the Epicurean view of the
matter.[204] While, however, establishing the providence and
goodness of God as against the practical Atheism of the Epicureans,
it will be seen that he is equally temperate, and equally consistent
with himself, in avoiding the exaggerated zeal of those Stoics who, in
their eager desire to do something for the honour of Providence, had
subjected the minutest and commonest actions of life to the jealous
watching of an arbitrary omniscience, so that, as Wyttenbach puts it,
“that most gracious name of Providence was exposed to ridicule and
contempt, being alternately regarded as a fortune-telling old crone,
and as a dreadful spectre to alarm and terrify mankind.”
Let us see in what way Plutarch establishes the providential
benevolence of God without detracting from his majesty.
A company of philosophic students, Plutarch himself; Patrocleas,
his son-in-law;[205] Timon, his brother; and Olympichos, a friend;[206]
are found, at the opening of the dialogue, regarding each other in
silence beneath a Portico of the Delphic Temple, in wonder at the
discourtesy of an Epicurean who has suddenly disappeared from the
party, after expounding the doctrines of his school in the manner,
doubtless, of Velleius in the “De Natura Deorum,” though with a more
limited scope as expressed by the famous line of Ennius already
quoted. According to Plutarch, he had “gathered together, from
various sources, an undigested mass of confused observations, and
had then scattered them in one contemptuous stream of spleen and
anger upon Providence.” The company, deprived of their legitimate
opportunity for reply, determined to discuss the question of
Providence as if the departed opponent were still present, although it
cannot be doubted that his absence, and the consequent want of
direct necessity to “score off” him, lead to a more thorough and
impartial discussion of the topic. Patrocleas, at any rate, states the
difficulty with almost Epicurean boldness. “The delay of the Deity in
punishing the wicked seems to me to be a strange and mysterious
thing. The wicked are so eager and active in their wickedness, that
they, least of all, ought to be the object of inactivity on the part of
God. Thucydides rightly said that the advantage of delay was on the
side of evil-doers.[207] Present immunity from the punishment due to
crime encourages the criminal, and depresses the innocent sufferer.
Bias knew that a certain reprobate of his days would be punished,
but feared that he would not live to see it. Those whom Aristocrates
betrayed at the Battle of Taphrus were all dead when his treachery
was punished twenty years after. So with Lyciscus and the
Orchomenians.[208] This delay encourages the wicked. The fruit of
injustice ripens early and is easily plucked, but punishment matures
long after the fruit of evil has been enjoyed.” This demand of the
natural man to see their deserts meted out to the wicked is
reinforced in a more philosophical manner by Olympichos, who
maintains that delay in the punishment of sin deprives it of that
salutary effect which its immediate infliction would have upon the
sinner, who regards it as accidental, and not necessarily connected
with his crimes. The fault of a horse is corrected if bit and lash be
applied at once; but all the beating and backing and shouting in the
world at a later time will only injure his physique without improving
his character. “So that I am quite unable to see what good is done by
those Mills of God[209] which are said to grind so late, since their
delay brings justice to naught, and thus deprives vice of its
restraining fear.”[210]
Plutarch, before replying to these weighty arguments, preaches a
short and eloquent sermon on the text, “God moves in a mysterious
way.” His thoughts are not as our thoughts, nor His ways our ways.
We must imitate the philosophic caution of the Academy. Men who
never saw a battle may talk of military affairs, or discuss music who
never played a note; “but it is a different thing for mere men like
ourselves to peer too closely into matters that concern Divine
Natures; just as if unskilled laymen were to try to penetrate the
intention of an artist, the meaning of a physician’s treatment, the
inner significance of a legal enactment, by fanciful guesses and
surmises.... It is easier[211] for a mortal to make no definite assertion
about the gods, but just this—that He[212] knows best the proper
time to apply His treatment to wickedness. He can truly discriminate
in the character of the punishment required by each offence.” These
preliminary observations are in the proper Academic style; they are
designed to indicate that the end of a discourse on such intricate
matters can only be the modification of doubt by probability, not its
settlement by absolute logical certainty.[213] The assumption of the
Platonic attitude is appropriately followed by a Plutarchic reading of
the teaching of Plato, who is understood as asserting that God, when
he made Himself the universal pattern for all beautiful and noble
things, granted human virtue to those who are able to follow Him, in
order that they might thus in somewise grow like unto Him.[214]
Further, as Plato says,[215] the universal nature took on order and
arrangement by assimilation to and participation in the Idea and in
the Virtue of the Divine Nature. Again, according to Plato, Nature
gave us eyes that our soul might behold the order and harmony of
the heavenly bodies, and become harmonious and ordered herself,
free from flighty passions and roving propensities.[216] Becoming like
God in this way, we shall emulate the mildness and forbearance with
which He treats the wicked; shall eradicate from our minds the
brutish passion for revenge; and shall wait to inflict our punishments
until long consideration has excluded every possibility that we may
repent after the deed is done. The purport of this argument, and of
the examples which Plutarch, always rich in illustration, furnishes in
support of it, is clearer than the need of attaching it to the Platonic
scheme of creation. Plutarch believes that “God is slow to anger”;
because gentleness and patience are part of His nature, and
because by speedy punishment, He would save a few, but by
delaying His justice He gives help and admonition to many. God,
moreover, knows how much virtue He originally implanted in the
heart of every man. He knows the character and inclination of every
guilty soul; and His punishments are, therefore, different from human
penalties, in that the latter regard the law of retaliation only, while the
former are based on a knowledge of character which does not
quench the smoking flax, but gives time and opportunity for a
repentant return to the path of virtue.[217] The world, too, would have
been deprived of many a virtuous character, lost the advantage of
many a noble deed, had prompt punishment for early sins been
inflicted. There is, moreover, a soul of good in things evil; the careers
of great tyrants have been prolonged, and the world has been the
better for the movements which their tyranny compelled. Evil is a
“dispensation of Providence” in Plutarch’s eyes, as in those of many
modern Christians. “As the gall of the hyæna, and the rennet of the
seal, both disgusting animals in other respects, possess qualities
useful for medicinal purposes, so upon certain peoples who need
severe correction God inflicts the implacable harshness of a tyrant or
the intolerable severity of a magistrate, and does not take away their
trouble and distress until they are purified of their sins.” Sometimes,
too, the Deity delays His vengeance in order that it may take effect in
a more strikingly appropriate manner.[218]
But these external punishments are not the most terrible that can
be inflicted on the sinner. It would be difficult, even in Christian
literature, to find so striking a tribute to the power of conscience in
inflicting its immaterial tortures on the criminal who has escaped
material recompense. Plutarch bases his observations on this head
on a repudiation of Plato’s statement[219] “that punishment is a state
that follows upon injustice,” asserting, as he finds in Hesiod, that the
two are contemporaneous and spring up from the same soil and
root; a view which he supports by many conspicuous and terrible
examples from history, the force of which may be summarized in the
fine and truthful phrase—the antithetical effect of which would be
destroyed by translation—οὐδὲ γηράσαντες ἐκολάσθησαν ἀλλ’
ἐγήρασαν κολαζόμενοι.[220] The conclusion which Plutarch arrives at
by considering this aspect of the case is that “there is no necessity
for any god, or any man, to inflict punishment on evildoers, but it is
sufficient that their whole life is tormented and destroyed by their
sense of their impiety;” and that the time cannot but come when the
glamour and the tinselled glory of successful crime will be torn away,
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookfinal.com

More Related Content

PDF
Learning Cocoa with Objective C 2nd Edition James Duncan Davidson
PDF
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
PDF
Download full ebook of Cocoa Fundamentals Guide instant download pdf
PDF
Programming iOS 4 Fundamentals of iPhone iPad and iPod Touch Development 1st ...
PDF
Programming Ios 5 2nd Edition 2nd Early Release Draft Matt Neuburg
PDF
Programming iOS 4 Fundamentals of iPhone iPad and iPod Touch Development 1st ...
PDF
Programming iOS 5 2nd Edition Matt Neuburg
PDF
Programming Ios 4 Fundamentals Of Iphone Ipad And Ipod Touch Development 1st ...
Learning Cocoa with Objective C 2nd Edition James Duncan Davidson
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
Download full ebook of Cocoa Fundamentals Guide instant download pdf
Programming iOS 4 Fundamentals of iPhone iPad and iPod Touch Development 1st ...
Programming Ios 5 2nd Edition 2nd Early Release Draft Matt Neuburg
Programming iOS 4 Fundamentals of iPhone iPad and iPod Touch Development 1st ...
Programming iOS 5 2nd Edition Matt Neuburg
Programming Ios 4 Fundamentals Of Iphone Ipad And Ipod Touch Development 1st ...

Similar to Learning Cocoa with Objective C 2nd Edition James Duncan Davidson (20)

PDF
Cocoa Programming For Mac Os X 4th Edition Aaron Hillegass Adam Preble
PDF
Programming iOS 5 2nd Edition Matt Neuburg
PDF
Learning the iPhone SDK for JavaScript Programmers Create Native Apps with Ob...
PDF
Cocoa fundamentalswert
PDF
Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Obj...
PDF
Objective C Fundamentals 1st Edition Christopher Fairbairn
PDF
Objective C Fundamentals 1st Edition Christopher Fairbairn
PDF
Mac Osx Developer Guide Jesse Feiler Auth
PDF
PDF
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
PPTX
Drugs
PDF
Ios 12 Programming Fundamentals With Swift Swift Xcode And Cocoa Basics 5th E...
PDF
Iphone programming: Objective c
PDF
Xcode, Basics and Beyond
PDF
Session 1 - Introduction to iOS 7 and SDK
PDF
Peachpit mastering xcode 4 develop and design sep 2011
PDF
Xcode4 userguide Apple
PPTX
Lecture1
PDF
SpringPeople Introduction to iOS Apps Development
PDF
Objective-C
Cocoa Programming For Mac Os X 4th Edition Aaron Hillegass Adam Preble
Programming iOS 5 2nd Edition Matt Neuburg
Learning the iPhone SDK for JavaScript Programmers Create Native Apps with Ob...
Cocoa fundamentalswert
Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Obj...
Objective C Fundamentals 1st Edition Christopher Fairbairn
Objective C Fundamentals 1st Edition Christopher Fairbairn
Mac Osx Developer Guide Jesse Feiler Auth
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
Drugs
Ios 12 Programming Fundamentals With Swift Swift Xcode And Cocoa Basics 5th E...
Iphone programming: Objective c
Xcode, Basics and Beyond
Session 1 - Introduction to iOS 7 and SDK
Peachpit mastering xcode 4 develop and design sep 2011
Xcode4 userguide Apple
Lecture1
SpringPeople Introduction to iOS Apps Development
Objective-C
Ad

Recently uploaded (20)

PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Complications of Minimal Access Surgery at WLH
PPTX
master seminar digital applications in india
PPTX
Cell Types and Its function , kingdom of life
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Institutional Correction lecture only . . .
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Pre independence Education in Inndia.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Business Ethics Teaching Materials for college
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPH.pptx obstetrics and gynecology in nursing
Complications of Minimal Access Surgery at WLH
master seminar digital applications in india
Cell Types and Its function , kingdom of life
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Supply Chain Operations Speaking Notes -ICLT Program
Institutional Correction lecture only . . .
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Final Presentation General Medicine 03-08-2024.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Anesthesia in Laparoscopic Surgery in India
Pre independence Education in Inndia.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Renaissance Architecture: A Journey from Faith to Humanism
Business Ethics Teaching Materials for college
Ad

Learning Cocoa with Objective C 2nd Edition James Duncan Davidson

  • 1. Learning Cocoa with Objective C 2nd Edition James Duncan Davidson download pdf https://ebookfinal.com/download/learning-cocoa-with-objective-c-2nd- edition-james-duncan-davidson/ Visit ebookfinal.com today to download the complete set of ebook or textbook!
  • 2. Here are some recommended products that we believe you will be interested in. You can click the link to download. Learn Objective C for Java Developers 1st Edition James Bucanek (Auth.) https://ebookfinal.com/download/learn-objective-c-for-java- developers-1st-edition-james-bucanek-auth/ Objective C phrasebook 2nd ed Edition David Chisnall https://ebookfinal.com/download/objective-c-phrasebook-2nd-ed-edition- david-chisnall/ Objective Proficiency Student s Book with Answers with Downloadable Software 2nd Edition Annette Capel https://ebookfinal.com/download/objective-proficiency-student-s-book- with-answers-with-downloadable-software-2nd-edition-annette-capel/ Learning PowerShell DSC 2nd Edition James Pogran https://ebookfinal.com/download/learning-powershell-dsc-2nd-edition- james-pogran/
  • 3. Engineering Design with Polymers and Composites 2nd Edition James C. Gerdeen Phd Pe (Author) https://ebookfinal.com/download/engineering-design-with-polymers-and- composites-2nd-edition-james-c-gerdeen-phd-pe-author/ Learn Cocoa on the Mac 2nd Edition Jack Nutting https://ebookfinal.com/download/learn-cocoa-on-the-mac-2nd-edition- jack-nutting/ Objective C Programmer s Reference 1st Edition Carlos Oliveira (Auth.) https://ebookfinal.com/download/objective-c-programmer-s- reference-1st-edition-carlos-oliveira-auth/ Objective C Quick Syntax Reference 1st Edition Matthew Campbell (Auth.) https://ebookfinal.com/download/objective-c-quick-syntax- reference-1st-edition-matthew-campbell-auth/ Combined Standards Glossary 4th ed Edition Ann C. Davidson https://ebookfinal.com/download/combined-standards-glossary-4th-ed- edition-ann-c-davidson/
  • 5. Learning Cocoa with Objective C 2nd Edition James Duncan Davidson Digital Instant Download Author(s): James Duncan Davidson, Inc. Apple Computer ISBN(s): 9780596003012, 0596003013 Edition: 2 File Details: PDF, 6.03 MB Year: 2002 Language: english
  • 6. • Reviews • Examples • Reader Reviews • Errata Learning Cocoa with Objective-C By Apple Computer, Inc. , James Duncan Davidson Publisher: O'Reilly Pub Date: September 2002 ISBN: 0-596-00301-3 Pages: 382 Copyright Preface Audience About the Example Code How This Book Is Organized How to Use This Book Conventions Used in This Book How to Contact Us Acknowledgments Part I: Cocoa Overview and Foundation Chapter 1. Introduction to Cocoa Section 1.1. The Mac OS X Programming Environment Section 1.2. Cocoa Defined Section 1.3. The Cocoa Frameworks Section 1.4. Languages Section 1.5. The Foundation Framework Section 1.6. The Application Kit Framework Chapter 2. Cocoa Development Tools Section 2.1. Installing the Developer Tools Section 2.2. Interface Builder Section 2.3. Other Tools Section 2.4. Exercises Chapter 3. Object-Oriented Programming with Objective-C Section 3.1. Introducing Objects Section 3.2. Creating and Using Objects Section 3.3. Methods and Messages Section 3.4. Objective-C-Defined Types Section 3.5. Creating New Classes
  • 7. Section 3.6. Overriding Methods Section 3.7. Other Concepts Section 3.8. Exercises Chapter 4. The Cocoa Foundation Kit Section 4.1. Strings Section 4.2. Collections Section 4.3. Memory Management Section 4.4. Exercises Part II: Single-Window Applications Chapter 5. Graphical User Interfaces Section 5.1. Graphical User Interfaces in Cocoa Section 5.2. Designing Applications Using MVC Section 5.3. Create the Currency Converter Project Section 5.4. Create the Interface Section 5.5. Define the Classes Section 5.6. Connect the Model, Controller, and View Section 5.7. Implement the Classes Section 5.8. Build and Run Section 5.9. Exercises Chapter 6. Windows, Views, and Controls Section 6.1. Windows and the Window System Section 6.2. The View Hierarchy Section 6.3. Coordinate Systems Section 6.4. Controls, Cells, and Formatters Section 6.5. Targets and Actions Section 6.6. Exercises Chapter 7. Custom Views Section 7.1. Custom View Creation Steps Section 7.2. Create a Custom View Section 7.3. Drawing into a View: Behind the Scenes Section 7.4. Draw Strings into a View Section 7.5. Draw Paths into a View Section 7.6. Exercises Chapter 8. Event Handling Section 8.1. Events
  • 8. Section 8.2. Dot View Application Section 8.3. Event Delegation Section 8.4. Notifications Section 8.5. Exercises Chapter 9. Models and Data Functionality Section 9.1. Protocols Section 9.2. Key-Value Coding Section 9.3. Table Views Section 9.4. Table View Example Section 9.5. Saving Data: Coding and Archiving Section 9.6. Using Formatters Section 9.7. Sorting Tables Section 9.8. Exercises Part III: Document-Based Applications Chapter 10. Multiple Document Architecture Section 10.1. Architectural Overview Section 10.2. Building a Document-Based Application Section 10.3. Exercises Chapter 11. Rich-Text Handling Section 11.1. Cocoa's Text System Section 11.2. Creating a Rich-Text Editor Section 11.3. Enabling the Font Menu Section 11.4. Text Storage and Attributed Text Section 11.5. Enabling the Text Menu Section 11.6. Handling Embedded Images Section 11.7. Exercises Part IV: Miscellaneous Topics Chapter 12. Printing Section 12.1. Printing a View Section 12.2. Using Print Operations Section 12.3. Setting Margins Section 12.4. Exercises Chapter 13. Bundles and Resources Section 13.1. Peeking Inside Bundles Section 13.2. Using Bundles
  • 9. Section 13.3. Exercises Chapter 14. Localization Section 14.1. Mac OS X Language Preferences Section 14.2. Localizing Resources Section 14.3. Localizing Nib Files Section 14.4. Localizing Strings Section 14.5. Exercises Chapter 15. Defaults and Preferences Section 15.1. How Preferences Work Section 15.2. Using Defaults Section 15.3. Command-Line Preferences Access Section 15.4. Using Unique Application Identifiers Section 15.5. Exercises Chapter 16. Accessory Windows Section 16.1. The Role of File's Owner Section 16.2. Making an Info Window Section 16.3. Exercises Chapter 17. Finishing Touches Section 17.1. Tidying Up the User Interface Section 17.2. Providing an Icon Section 17.3. Providing Help Section 17.4. Customizing the About Box Section 17.5. Tweaking Compiler Settings Section 17.6. Packaging for Distribution Section 17.7. Closure Section 17.8. Exercises Part V: Appendixes Appendix A. Exercise Solutions Section A.1. Chapter 2 Section A.2. Chapter 3 Section A.3. Chapter 4 Section A.4. Chapter 5 Section A.5. Chapter 6 Section A.6. Chapter 7 Section A.7. Chapter 8
  • 10. Section A.8. Chapter 9 Section A.9. Chapter 10 Section A.10. Chapter 11 Section A.11. Chapter 12 Section A.12. Chapter 13 Section A.13. Chapter 14 Section A.14. Chapter 15 Section A.15. Chapter 16 Section A.16. Chapter 17 Appendix B. Additional Resources Section B.1. Documentation on Your Hard Drive Section B.2. Printed Documentation Section B.3. Getting Sample Code Section B.4. Web Sites Section B.5. Mailing Lists Section B.6. Partnering with Apple Appendix C. Using the Foundation and Application Kit API References Section C.1. Cocoa Browser Colophon Index
  • 11. Book: Learning Cocoa with Objective-C Copyright © 2002, 2001 O'Reilly & Associates, Inc. All rights reserved. Printed in the United States of America. Published by O'Reilly & Associates, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O'Reilly & Associates books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safari.oreilly. com). For more information contact our corporate/institutional sales department: 800-998- 9938 or corporate@oreilly.com. Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly & Associates, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. The association between the image of an Irish setter and the topic of Cocoa is a trademark of O'Reilly & Associates, Inc. Apple Computer, Inc. boldly combined open source technologies with its own programming efforts to create Mac OS X, one of the most versatile and stable operating systems now available. In the same spirit, Apple has joined forces with O'Reilly & Associates to bring you an indispensable collection of technical publications. The ADC logo indicates that the book has been technically reviewed by Apple engineers and is recommended by the Apple Developer Connection. Apple, the Apple logo, AppleScript, AppleTalk, AppleWorks, Carbon, Cocoa, ColorSync, Finder, FireWire, iBook, iMac, iPod, Mac, Mac logo, Macintosh, PowerBook, QuickTime, QuickTime logo, Sherlock, and WebObjects are trademarks of Apple Computer, Inc., registered in the United States and other countries. The "keyboard" Apple logo ( ) is used with permission of Apple Computer, Inc. While every precaution has been taken in the preparation of this book, the publisher and the author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
  • 12. Book: Learning Cocoa with Objective-C Preface Like a finely tuned BMW, Mac OS X is the ultimate programming machine. Under the hood lies a powerful Unix engine, named Darwin, developed via Apple's open source initiative and based on FreeBSD 4.4 and the Mach 3.0 microkernel. On the outside is a highly polished graphical user interface (GUI) whose usability can't be touched by any desktop environment on the planet, including GNOME and KDE for Linux, as well as Windows XP. The newest cat on the block-Mac OS X 10.2 (code-named Jaguar)-takes desktop and network computing to a new level. Jaguar, first introduced to developers as a pre-Alpha release at Apple's Worldwide Developer Conference (WWDC) in May 2002 and later released to the public on August 24, 2002, brings many changes and improvements to the legacy set forth by the previous Mac OS X releases. These changes include several additions to the Cocoa application programming interfaces (APIs), known as the Cocoa frameworks, arguably the best GUI application development environment on the face of the planet. An integrated set of libraries and runtime, Cocoa provides a rich infrastructure on which to build great user applications. On Codenames and Cats As mentioned earlier, Mac OS X 10.2 was code-named Jaguar during its development and testing phase. Earlier releases of Mac OS X included Puma (Mac OS X 10.1) and Cheetah (Mac OS X 10.0). Software developers like to give their projects names that evoke some emotion or theme for the release being worked on. A little research shows that the cheetah is the world's fastest land mammal, while the jaguar, unlike many other big cats, has no predators save for man. Worthy goals indeed. Apple became so enamored of the Jaguar name that they ended up putting it onto the box in which Mac OS X 10.2 is released, complete with a jaguar fur motif. When it comes to building Cocoa applications, developers can choose from three languages to work with the Cocoa APIs: Objective-C, Java, and AppleScript. This new edition of Learning Cocoa, retitled as Learning Cocoa with Objective-C and thoroughly revised and updated for Jaguar, shows you how to get started with building Cocoa applications for Mac OS X using the Objective-C binding to the Cocoa frameworks.
  • 13. As an introductory book on Cocoa development, Learning Cocoa with Objective-C accomplishes the following: ● Introduces you to the concepts of object-oriented programming with Objective-C ● Shows you how to use Apple's Developer Tools, in particular, Project Builder and Interface Builder ● Introduces you to Cocoa's frameworks-Foundation and the Application Kit-by having you build simple applications along the way The concepts learned in one chapter spill over to the next, and the sample programs you build while reading along get more complex as you go deeper into the book. By the end of the book, you will have learned enough about Cocoa and Objective-C to set you on your way to higher learning, and for that, there are plenty of other books available: ● Building Cocoa Applications: A Step-by-Step Guide, by Simson Garfinkel and Michael K. Mahoney (O'Reilly & Associates, Inc.) ● Cocoa Programming for Mac OS X, by Aaron Hillegass (Addison-Wesley) ● Cocoa Programming, by Scott Anguish, Erik Buck, and Donald Yacktman (Sams) While these books also deal with Cocoa programming with Objective-C, each book takes a slightly different approach. Programming is a funny art, and sometimes it is invaluable to see several approaches to the same subject matter. To be a true master of the craft, you'll probably want to read each of these books and glean from each what you can. [1] In addition to this and the previously listed books, you also have a vast resource of information at your fingertips in the form of Apple's own documentation. Installed on your system along with the Developer Tools, Apple's docs can be found in /Developer / Documentation in both PDF and HTML format. If you have a fast or constant link to the Internet, you can save some space on your hard drive by dumping these docs in the Trash and using the online documentation found at http://developer.apple.com. When Apple updates their documentation, they often first post the revisions online, so you might want to keep that URL handy. Additionally, there are some online resources-mailing lists and web sites-that you should subscribe to and read frequently. A listing of these resources can be found in Appendix B, located at the back of this book. [1] Learn the ways of the Force, Luke-just stay away from the Dark Side.
  • 14. Book: Learning Cocoa with Objective-C Section: Preface Audience As the title implies, this is a "Learning" book-a book for newcomers to Cocoa and Objective-C. This book assumes you have a basic knowledge of ANSI C and that you're open to learning the concepts of object-oriented programming. If you're not familiar with C and you haven't programmed with Java or some other compiled language, you might want to hold off on reading this book just yet. Likewise, if you're already familiar with Objective- C or have programmed for NeXTSTEP, chances are this book will be too basic for your liking. Not that you can't pick something up from reading it, but this book is better suited for newcomers. Who Should Read This Book As mentioned earlier, this book was written for programmers who are interested in learning how to develop Cocoa applications using the Objective-C language. It assumes that you have some experience with C programming, as well as a basic understanding of computer- science concepts. If you're familiar with C or Java, you should have no problem picking up Objective-C. Who Should Not Read This Book Of course, one book can't be everything to everyone. Some people will find this book too basic or too advanced for their liking. For example: Novice programmers If you have never programmed before and want to learn the basics of programming, you should start off reading an introductory programming text. To learn C, the language upon which Objective-C is based, we recommend the following books: ❍ The C Programming Language, by Brian W. Kernighan and Dennis M. Ritchie (Prentice Hall) ❍ Practical C Programming, by Steve Oualline (O'Reilly) These books will introduce you to the concepts of programming with C, giving you the foundation you need before reading this book. Experienced NeXT developers If you have worked with OpenStep or NeXTSTEP, you will probably find the
  • 15. material in this book too basic. You might use this book as a refresher to come up to speed, but it probably won't be the Nirvana you're searching for. Java developers This book covers Cocoa using the Objective-C language. If you are a Java developer and don't mind learning a new language (learning new languages is always good for you!), then you will do fine with this book. However, if you want a strict treatment of Cocoa with Java, this book is not for you. What You Need to Know Extensive programming experience is not required to complete the examples in this book. Since the Objective-C language is a superset of ANSI C, experience with the C programming language is helpful. If you have experience with an object-oriented programming language such as Java or Smalltalk, you should find the concepts of Objective-C easy to comprehend. If you don't have experience with object-oriented concepts, don't worry; we will try our best to guide you through the terminology and to give you pointers to other texts and reference material. No prior experience programming on Mac OS X is necessary to complete the tutorials in this book. We'll show you how to use the Developer Tools that come with Mac OS X and show you how to build your first Cocoa application in no time. At some point you should explore the wealth of developer documentation that Apple installs with the Developer Tools. This documentation covers the Mac OS X system architecture, developer tools, release notes, the Objective-C language, the Cocoa API references, and so on. There are four places you can access Apple's developer documentation: ● The /Developer/Documentation folder on your system. Specifically, most of the Cocoa documentation is located in the /Developer/Documentation/Cocoa folder. ● The Help menu in Project Builder (/Developer/Applications), which is one of the development tools you will use as you work your way through this book. ● Mac Help from the Finder. After launching Mac Help and clicking on the "Help Center" toolbar item, you'll be able to find the Developer Help Center link. ● Online at http://developer.apple.com. As mentioned earlier, Apple often posts updates to its documentation online first, so you should check here if a document on your system doesn't have the answer for which you're looking.
  • 16. Book: Learning Cocoa with Objective-C Section: Preface About the Example Code You will find many examples in this book. The code for these examples is contained within the text, but you may prefer to download a disk image (.dmg ) of the examples rather than typing all that code in by hand. You can find the code online and packaged for download at http://www.oreilly.com/catalog/learncocoa2. [2] You may also want to visit this site for any important notes or errata about the book. All of the examples have been tested using Mac OS X 10.2, Project Builder 2.0, and Interface Builder 2.1. If you use this book with a later release of any of these products, the user interface and features may be different from those shown in the book, but everything should work. However, because the examples utilize many features first introduced with Jaguar, such as GCC 3 [3] and the AddressBook APIs, you should not use an earlier release of Mac OS X with this book. In some of the examples, we put a number (or letter, depending on the other elements on the page) on the right side of any line of code that we explain in detail. Numbered explanations appear below a listing, as shown in the following example: int row = [itemList selectedRow]; // 1 NSString * newName = [[itemList selectedCell] stringValue]; // 2 1. The index of the row is obtained by passing the selectedRow message to the itemList object. 2. The newName string is obtained from the cell by using the stringValue message. [2] This book does not come with a CD-ROM. Bundling a CD would increase the cost of production and the cost to you. It is our belief that anyone reading this book has access to an Internet connection and would rather save money by simply downloading the example code off the Web. [3] GCC 3 introduces support for the C 99 standard, allowing us to make our example code more readable and easier to understand.
  • 17. Book: Learning Cocoa with Objective-C Section: Preface How This Book Is Organized This book consists of 17 chapters and 3 appendixes, organized into 5 parts. The first three parts are organized so that each chapter builds upon the previous one. You should start at the beginning and proceed sequentially until you've read through the last chapter. Most chapters contain example applications for you to work through, as well as exercises that build upon the material covered. Each chapter's applications and exercises are self- contained and do not spread across chapters. Part I Cocoa Overview and Foundation introduces the Cocoa frameworks and describes the high- level features they provide application programmers, as well as how they fit with other Mac OS X frameworks. It also includes a brief introduction to object-oriented programming, the Objective-C language, and Apple's development tools. Chapter 1 Places Cocoa in the context of the Mac OS X programming environment and introduces the frameworks and classes that make up the Cocoa API. Chapter 2 Introduces Project Builder and Interface Builder, Apple's tools for Mac OS X development. The chapter then goes on to describe the wide array of tools and utilities available to assist in building, debugging, and performance-tuning applications on Mac OS X. Chapter 3 Explains the benefits of object-oriented programming practices (as compared to procedural programming) and provides an introduction to the terminology and core concepts needed to use the Cocoa frameworks effectively. It also includes a primer on the Objective-C programming language. Chapter 4 Provides a series of mini-tutorials to introduce the Cocoa Foundation, including strings, arrays, collections, utility functions, and memory management.
  • 18. Part II Single-Window Applications covers the basic building blocks of any Cocoa application that displays a single GUI window to the user. This section uses a series of examples to illustrate the concepts presented. The techniques and concepts you learn in each chapter will lay the foundation for the next chapter. Chapter 5 Introduces the Model-View-Controller (MVC) pattern and how Cocoa programs are structured and developed. You will also learn about nib files and how to use them in your applications. Chapter 6 Goes into detail about how the windowing system works, as well as how to create View and Controller objects to present a user interface. Chapter 7 Cocoa's default set of controls covers most of the common UI needs that applications have, but they can't cover everything. Your application may need to present a specialized view onto a data source or simply draw arbitrary content to the screen. This chapter shows how to create these custom views. Chapter 8 Introduces the event loop and explains how events propagate along the responder chain. It also covers how events are queued and dispatched, as well as how event delegation works. Chapter 9 Shows how to work with the data-bearing objects of an application. The chapter also shows how this information can be utilized with the Controllers and Views of an application and how it can be read from and written to storage. Part III Many applications today, such as word processors and web browsers, are built around the concept of a document. Creating an application that can handle multiple documents is
  • 19. tedious in the best of times. Luckily, Cocoa provides the ability for an application to handle multiple documents with ease. Document-Based Applications shows how to use Cocoa's document architecture. Chapter 10 Presents the basic concepts of the document-handling architecture and how documents are managed. The chapter guides you through the process of creating an application that takes advantage of the architecture. Chapter 11 Shows advanced text-handling abilities of Cocoa, such as handling fonts, working with layout managers, enabling rulers, and working with attachments. Part IV Miscellaneous Topics covers a variety of Mac OS X and Cocoa features that are important to delivering finished applications and giving them their finishing touches. The chapters in this part of the book cover diverse topics and can be read in any order. Chapter 12 This chapter shows you how to add printing functionality to your application. Chapter 13 Here we describe how bundles, application or otherwise, are structured, how icons and document types are defined, and how application signatures work. Chapter 14 Once you build an application, there are several ways to customize the interface to accommodate users in different parts of the world. Chapter 15 Mac OS X provides comprehensive management of user preferences. This chapter explains how to work with this system to store information that can be used across multiple invocations of your application. Chapter 16
  • 20. Applications will often have more than just one interface component. Inspectors and palettes abound in modern applications. This chapter shows in detail how to store your user interface in multiple nib files to improve performance and ease maintainability and localization. Chapter 17 Once you build an application, there are several important things you should do to make it ready for distribution. Cocoa provides default copyright strings and About boxes that need to be edited, and you should probably create some sort of Help documentation for the application. Finally, this chapter shows how to create an icon for your application and add that to the application bundle as well. Part V The Appendixes include quick-reference material for learning more about Cocoa's Objective-C classes and list resources that are beyond the scope of this book for expanding your Cocoa development horizon. Appendix A Provides solutions to all of the exercises found at the end of each chapter. Appendix B Provides a valuable list of Cocoa-related resources and where to find them, including Mac OS X's "built-in" developer documentation, books, mailing lists, and web sites. Appendix C Provides a guide to the various API references available to you as a developer, as well as some tools that will help you search and browse the available documentation.
  • 21. Book: Learning Cocoa with Objective-C Section: Preface How to Use This Book Our recommendation is that you read this book from cover to cover, particularly if you're new to Cocoa and need to learn more about object-oriented programming (OOP). As you read through the book, you should work on the sample programs along the way. Doing so will give you the foundation you need to understand what Objective-C is (and isn't) and the concepts of OOP, most notably the MVC paradigm that aids in GUI application design. We try to take the approach of teaching you small things first and then building on those small concepts throughout the rest of the book. If you have experience with Java or Smalltalk, we recommend that you read this book from front to back as well. Since you have experience with object-oriented concepts and programming, there are some sections that you will be able to skim. However, be careful not to skim too fast, as you might miss some important details.
  • 22. Book: Learning Cocoa with Objective-C Section: Preface Conventions Used in This Book The following is a list of the typographical conventions used in this book: Italic Used to indicate new terms, URLs, filenames, file extensions, directories, commands and options, program names, and to highlight comments in examples. For example, a path in the filesystem will appear as /Developer/Applications. Constant Width Used to show code examples, the contents of files, or the output from commands. Constant Width Bold Used in examples and tables to show commands or other text that should be typed literally. Constant Width Italic Used in examples and tables to show text that should be replaced with user- supplied values. Menus/Navigation Menus and their options are referred to in the text as File Open, Edit Copy, etc. Arrows are used to signify a navigation path when using window options; for example, System Preferences Login Login Items means that you would launch System Preferences, click the icon for the Login control panel, and select the Login Items pane within that panel. Pathnames Pathnames are used to show the location of a file or application in the filesystem. Directories (or folders) are separated by a forward slash. For example, if you see something like, " . . . launch Project Builder (/Developer/Applications)" in the text, that means that the Project Builder application can be found in the Applications subdirectory of the Developer directory.
  • 23. A carriage return ( ) at the end of a line of code is used to denote an unnatural line break; that is, you should not enter these as two lines of code, but as one continuous line. Multiple lines are used in these cases due to printing constraints. %, # The percent sign (%) is used in some examples to show the user prompt from the tcsh shell; the hash mark (#) is the prompt for the root user. Menu Symbols When looking at the menus for any application, you will see some symbols associated with keyboard shortcuts for a particular command. For example, to create a new project in Project Builder, you would go to the File menu and select New Project (File New Project), or you could issue the keyboard shortcut, Shift- -N. You should pay special attention to notes set apart from the text with the following icons: This is a tip, suggestion, or general note. It contains useful supplementary information about the topic at hand. This indicates a warning or caution. It will help you solve and avoid annoying problems.
  • 24. Book: Learning Cocoa with Objective-C Section: Preface How to Contact Us We have tested and verified the information in this book to the best of our ability, but you may find that features have changed (or even that we have made mistakes!). As a newcomer to Cocoa and a reader of this book, you can help us to improve future editions by sending us your feedback. Please let us know about any errors, inaccuracies, bugs, misleading or confusing statements, and typos that you find anywhere in this book. Please also let us know what we can do to make this book more useful to you. We take your comments seriously and will try to incorporate reasonable suggestions into future editions. You can write to us at: O'Reilly & Associates, Inc. 1005 Gravenstein Highway North Sebastopol, CA 95472 (800) 998-9938 (in the U.S. or Canada) (707) 829-0515 (international/local) (707) 829-0104 (fax) You can also send us messages electronically. To be put on the mailing list or to request a catalog, send email to: info@oreilly.com To ask technical questions or to comment on the book, send email to: bookquestions@oreilly.com The web site for Learning Cocoa with Objective-C, Second Edition lists examples, errata, and plans for future editions. You can find this page at: http://www.oreilly.com/catalog/learncocoa2 For more information about this book and others, see the O'Reilly web site: http://www.oreilly.com
  • 25. Book: Learning Cocoa with Objective-C Section: Preface Acknowledgments First and foremost, I'd like to thank my editor, Chuck Toporek, who talked me into writing the new edition of this book (twice even) and alternately utilized the editor's whip and kind words of encouragement to guide me toward its completion. Without him, his advice, and his faith in me to get the job done, this book would not have happened. Also at O'Reilly, I'd like to thank Jeff Holcomb, the copyeditor for this book; David Chu, who assisted Chuck in pulling this book together for production; Brenda Miller, who produced the index; Derrick Story, who encouraged my early efforts with Cocoa by letting me write for the O'Reilly Network; and finally Tim O'Reilly, Michael Loukides, and Bob Eckstien, who always knew that I would write a book for O'Reilly & Associates some day. Thanks as well to all the people at Apple, especially to the original NeXT and Apple documentation teams. For this new edition, we've changed the title, stripped the book down to bare metal, and built it back up. Without the foundation provided by the original documentation teams, the job would have been much harder. Also thanks to the many Cocoa engineers at Apple for taking the time to hash over the outline for the revision, and for reviewing drafts of the manuscript along the way. You guys know who you are. Many thanks to the independent reviewers of this book, including Jo Davidson (who gave up part of the Memorial Day weekend to help us meet our deadlines) and Mike Barron. Special thanks to Jason Hunter, who gave me an author's insight into the writing process, for helping me find the right metaphors in Chapter 3, and for always being there when needed. In addition, many thanks to Wilfredo Sánchez Vega, who got me hooked on Mac OS X in the first place after my Windows laptop went through one of its periodic meltdowns. Music from many creative and talented people fueled the writing of this book. Among the artists in heavy rotation in iTunes and on the iPod: Tori Amos, Bedrock, Blue Man Group, BT, The Chemical Brothers, The Crystal Method, Darude, DJ Amber (from the San Francisco Bay rave scene), DJ Dragn'fly (from the Sacramento rave scene), Brian Eno, Fatboy Slim, The Future Sound of London, Juno Reactor, Moby, New Order, The Orb, Orbital, Mario Piu, Prodigy, Rinocerose, Sasha, Squarepusher, Underworld, Paul van Dyk, and many others. And finally, thanks to all my family and friends who lent support to the book writing process and who encouraged me to chase my dreams: Dad, who taught me everything I needed to know after all; Mom, who brought me into the world; Mahaila, who probably never expected that I-of all the people in the family-would write a book; my sisters Susan, Illona, Joli, and Heather, as well as my friends Justyna Horwat and Jim Driscoll. Last, but not least, I want to thank Eleo, who ended up thoroughly addicted to the wireless network I
  • 26. Random documents with unrelated content Scribd suggests to you:
  • 27. realization of noble ethical ideals. He is anxious, at all events, that his purely rational arguments shall not carry him too far, as, on one occasion, after a long disquisition, the undoubted purport of which is to refer oracular inspiration to subterraneous fumes and exhalations, or, as one of the speakers says, “to accident and natural means,” Plutarch (“Lamprias” here is clearly a thin disguise of Plutarch himself) is disturbed and confused that he should be thought desirous of refuting any “true and religious” opinions recognized with respect to the Deity; and he forthwith proceeds to prove that it is quite possible to investigate natural phenomena for secondary causes, while recognizing a final cause in the creative Deity.[152] Not only does Plutarch sympathize with those who accept with pious simplicity the tenets of the “ancient and hereditary Faith;” not only does he deprecate too severe a handling of religious questions; but he is also eager to support his view of a subject by showing that it is not out of harmony with the traditions or prescriptions of the national belief. Concluding that consolatory letter to his wife upon the death of their little daughter, which is the most humane and natural expression of sympathy left us by antiquity, he tries to show that those who die young will earlier feel at home in the other world than those whose long life on earth has habituated their souls to a condition so different from that which exists “beyond the gates of Hades,” and he says that this is a truth which becomes clearer in the light of the ancient and hereditary customs.[153] No libations are poured for the young that are dead. They have no share in earth, nor in the things of earth. The laws do not allow mourning for children of such tender years, “because they have gone to dwell in a better land, and to share a diviner lot.” And he adds, “I know that these questions are involved in great uncertainty; but since to disbelieve is more difficult than to believe, in external matters let us act as the laws enjoin, while within we become more chaste, and holy, and undefiled.”[154] It must not be overlooked that Plutarch was long a priest of the Delphian Apollo, and that the duties of this position responded to some internal need of his soul, and were not regarded by him as a merely official dignity, is proved by the manner in which he alludes to the subject. He is speaking on one occasion of the many indications which the shrine gives of resuming its former
  • 28. “wealth, and splendour, and honour,” and he congratulates himself on the zealous and useful part he has taken in aiding the work of this revival.[155] He mentions two friends as co-workers in the sacred task, and appears also to felicitate a certain Roman Governor of Achaia on similar grounds. But he reverently proceeds to make it quite clear that it is the god himself who is the ultimate cause of these returning blessings. “But it is not possible that so great a transformation should have taken place in so short a time through human activity, unless the god were present and continuing to inspire his oracle,” and he concludes by censuring those who, in their inability to discern the motive actuating the divine methods with mankind, “depart condemning the god, instead of blaming us or themselves, that they cannot, by reason, discover the intention of the god.”[156] Plutarch’s attitude of more than tolerance to the “ancient and hereditary Faith,” an attitude which is, of course, not inconsistent with his desire to place that Faith on a rational basis, is partly explicable in the light of his emphatic gratitude to the existing political constitution of the Græco-Roman world. He would have been an admirable co-worker with Mæcenas—πρόθυμος καὶ χρήσιμος[157]— in carrying out the religious reforms of Augustus. He regarded the welfare of Society and the State, of the family and the individual citizen, as bound up with a belief in the gods whose agency was so clearly visible in bringing the world to that state of perfection which it now enjoyed, and which promised to be eternal. No one now even dreamed of doubting the identity of the gods of Rome with those of Greece, and Plutarch carries the identification to the extent of including the gods of almost every people constituting the Roman Empire.[158] These universal powers had the world in their providential care, and Rome was the divinely chosen instrument of their beneficent purposes. The Emperor is the depository of the sacred governing power of the world.[159] When Tiberius shut himself up in Capreæ, this divine potency never left him. And though expressions of this kind may be interpreted as a merely formal recognition of the official dignity of the Head of the World, Plutarch’s many eloquent descriptions of the blessings of the Pax Romana
  • 29. leave us in no doubt respecting the character of his views on this subject. “I welcome and approve,” says Theon, “the present position of affairs, and the subjects about which we now consult the oracle. For there now reigns among us a great peace and calm. War has ceased. Expulsions, seditions, tyrannies, are no more, and many other diseases and disasters which tormented Greece, and demanded powerful remedies, are now healed. Hence the oracle is no longer consulted on matters difficult, secret, and mysterious, but on common questions of everyday life. Even the most important oracles addressed to cities are concerned with crops and herds, and matters affecting the public health.”[160] In the “Præcepta Gerendæ Reipublicæ” he is still more outspoken in his praise of the Roman administration, and in his recognition of the opportunities which it gives for the culture of the individual character within the limits of a greatly generous sway. Plutarch, as is well known, was gifted with a patriotic regard for the old achievements of the Hellenic name, but he recognizes with so keen an insight the great work being accomplished by Rome in the fostering of municipal institutions, and the establishment of a peace which meant the undisturbed happiness of millions of obscure families,[161] that, in the sphere of practical politics, he deliberately turns away from the group of inspiring ideas connected with ancient Hellenic patriotism. He alludes coldly, perhaps even sneeringly, to such of his contemporaries as fancied they could apply the ancient traditions of glory to those late and unseasonable times, like little children who would try to wear their father’s sandals;[162] counsels a complete submission to the duly appointed Roman authorities; fully persuaded that within the limits of their supremacy there is as much freedom as a reasonable man could desire to enjoy; and honestly claims to find scope, in a little Bœotian township, for such political ambition as could be safely and wisely indulged.[163] It is not difficult to sneer at the prudential limitation of patriotism to such petty, insignificant, and meagre efforts as the superintendence of bricks and mortar and the carting of municipal rubbish; but the wiser thing is to note that Plutarch’s opposition to vain fancies of the revival of the ancient Hellenic splendour, except perhaps in such a form as a Hadrian
  • 30. might be inclined to revive it in an artificial Panhellenium, is based on the conviction that happiness depends upon the free development of individual character, the unrestricted enjoyment of domestic peace, the undisturbed intercourse of social life; and he knew that the Roman sway made it possible, for Greeks at any rate, to enjoy these blessings to a degree never previously known in their chequered history.[164] With a clear recognition of the historical causes of the political decadence of Hellenism, he regards civic discord as the evil which most demands the attention of those who still seek opportunities for public action, and he is particularly grateful to the strong hand of Rome for controlling the internecine animosities of Greek cities. “Consider,” says he, “our position with regard to those blessings which are counted as the greatest that a city can enjoy: Peace, Freedom, Fertility of Soil, Increase of Population, Domestic Concord. As regards Peace, our peoples have no present need of politicians. Every Greek war, every Barbarian war, has vanished from among us. For Freedom, our peoples enjoy as much as their rulers allow them, and a greater share would perhaps not be any better for them. For fine seasons and plentiful harvests, for families of ‘children like their sires,’ and for gracious aid to the new-born child, the good man in his prayers will invoke the gods on behalf of his fellow- citizens.”[165] As for civic concord, that, he says, is in our own power, and those who desire a life of political activity could not do better than devote themselves to the task of spreading harmony and friendship among their fellow-citizens. The peace which the Romans have established in the world makes it possible to develop character on these social lines, and he recognizes, in a pregnant comparison, that the freedom which the Greeks enjoy is sufficient to allow the fullest play to the development of their own moral character. The drama is composed and staged: the prompter stands behind the scene ready with the cue: but the player can give his own interpretation of the character he represents, though remembering that a slip may meet with a worse fate than mere hissing in the audience.[166] Plutarch is clearly of opinion that this state of things is best for his fellow-countrymen. He is as firmly convinced of the divine mission of
  • 31. Rome as ever was Virgil or any other patriotic Roman.[167] In his tract “De Fortuna Romanorum,” he discusses the question whether the greatness of Rome was due to Τύχη or Ἀρετή, or, as he expresses the antithesis in another place, to Τύχη or Πρόνοια—to Chance or to Providence, we may translate, if we recognize that here Chance is the divine element, and Providence the human.[168] In other words, is the grandeur of Rome the result of human virtue and forethought, or is it a direct gift of the Deity to mankind? He decides in the latter sense, though conceding much to the valour of individual Romans; and his incidental expressions of opinion bear as much evidence to the divinely inspired and divinely guided character of Roman administration as is borne by his definite conclusion. He says that, whichever way the question is decided, it can only redound to the glory of Rome to be the subject of a discussion which has hitherto been confined to the great natural phenomena of the universe—the earth, the sea, the heavens, and the stars. His very words are curiously reminiscent of Virgil’s rerum pulcherrima, Roma (τῶν ἀνθρωπίνων ἔργων τὸ κάλλιστον),[169] as he tells how Time, in concert with the Deity, laid the foundations of Rome, harmonizing to that end the influence of Fortune and Virtue alike, thus establishing for all the nations of mankind a sacred hearth, a harbour and a resting-place, “an anchorage from the wandering seas” of human stress and turmoil, a principle of eternity amid the evanescence and mutability of other things. He describes with great vigour of language the instability of the world under the domination of other Empires, until Rome acquired her full strength and splendour, and brought peace and security and permanence among these warring elements. [170] Being so satisfied with the constitution of the world, it is natural that Plutarch should have nothing but reverent words for the eternal powers whose guidance had led to so happy a disposition of human affairs. However much Philosophy should endeavour to free the mind from the crude and vulgar elements in the “ancient and hereditary Faith,” she must never be tempted to profess other than the most pious belief in its fundamental truth and right; and the ultimate aim of Philosophy must be to strengthen and revive the
  • 32. ancient Religion by freeing it from inconsistencies and crudities which, so long as they appeared to be an essential part of the system, only existed to shock the pious and to encourage atheism. Plutarch’s attitude towards the ancient Faith may thus be defined as one of patriotic acceptance modified by philosophic criticism; not that criticism which tries everything from the fixed standpoint of a set of rules logically irrefutable: but that which is really the spirit of rationalism pervading all philosophies alike. If Plutarch’s attitude is that of a Platonist, it is that of a Platonist whose experience of ordinary human affairs, and whose recognition of their importance in Philosophy, have compelled him to modify the genuine teaching of the Master into something like the spirit of compromise characterizing the later Academics. His teaching is not the philosophic despotism of Plato; it might easily be characterized as “plebeian,”[171] as Epicureanism was by Cicero, or “commonplace,” as Aristotle has been described by Platonists. It breathes that free spirit of truth which bids every man, whether he is a practised philosopher or not, or even if he has not studied mathematics, to give a reason for the faith that is in him: to apply the touchstone of his own practical experience and native intelligence to the domain of Ethics and Religion as to the domain of every-day life, because, as a matter of fact, the domain of every-day life is the domain of Religion and Ethics. The dictum of Hesiod, enforced by Aristotle and applied in practice by the Epicureans, and by the Stoics, is the keynote of the teaching of Plutarch:—“He is most excellent of all, who judges of all things for himself.”
  • 33. CHAPTER V. Plutarch’s Theology—His conception of God not a pure metaphysical abstraction, his presentment of it not dogmatic—General acceptance of the attributes recognized by Greek philosophy as essential to the idea of God—God as Unity, Absolute Being, Eternity—God as Intelligence: Personality of Plutarch’s God intimately associated with his Intelligence—God’s Intelligence brings him into contact with humanity: by it he knows the events of the Future and the secrets of the human heart—From his knowledge springs his Providence—God as Father and Judge—the De Sera Numinis Vindicta— Immortality of the Soul. It will readily be understood that on no question of Religion is Plutarch more willing to act as “Arbitrator” than on that concerned with the Nature and Attributes of the Deity. He knows and, as we have seen, recognizes to the full the discordant nature of the elements which, by force of circumstances, have been driven into some kind of cohesion in the formation of the popular belief, and it must be admitted that his efforts to harmonize them into a rational consistency are not completely successful. His own conception of the Divine nature resembles the popular notion in being a compound of philosophy, myth, and legalized tradition. From Philosophy he accepts the Unity of God; from popular Mythology he accepts certain names of deities, and certain traditional expressions, which he understands, however, in a sense quite different from any interpretation current in the popular views, while, at the same time, he never uses these names and expressions without an air and attitude of the most pious regard. The philosophical part of his teaching on the nature of God is largely Greek, but by no means entirely so, and neither is it the teaching of any particular school of Greek philosophy. The Demiurgus of the Timæus: the One and Absolute of the Pythagoreans: the Πρῶτον κινοῦν, the νόησις, νοήσεως νόησις of Aristotle; the material immanent World-Soul—the λόγος ὁ ἐν τῇ ὕλῃ—of the Stoics:—one and all contribute qualities to the Plutarchic Deity, and show how irresistible the necessity for unity
  • 34. had become in the spiritual, as in the political, world. The metaphysical Deity thus created from these diverse elements is made personal by the direct ethical relation into which He is brought with mankind (as in the punishment of sin), while the suggestion of personality is aided by the use of the Greek popular names of the deities to describe the attributes of the One Supreme God. Thus it has already been noted that while Plutarch is ostensibly discussing the attributes of Apollo he is actually defining his position with reference to abstract Deity. This ill-harmonizing combination of metaphysics and popular belief is further placed in contact with views originated by Oriental creeds, with Zoroastrianism, with Manichæism, with “certain slight and obscure hints of the truth, which are to be found scattered here and there in Egyptian Mythology,”[172] the whole presenting a strange conglomeration, which appears to defy any attempt to make a consistent theology of it, until we see Plutarch’s method conspicuously emerging with its twofold aim, of proving that all these different views of God are merely different ways of striving after belief in the same Supreme Power, and of inculcating a sympathetic and liberal attitude of mind, which is far more conducive to unity than a detailed agreement on points of minor importance.[173] This endeavour after unity is supported by a strenuous and sincere belief in what at first sight appears to be a principle of diversity—the belief, namely, in Dæmons —but which Plutarch uses to great effect in his attempts after unity, by assigning, with Pythagoras,[174] every recognized tradition unworthy of the Highest to these subordinate beings whose influence is everywhere felt in nature and in human life, and whose presence, at any rate, interpenetrates and overruns the whole of Plutarch’s views on religion.[175] It is no unfitting circumstance in a priest of Apollo that his noblest utterances respecting the nature of God should be contained in discourses connected more or less with the temples and traditions of the god. In the discussion, for instance, on the syllable “E” written over the narrow entrance of the Amphictyonic Temple at Delphi, Ammonius is represented as expressing views of the Divine Nature which are unsurpassed for sublimity in any other part of Plutarch’s
  • 35. writings, or even in Greek literature generally. We quote them here as embodying Plutarch’s beliefs on the Unity, Eternity, and Absoluteness of the Divine Nature. “Not then a number, nor an arrangement, nor a conjunction or any other part of speech, do I think the inscription signifies. It is rather a complete and concise form of address, an invocation of the God, bringing the speaker with the very word, into a conscious recognition of His power. The God salutes each of us, as we approach His shrine, with the great text, ‘Know thyself,’ which is His way of saying χαῖρε to us; and we in our turn, replying to the God, say εἶ—‘Thou art,’ thus expressing our belief in His true and pure and incommunicable virtue of absolute being.[176]... Now we must admit that God absolutely is; not that he is with reference to any period of time, but with reference to an immovable, immutable, timeless eternity, before which there was nothing, after which there is nothing, in respect to which there is neither future nor past, than which there is nothing older or younger. But being Unity, the Unity that he is now is the same Unity with which he occupies eternity; and nothing really exists but that which is endowed with the same absolute existence as he—neither anything that has come into existence, nor shall come into existence, nor anything which had a beginning, or shall have an end. In worshipping him, therefore, we ought assuredly to salute and address him in a manner corresponding to this view of him; as, e.g., in the phrase already used by some ancient philosophers, the phrase, ‘Thou art one.’ For the Divine principle is not many, as we are, each of us compacted of countless different passions, a mingled and varying conglomerate of assembled atoms. But Being must necessarily be Unity, and Unity must be Being. It is Diversity—that is, the principle of discrepancy from Unity—which issues to the production of non-Being, whence the three names of the God are one and all appropriate. He is Apollo (ἀ πολύς), because he repudiates and excludes the many (τὰ πολλὰ); Ieius (ἵος = εἶς) because he is Unity and Solitude; and Phœbus, of course, was the name given by the ancients to anything that was pure and unsullied.... Now Unity is pure and unsullied; defilement comes by being mixed with other elements, as Homer says that ivory dipped in purple dye ‘is defiled,’ and dyers say that colours mixed are colours
  • 36. ‘corrupted,’ the process being called ‘corruption.’ A pure and incorruptible substance must therefore be one and whole.”[177] —“The Inscription εἶ seems to me to be, as it were, at once the antithesis and the completion of the inscription, ‘Know thyself.’ The one is addressed in reverence and wonder to the God as eternally existent, the other is a reminder to mortality of the frail nature that encompasseth it.”[178] Nowhere is the necessity which Plutarch feels for believing in one supreme ruler of all the imaginable universe more apparent than in a passage in which he is seeking a regulating Intelligence for an admitted plurality of worlds, to account for whose administration a Greek of almost any period would have been constrained to resort to the hypothesis of a plurality of gods, supreme as each individual god might be in his own individual world. The passage in question initiates a discussion on this subject somewhat episodical to the main argument of the “De Defectu Oraculorum.” Plutarch himself is the speaker, though he represents his interlocutors as addressing him by the name of Lamprias.[179] He is inclined to agree that there may be more worlds than one, though repudiating an infinity of worlds. “It is more consonant with reason to assert that God has made more than one world. For He is perfectly good, and deficient in no virtue whatsoever, least of all in those virtues that are associated with Justice and Friendship, which are the fairest of all virtues, and those most appropriate to the divine nature. And as God is not wanting in any respect, so also He possesses no redundant or superfluous characteristics. There must exist, therefore, other gods and other worlds than ours, whose companionship furnishes a sphere for the exercise of these social virtues. For it is not upon Himself, nor upon a part of Himself, but upon others, that He discharges the claims of justice, kindliness, goodness. Hence it is not probable that He is unneighboured and unfriended, or that this world of ours floats alone in the emptiness of infinite space.”[180] Plutarch, however, is merely on tentative ground here; the plurality of worlds was an abstract academic question no less in those days than in these. Admitting a plurality of worlds, it does not necessarily follow that each should be under the dominion of a separate Deity.
  • 37. “What objection,” he asks, in answer to the Stoics, “what objection is there to our asserting that all the worlds are beneath the sway of the Fate and Providence of Zeus, and that He bestows His superintendence and direction among them all, implanting in them the principles and seeds and ideas of all things that are brought about therein? Surely it is no more impossible that ten, or fifty, or a hundred worlds should be animated by the same rule of Reason, or should be administered in accordance with one and the same principle of action, than that a public assembly, an army, or a chorus, should obey the same co-ordinating power. Nay, an arrangement of this kind is in special harmony with the Divine Character.”[181] Plutarch cannot get away from his fixed belief in the absolute Unity of God, and with God’s Unity, as we have already seen, his Eternity and Immutability are involved. But Plutarch re-asserts this truth in various places and forms. In the tract “De Stoicorum Repugnantiis,” though chiefly dealing polemically with the inconsistencies and self- contradictions of Chrysippus and other early Stoics, he clearly exhibits his own views in several passages. In one place[182] he asserts that even those who deny the benevolence of God, as the Jews and the Syrians, do not imagine him as other than eternally and immutably existent, and quotes with approval a sentence from Antipater of Tarsus, to the effect that God is universally regarded as uncreate and eternal. A little later in the development of the argument[183] he adopts the Stoic position—which Chrysippus is represented as contradicting—that the idea of God includes the ideas of happiness, blessedness, self-sufficiency, which qualities are elsewhere shown to exist absolutely and independently of all conceivable causes of opposition.[184] “They are wrong who assert that the Divine Nature is eternal because it avoids and repels anything that might tend to its destruction. Immutability and Eternity must necessarily exist in the very nature of the Blessed One, requiring no exertion on his part to preserve and defend them.” The intermingling of the doctrines of various philosophic sects is interestingly conspicuous throughout these discussions on the nature of God; and not less than elsewhere in the noble observations of the Platonist Ammonius, which have been quoted from the “De Ε
  • 38. apud Delphos.” It is equally interesting to note that all the speakers in that dialogue, while looking with their mind’s eye far beyond any individual member of the Olympian Pantheon to that divine power whose functions correspond with the essential requirements of the loftiest monotheism, yet use the name of Apollo as the professed nucleus of their religious beliefs, and thus bring themselves into formal harmony with the demands of the “ancient and hereditary Faith.” The same tendency, at once orthodox and unifying, is visible in the philosophic import attached, in accordance with the Stoic practice, to the popular names for the god in his various functions. In other tracts and essays the same aim is conspicuous, the same method of treatment is applied. In his fascinating account of the Egyptian myth of Isis and Osiris—which will be dealt with later from the material which it furnishes for investigating Plutarch’s attempts to identify foreign gods with the gods of Greece—he uses both these divine names as a means of approach to the Divine Nature, that One Eternal, Absolute Being, which is the real object of the philosopher’s clarified insight—πολλῶν ὀνομάτων μορφὴ μία.[185] The true object of the service of Isis, for example, is “the knowledge of that First and Supreme Power which is compact of Intelligence; that Power whom the goddess (Isis) bids her servants seek, since He abides by her side and is united with her. The very name of her temple expressly promises the knowledge and the understanding of Being, inasmuch as it is called the Ision (εἰς—ἰὼν), indicating that we shall know Being if we enter with piety and intelligence into the sacred rites of the goddess.”[186] The passage just quoted shows the intimate connexion between Being and Intelligence—the “Supreme Power is compact of Intelligence;” and we are left in little doubt respecting Plutarch’s views on this second aspect of the Divine Nature. The conception of the Deity as νοῦς, an ancient abstraction in Greek philosophy, is at once strengthened and brought nearer to the intelligence of humanity by Plutarch’s simple treatment of it, and by his connecting it, wherever possible, with the traditions of the popular creed. God is not only Intelligence, but intelligent. “The Divine Nature,” says he, “is not blessed in the possession of silver and gold, nor mighty through
  • 39. the wielding of thunders and thunderbolts, but in the enjoyment of knowledge and understanding; and of all the things that Homer has said concerning the gods, this is his finest pronouncement:— ‘Yet both one goddess formed And one soil bred, but Jupiter precedence took in birth And had more knowledge’[187] —a pronouncement in which he gives the palm for dignity and honour to the sovereignty of Jove, inasmuch as he is older in knowledge and wisdom. And I am of opinion that the blessedness of that eternal life which belongs to God consists in the knowledge which gives Him cognizance of all events; for take away knowledge of things, and the understanding of them, and immortality is no longer life, but mere duration.”[188] The free, unfettered exercise of intelligence is therefore a function of the Divine Nature; but although Plutarch is clearly thinking of the νοῦς of Anaxagoras as embodied by Plato in his conception of the Chief Good, yet he succeeds in bringing the Divine Nature, by the exercise of intelligence, into an intimate relation with humanity which the Platonic Demiurgus never attains. The true successors of Plato in the realm of Idealism were the neo-Platonists, who maintained that “the sum total of the Ideas exists in the Divine nous, not outside of it, ‘like golden statues,’ which God must search and look up to before He can think. It is not to be supposed that He must needs run about in search of notions, perhaps not finding them at all, perhaps not recognizing them when found. This is the lot of man, whose life is spent often in the search, sometimes in the vain search, after truth. But to the Deity all knowledge is always equally present.”[189] The vicious weakness of Platonism, whether Old or New, lies in the fact that no real reason exists why God should ever leave the contemplation of “worlds not realized” to create this world after an eternally existing pattern, in the intellectual contemplation of which he was already happy.[190] The “absence of envy” is not a philosophic reason: it is a Platonic leap over an unbridged chasm. The aloofness of the Epicurean gods in their sedes quietæ is the logical outcome of this aspect of Platonism. Plutarch gives the Divine Intelligence an interest in the beings He
  • 40. has created. Apollo (here again the popular name is used for the Divine Being) knows all the difficulties that trouble the public and private lives of humanity, and he knows their solutions also. “In private matters we inquire of Apollo as a seer, in public matters we pray to him as a god. In the philosophic nature of the soul he is the author and inspirer of intellectual difficulties and problems, thus creating therein that craving which has its satisfaction in the discovery of Truth;”[191] e.g., “when the oracle was given out that the altar of Delos should be doubled, the god, as Plato says, not only conveyed a particular command, but also indicated his desire that the Greeks should study geometry; the task assigned involving an operation of the most advanced geometrical character.”[192] In another place this paternal interest in the doings of mankind is attributed to the Deity direct without the intrusion of any traditional name for a particular god. “It is not, as Hesiod supposes,[193] the work of human wisdom, but of God’s, to discriminate and distinguish predilections and antipathies in character before they become conspicuous to the world by breaking out into gross evil-doing under the influence of the passions. For God is assuredly cognizant of the natural disposition of every individual man, being, by His nature, more fitted to perceive soul than body: nor does He await the outbreak of actual sin before He punishes violence, profanity, obscenity.”[194] Thus, although Plutarch accepts the philosophic phrasing current respecting the nature of the Deity, his ardent, sympathetic temperament brings down the philosophers’ Deity from its majestic isolation, and makes it “meet halfway” the gods of the popular faith, so that both may be of service to humanity, the latter being purified and elevated, the other actualized and humanized. We discern with sympathy Plutarch’s attempt to satisfy the eternal craving of men for a mediator between themselves and the unapproachableness of the Highest; and we are prepared for his exposition of the doctrines of Dæmonology. This tendency to give warmth and life to philosophic abstractions is occasionally visible in an unconscious attempt to assimilate the qualities possessed by the Deity to those displayed in a less degree by mankind. Thus, he implicitly accepts the Platonic position that Eternity is all present to
  • 41. God,[195] a position which is also accepted by modern European Theology: but he elsewhere regards the Deity (formally using the name of Apollo) as a scientific observer, with infallibly acute reasoning powers directed upon phenomena retained in an unshakable memory. His predictions of events are, therefore, really predictions, not statements of present facts; and the “rigorous certainty and universality” which they possess are the certainty and universality attaching to the human discoveries of the laws of geometry and the law of causation, and not to a divine insight which is omniscience because it is always regarding events as present, whether they are actually past, present, or to come. “Apollo is a prophet, and prophecy is the art of ascertaining the future from the present or the past. Now nothing exists without a cause, and prediction, therefore, depends upon reason. The present springs inevitably from the past, the future from the present. The one follows naturally upon the other by a succession which is unbroken from beginning to end, and, accordingly, he who knows the natural causes of past, present, and future events, and can connect their mutual relationships, can predict the future, knowing, in the words of Homer, ‘things that are now, things that shall be, and things that are over.’ The whole art of Dialectics consists in the knowledge of the Consequent.”[196] Already in these passages, which represent philosophers as discussing God in the terms familiar in Greek philosophy, we can discern a gradual breaking down of that metaphysical exclusiveness which had hitherto marked the philosophic conception of the Deity. We see God again becoming personal, and reverting to that interest in the affairs of mankind from which the philosophers, starting with Xenophanes, had, in their revulsion from the anthropomorphic realisms of the Epic traditions, excluded him. We can already note that Plutarch believes in the “goodness” of God in a sense quite distinct from the “absence of envy” distinguishing the Platonic Creator, or even from the sense involved in Plato’s admission that the gods love the just, since one always loves that which is made in one’s own image.[197] We can see him going further, indeed, than Aristotle, who compares the love of men for the gods to the love of
  • 42. children for their parents, a love which is based upon a recognition of their goodness and superiority, and of their having been the authors of the greatest benefits to humanity.[198] But we are not left without many explicit texts asserting the goodness of God to mankind in emphatic phrases. Plutarch agrees with those statesmen and philosophers who assert that the majesty of the Divine Nature is accompanied by goodness, magnanimity, graciousness and benignity in its attitude towards mankind.[199] We have already seen that Justice and Love are regarded by Plutarch as the most beautiful of all virtues, and those most in harmony with the Divine Nature,[200] and many isolated sentences could be quoted to demonstrate how firmly the belief in God’s goodness to man was fixed in Plutarch’s mind. We are fortunate, however, in possessing a special tract in which the personal character of the Divine Goodness is so clearly exhibited that a modern translator of the tract, writing from a “Theological Institution,” is able to say, “I am not aware, indeed, that even Christian writers who have attempted to defend the same truth within the same limits of natural theology, have been able to do anything better than to reaffirm his position, and perhaps amplify and illustrate his argument.”[201] The tract referred to is, of course, the famous production known as the “De Sera Numinis Vindicta.” It is a bold and beautiful attempt to reconcile the existence of an actively benevolent Deity with the long-continued, often permanent, impunity of wickedness in this world; an endeavour to solve the question raised, especially by Epicureans, but not unfraught with solicitude for philosophers of other schools, respecting the patent fact that human virtue and human vice have no natural and necessary connexion with human happiness on the one hand and human misery on the other. Christian translators of the piece, from Amyot down to the writers just quoted, have hailed it as an effective vindication of the ways of God to man, and Comte Joseph de Maistre, whose paraphrase is designed, as he says, to please “ladies and foreigners,” is quite convinced that such a justification could not possibly have been written by one who was not a Christian.[202] Even Wyttenbach, whom de Maistre attacks for repudiating this view,
  • 43. is willing, with all his scholarly caution, to admit that Plutarch, in this tract, touches the excellences of the Christian faith.[203] The position which Plutarch sets himself to overthrow is that which is expressed most concisely in the famous verses of Ennius:— “Ego deum genus esse semper dixi et dicam cœlitum, Sed eos non curare opinor quid agat humanum genus; Nam si curent, bene bonis sit, male malis, quod nunc abest” —a sentiment in exact harmony with the Epicurean view of the matter.[204] While, however, establishing the providence and goodness of God as against the practical Atheism of the Epicureans, it will be seen that he is equally temperate, and equally consistent with himself, in avoiding the exaggerated zeal of those Stoics who, in their eager desire to do something for the honour of Providence, had subjected the minutest and commonest actions of life to the jealous watching of an arbitrary omniscience, so that, as Wyttenbach puts it, “that most gracious name of Providence was exposed to ridicule and contempt, being alternately regarded as a fortune-telling old crone, and as a dreadful spectre to alarm and terrify mankind.” Let us see in what way Plutarch establishes the providential benevolence of God without detracting from his majesty. A company of philosophic students, Plutarch himself; Patrocleas, his son-in-law;[205] Timon, his brother; and Olympichos, a friend;[206] are found, at the opening of the dialogue, regarding each other in silence beneath a Portico of the Delphic Temple, in wonder at the discourtesy of an Epicurean who has suddenly disappeared from the party, after expounding the doctrines of his school in the manner, doubtless, of Velleius in the “De Natura Deorum,” though with a more limited scope as expressed by the famous line of Ennius already quoted. According to Plutarch, he had “gathered together, from various sources, an undigested mass of confused observations, and had then scattered them in one contemptuous stream of spleen and anger upon Providence.” The company, deprived of their legitimate opportunity for reply, determined to discuss the question of Providence as if the departed opponent were still present, although it
  • 44. cannot be doubted that his absence, and the consequent want of direct necessity to “score off” him, lead to a more thorough and impartial discussion of the topic. Patrocleas, at any rate, states the difficulty with almost Epicurean boldness. “The delay of the Deity in punishing the wicked seems to me to be a strange and mysterious thing. The wicked are so eager and active in their wickedness, that they, least of all, ought to be the object of inactivity on the part of God. Thucydides rightly said that the advantage of delay was on the side of evil-doers.[207] Present immunity from the punishment due to crime encourages the criminal, and depresses the innocent sufferer. Bias knew that a certain reprobate of his days would be punished, but feared that he would not live to see it. Those whom Aristocrates betrayed at the Battle of Taphrus were all dead when his treachery was punished twenty years after. So with Lyciscus and the Orchomenians.[208] This delay encourages the wicked. The fruit of injustice ripens early and is easily plucked, but punishment matures long after the fruit of evil has been enjoyed.” This demand of the natural man to see their deserts meted out to the wicked is reinforced in a more philosophical manner by Olympichos, who maintains that delay in the punishment of sin deprives it of that salutary effect which its immediate infliction would have upon the sinner, who regards it as accidental, and not necessarily connected with his crimes. The fault of a horse is corrected if bit and lash be applied at once; but all the beating and backing and shouting in the world at a later time will only injure his physique without improving his character. “So that I am quite unable to see what good is done by those Mills of God[209] which are said to grind so late, since their delay brings justice to naught, and thus deprives vice of its restraining fear.”[210] Plutarch, before replying to these weighty arguments, preaches a short and eloquent sermon on the text, “God moves in a mysterious way.” His thoughts are not as our thoughts, nor His ways our ways. We must imitate the philosophic caution of the Academy. Men who never saw a battle may talk of military affairs, or discuss music who never played a note; “but it is a different thing for mere men like ourselves to peer too closely into matters that concern Divine
  • 45. Natures; just as if unskilled laymen were to try to penetrate the intention of an artist, the meaning of a physician’s treatment, the inner significance of a legal enactment, by fanciful guesses and surmises.... It is easier[211] for a mortal to make no definite assertion about the gods, but just this—that He[212] knows best the proper time to apply His treatment to wickedness. He can truly discriminate in the character of the punishment required by each offence.” These preliminary observations are in the proper Academic style; they are designed to indicate that the end of a discourse on such intricate matters can only be the modification of doubt by probability, not its settlement by absolute logical certainty.[213] The assumption of the Platonic attitude is appropriately followed by a Plutarchic reading of the teaching of Plato, who is understood as asserting that God, when he made Himself the universal pattern for all beautiful and noble things, granted human virtue to those who are able to follow Him, in order that they might thus in somewise grow like unto Him.[214] Further, as Plato says,[215] the universal nature took on order and arrangement by assimilation to and participation in the Idea and in the Virtue of the Divine Nature. Again, according to Plato, Nature gave us eyes that our soul might behold the order and harmony of the heavenly bodies, and become harmonious and ordered herself, free from flighty passions and roving propensities.[216] Becoming like God in this way, we shall emulate the mildness and forbearance with which He treats the wicked; shall eradicate from our minds the brutish passion for revenge; and shall wait to inflict our punishments until long consideration has excluded every possibility that we may repent after the deed is done. The purport of this argument, and of the examples which Plutarch, always rich in illustration, furnishes in support of it, is clearer than the need of attaching it to the Platonic scheme of creation. Plutarch believes that “God is slow to anger”; because gentleness and patience are part of His nature, and because by speedy punishment, He would save a few, but by delaying His justice He gives help and admonition to many. God, moreover, knows how much virtue He originally implanted in the heart of every man. He knows the character and inclination of every guilty soul; and His punishments are, therefore, different from human
  • 46. penalties, in that the latter regard the law of retaliation only, while the former are based on a knowledge of character which does not quench the smoking flax, but gives time and opportunity for a repentant return to the path of virtue.[217] The world, too, would have been deprived of many a virtuous character, lost the advantage of many a noble deed, had prompt punishment for early sins been inflicted. There is, moreover, a soul of good in things evil; the careers of great tyrants have been prolonged, and the world has been the better for the movements which their tyranny compelled. Evil is a “dispensation of Providence” in Plutarch’s eyes, as in those of many modern Christians. “As the gall of the hyæna, and the rennet of the seal, both disgusting animals in other respects, possess qualities useful for medicinal purposes, so upon certain peoples who need severe correction God inflicts the implacable harshness of a tyrant or the intolerable severity of a magistrate, and does not take away their trouble and distress until they are purified of their sins.” Sometimes, too, the Deity delays His vengeance in order that it may take effect in a more strikingly appropriate manner.[218] But these external punishments are not the most terrible that can be inflicted on the sinner. It would be difficult, even in Christian literature, to find so striking a tribute to the power of conscience in inflicting its immaterial tortures on the criminal who has escaped material recompense. Plutarch bases his observations on this head on a repudiation of Plato’s statement[219] “that punishment is a state that follows upon injustice,” asserting, as he finds in Hesiod, that the two are contemporaneous and spring up from the same soil and root; a view which he supports by many conspicuous and terrible examples from history, the force of which may be summarized in the fine and truthful phrase—the antithetical effect of which would be destroyed by translation—οὐδὲ γηράσαντες ἐκολάσθησαν ἀλλ’ ἐγήρασαν κολαζόμενοι.[220] The conclusion which Plutarch arrives at by considering this aspect of the case is that “there is no necessity for any god, or any man, to inflict punishment on evildoers, but it is sufficient that their whole life is tormented and destroyed by their sense of their impiety;” and that the time cannot but come when the glamour and the tinselled glory of successful crime will be torn away,
  • 47. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! ebookfinal.com