Learn Objective C for Java Developers 1st Edition James Bucanek 2024 scribd download
Learn Objective C for Java Developers 1st Edition James Bucanek 2024 scribd download
com
https://ebookname.com/product/learn-objective-c-for-java-
developers-1st-edition-james-bucanek/
OR CLICK BUTTON
DOWLOAD EBOOK
https://ebookname.com/product/learn-objective-c-on-the-mac-1st-
edition-dalrymple/
ebookname.com
https://ebookname.com/product/learn-objective-c-on-the-mac-1st-
edition-mark-dalrymple/
ebookname.com
https://ebookname.com/product/professional-eclipse-3-for-java-
developers-1st-edition-berthold-daum/
ebookname.com
https://ebookname.com/product/defy-your-doctor-and-be-healed-c-thomas-
corriher/
ebookname.com
https://ebookname.com/product/carbon-nanotube-based-composites-
processing-properties-modelling-and-application-1st-edition-antonio-
pantano/
ebookname.com
https://ebookname.com/product/the-two-koreas-and-the-politics-of-
global-sport-1st-edition-brian-bridges/
ebookname.com
https://ebookname.com/product/introduction-to-physical-
anthropology-14th-edition-robert-jurmain/
ebookname.com
Vintage Moquegua History Wine and Archaeology on a
Colonial Peruvian Periphery 1st Edition Prudence M. Rice
https://ebookname.com/product/vintage-moquegua-history-wine-and-
archaeology-on-a-colonial-peruvian-periphery-1st-edition-prudence-m-
rice/
ebookname.com
www.it-ebooks.info
■ CONTENTS
Learn Objective-C
for Java Developers
■■■
James Bucanek
xxv
www.it-ebooks.info
Learn Objective-C for Java Developers
Copyright © 2009 by James Bucanek
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording, or by any information storage
or retrieval system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-2369-6
ISBN-13 (electronic): 978-1-4302-2370-2
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit
of the trademark owner, with no intention of infringement of the trademark.
Lead Editors: Clay Andres, Douglas Pundick
Technical Reviewer: Evan DiBiase
Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham,
Tony Campbell, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman,
Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick,
Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh
Project Manager: Kylie Johnston
Copy Editor: Elizabeth Berry
Compositor: Lynn L’Heureux
Indexer: Ann Rogers/Ron Strauss
Artist: April Milne
Cover Designer: Anna Ishchenko
Manufacturing Director: Michael Short
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th
Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-
ny@springer-sbm.com, or visit http://www.springeronline.com.
For information on translations, please e-mail info@apress.com, or visit
http://www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional
use. eBook versions and licenses are also available for most titles. For more information, reference
our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales.
The information in this book is distributed on an “as is” basis, without warranty. Although every
precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have
any liability to any person or entity with respect to any loss or damage caused or alleged to be
caused directly or indirectly by the information contained in this work.
The source code for this book is available to readers at http://www.apress.com.
ii
www.it-ebooks.info
■ CONTENTS AT A GLANCE
iii
www.it-ebooks.info
■ CONTENTS
Contents at a Glance
PART 1 ■ ■ ■ Language
Chapter 1: Introduction ............................................................................................. 3
Chapter 2: Java and C: Key Differences ................................................................... 11
Chapter 3: Welcome to Objective-C ........................................................................ 27
Chapter 4: Creating an Xcode Project ..................................................................... 55
Chapter 5: Exploring Protocols and Categories ...................................................... 75
Chapter 6: Sending Messages .................................................................................. 87
Chapter 7: Making Friends with nil ....................................................................... 103
iv
www.it-ebooks.info
■ CONTENTS AT A GLANCE
www.it-ebooks.info
■ CONTENTS AT A GLANCE
Contents
About the Author ........................................................................................................xxi
About the Technical Reviewer ................................................................................. xxii
Acknowledgments ................................................................................................... xxiii
Introduction ................................................................................................................xiv
PART 1 ■ ■ ■ Language
Chapter 1: Introduction ............................................................................................. 3
What is Objective-C? ................................................................................................. 3
History ................................................................................................................... 4
A Modern Object-Oriented Language ................................................................. 4
State of the Art Compiler ...................................................................................... 5
Performance .......................................................................................................... 5
Dynamism ............................................................................................................. 5
Developer Productivity......................................................................................... 8
Learning a New Language ........................................................................................ 8
Terminology and Culture Shock .............................................................................. 9
Defining Better ........................................................................................................ 10
Summary ................................................................................................................. 10
Chapter 2: Java and C: Key Differences ................................................................... 11
Primitive Types ....................................................................................................... 11
Constants ................................................................................................................. 14
Typedefs .................................................................................................................. 15
Pointers .................................................................................................................... 15
Structures ................................................................................................................ 16
Object References ................................................................................................... 17
Arrays ....................................................................................................................... 18
static ......................................................................................................................... 19
Functions ................................................................................................................. 20
extern ....................................................................................................................... 20
vii
www.it-ebooks.info
■ CONTENTS
Preprocessor............................................................................................................ 21
#include and #import ......................................................................................... 21
#define ................................................................................................................. 22
#if 23
Initializing Automatic Variables ............................................................................ 24
Labels: break, continue, and goto.......................................................................... 24
Summary ................................................................................................................. 26
Chapter 3: Welcome to Objective-C ........................................................................ 27
Defining an Objective-C Class ............................................................................... 27
Object Pointers........................................................................................................ 29
Sending Messages ................................................................................................... 30
Naming Methods .................................................................................................... 31
Parameter and Return Types ................................................................................. 33
Method Selectors .................................................................................................... 34
Instance Variables ................................................................................................... 34
isa35
Properties ............................................................................................................ 35
Property Attributes ............................................................................................. 38
Overriding Properties ............................................................................................. 40
Accessing Properties ............................................................................................... 40
Scope........................................................................................................................ 41
Class Name Scope ............................................................................................... 41
Instance Variable Scope ..................................................................................... 41
Method Scope ..................................................................................................... 42
Forward @class Directive ....................................................................................... 43
self and super .......................................................................................................... 44
Class Methods ......................................................................................................... 45
Constructing Objects .............................................................................................. 47
Writing an init Method ....................................................................................... 49
Chaining Initializers ........................................................................................... 50
Designated Initializer ......................................................................................... 52
Convenience Constructors ................................................................................ 52
Destructors .............................................................................................................. 53
What’s Missing?....................................................................................................... 54
Chapter 4: Creating an Xcode Project ..................................................................... 55
Download the Project ............................................................................................. 55
viii
www.it-ebooks.info
■ CONTENTS
Creating a Project.................................................................................................... 56
Getting Started ........................................................................................................ 58
Designing the Application...................................................................................... 59
Designing the User Interface ............................................................................. 61
Adding a Controller ............................................................................................ 64
Making a Binding ................................................................................................ 65
KVC .................................................................................................................. 66
KVO .................................................................................................................. 67
Controllers ....................................................................................................... 67
Bindings ........................................................................................................... 67
Adding an Array Controller ................................................................................ 67
Getting Down to Business ...................................................................................... 68
Debugging Your Application.................................................................................. 72
Creating Sandbox Applications ............................................................................. 73
Summary ................................................................................................................. 74
Chapter 5: Exploring Protocols and Categories ...................................................... 75
Protocols .................................................................................................................. 75
Informal Protocol .................................................................................................... 77
Combining Formal and Informal Protocols ......................................................... 78
Categories ................................................................................................................ 79
Using Categories for Organization .................................................................... 81
Hiding Methods .................................................................................................. 81
Augmenting Foreign Classes.............................................................................. 82
Extensions ........................................................................................................... 84
Summary ................................................................................................................. 85
Chapter 6: Sending Messages .................................................................................. 87
Compiling Messages ............................................................................................... 88
Undeclared Methods .......................................................................................... 88
Ambiguous Methods .......................................................................................... 89
Coercion .............................................................................................................. 90
Sending Messages Programmatically.................................................................... 90
Immediate Messages .......................................................................................... 91
Deferred Messages .............................................................................................. 92
Object-Oriented Method Invocation .................................................................... 94
Calling Methods Directly........................................................................................ 96
ix
www.it-ebooks.info
■ CONTENTS
www.it-ebooks.info
■ CONTENTS
xi
www.it-ebooks.info
■ CONTENTS
xii
www.it-ebooks.info
■ CONTENTS
xiii
www.it-ebooks.info
■ CONTENTS
xiv
www.it-ebooks.info
■ CONTENTS
xv
www.it-ebooks.info
■ CONTENTS
xvi
www.it-ebooks.info
■ CONTENTS
Scaling............................................................................................................ 358
Bindings ................................................................................................................. 358
Interface Builder ................................................................................................... 360
NIB Documents ................................................................................................ 361
The NIB Document Window............................................................................ 361
Object Properties .............................................................................................. 361
Placeholder Objects .......................................................................................... 362
Connections ...................................................................................................... 363
Outlets............................................................................................................ 363
Actions ........................................................................................................... 364
Bindings ......................................................................................................... 365
Owner Object .................................................................................................... 367
Custom Objects ................................................................................................. 367
Object Instantiation .......................................................................................... 369
NIB Object Initialization .................................................................................. 369
Views ...................................................................................................................... 369
View Geometry .................................................................................................. 372
Coordinate Points ......................................................................................... 372
Coordinate System........................................................................................ 373
Pen Orientation ............................................................................................. 374
Drawing Bounds ........................................................................................... 375
Drawing Lines and Shapes ........................................................................... 375
Custom Views .................................................................................................... 376
Invalidating and Drawing Views .................................................................. 376
Graphics Context .......................................................................................... 377
The Graphics Context State Stack................................................................ 378
Drawing Tools ............................................................................................... 380
Animation ...................................................................................................... 381
iPhone View Classes ..................................................................................... 383
Advanced View Topics .................................................................................. 383
Document Model .................................................................................................. 384
Events and Responders ........................................................................................ 385
The Dynamic Application ................................................................................ 385
Events................................................................................................................. 387
Event Objects .................................................................................................... 387
Key Events ......................................................................................................... 388
Mouse Events .................................................................................................... 389
xvii
www.it-ebooks.info
■ CONTENTS
xviii
www.it-ebooks.info
■ CONTENTS
xix
www.it-ebooks.info
■ CONTENTS
xx
www.it-ebooks.info
■ CONTENTS
James Bucanek has spent the past 30 years programming and developing microprocessor systems.
He has experience with a broad range of computer hardware and software, from embedded consumer
products to industrial robotics. His development projects include the first local area network for the
Apple II, distributed air conditioning control systems, a piano teaching system, digital oscilloscopes,
silicon wafer deposition furnaces, and collaborative writing tools for K-12 education. James holds a Java
Developer Certification from Sun Microsystems and was awarded a patent for optimizing local area
networks. James is currently focused on Macintosh and iPhone software development, where he can
combine his deep knowledge of UNIX and object-oriented languages with his passion for elegant design.
James holds an Associates degree in classical ballet from the Royal Academy of Dance.
xxi
www.it-ebooks.info
■ CONTENTS
xxii
www.it-ebooks.info
■ CONTENTS
Acknowledgments
This book would not have been possible without the tireless efforts of the Apress editors. I am
eternally indebted to my technical editor, Evan DiBiase, who painstakingly checked every symbol,
method, and line of code for accuracy. I thank Douglas Pundick for his astute structural changes,
and I would have been completely lost without the talented red pen of my copy editor, Elizabeth
Berry. The unflagging Kylie Johnson held the entire project on course and, amazingly, on schedule.
Finally, I’d like to chastise Clay Andres who once plucked me out of a WWDC conference and told
me I could write books.
xxiii
www.it-ebooks.info
■ CONTENTS
Introduction
Objective-C is a wonderful language that has received far less attention than it deserves. It has suddenly
become (more) popular with the success of Apple’s Mac OS X and iPhone, where it is the supreme
development language. If you’re going to learn a language to write applications for Mac OS X or the
iPhone, Objective-C is the language to learn.
The Objective-C language does not feel like it was developed by a committee or a computer
science major. It’s a language for minimalists and anarchists. Yet it retains many of the features that
make Java one of the great programming languages of our time. Objective-C lets you write applications
that are every bit as structured and formal as anything you can write in Java. But at the same time, if you
want to bore a hole through the language and head off in a direction where no one has gone before, it
won’t stand in your way.
After programming in Objective-C for a few years, I was struck at how “Java-like” my programs
were. If I’d known then just how many of my Java techniques and concepts were directly transferable to
Objective-C, it would have saved me months of study and experimentation. I wrote this book so that you
can avoid the same fate.
xxiv
www.it-ebooks.info
■ INTRODUCTION
I strongly encourage you to read the first part in its entirety. The second and third parts can be
read straight through, or you can skim them and refer back to them later for solutions. The advanced
topics in the final section address specific situations, like working with the iPhone’s memory manager,
which can be explored as needed. Many chapters start out with the basics and then progress to more
esoteric features, so feel free to skip to the next chapter once you’ve learned what you want.
Prerequisites
This book assumes that you have some experience programming in Java. You should be familiar with the
basics of the language, the concepts of classes, objects, inheritance, and interfaces, and have a working
knowledge of the core Java classes. It will help if you have some functional knowledge of individual Java
technologies, like introspection and exceptions, but these aren’t absolutely necessary to learn the
Objective-C equivalents. While I would hope that you are already familiar with design patterns, they
aren’t a prerequisite.
xxv
www.it-ebooks.info
Discovering Diverse Content Through
Random Scribd Documents
IV
The Lifuans furnish an illustration which seems decisive. But they are
savages, and on that account their example may be invalidated. It is
well to take another illustration from a people whose high and long-
continued civilisation is now undisputed.
The civilisation of China is ancient: that has long been a familiar fact.
But for more than a thousand years it was merely a legend to
Western Europeans; none had ever reached China, or, if they had,
they had never returned to tell the tale; there were too many fierce
and jealous barbarians between the East and the West. It was not
until the end of the thirteenth century, in the pages of Marco Polo,
the Venetian Columbus of the East,—for it was an Italian who
discovered the Old World as well as the New,—that China at last
took definite shape alike as a concrete fact and a marvellous dream.
Later, Italian and Portuguese travellers described it, and it is
interesting to note what they had to say. Thus Perera in the
sixteenth century, in a narrative which Willes translated for Hakluyt’s
“Voyages,” presents a detailed picture of Chinese life with an
admiration all the more impressive since we cannot help feeling how
alien that civilisation was to the Catholic traveller and how many
troubles he had himself to encounter. He is astonished, not only by
the splendour of the lives of the Chinese on the material side, alike
in large things and in small, but by their fine manners in all the
ordinary course of life, the courtesy in which they seemed to him to
exceed all other nations, and in the fair dealing which far surpassed
that of all other Gentiles and Moors, while in the exercise of justice
he found them superior even to many Christians, for they do justice
to unknown strangers, which in Christendom is rare; moreover, there
were hospitals in every city and no beggars were ever to be seen. It
was a vision of splendour and delicacy and humanity, which he
might have seen, here and there, in the courts of princes in Europe,
but nowhere in the West on so vast a scale as in China.
The picture which Marco Polo, the first European to reach China (at
all events in what we may call modern times), presented in the
thirteenth century was yet more impressive, and that need not
surprise us, for when he saw China it was still in its great Augustan
age of the Sung Dynasty. He represents the city of Hang-Chau as the
most beautiful and sumptuous in the world, and we must remember
that he himself belonged to Venice, soon to be known as the most
beautiful and sumptuous city of Europe, and had acquired no small
knowledge of the world. As he describes its life, so exquisite and
refined in its civilisation, so humane, so peaceful, so joyous, so well
ordered, so happily shared by the whole population, we realise that
here had been reached the highest point of urban civilisation to
which Man has ever attained. Marco Polo can think of no word to
apply to it—and that again and again—but Paradise.
The China of to-day seems less strange and astonishing to the
Westerner. It may even seem akin to him—partly through its decline,
partly through his own progress in civilisation—by virtue of its direct
and practical character. That is the conclusion of a sensitive and
thoughtful traveller in India and Japan and China, G. Lowes
Dickinson. He is impressed by the friendliness, the profound
humanity, the gaiety, of the Chinese, by the unequalled self-respect,
independence, and courtesy of the common people. “The
fundamental attitude of the Chinese towards life is, and has always
been, that of the most modern West, nearer to us now than to our
mediæval ancestors, infinitely nearer to us than India.”[6]
So far it may seem scarcely as artists that these travellers regard the
Chinese. They insist on their cheerful, practical, social, good-
mannered, tolerant, peaceable, humane way of regarding life, on the
remarkably educable spirit in which they are willing, and easily able,
to change even ancient and deep-rooted habits when it seems
convenient and beneficial to do so; they are willing to take the world
lightly, and seem devoid of those obstinate conservative instincts by
which we are guided in Europe. The “Resident in Peking” says they
are the least romantic of peoples. He says it with a nuance of
dispraise, but Lowes Dickinson says precisely the same thing about
Chinese poetry, and with no such nuance: “It is of all poetry I know
the most human and the least symbolic or romantic. It contemplates
life just as it presents itself, without any veil of ideas, any rhetoric or
sentiment; it simply clears away the obstruction which habit has built
up between us and the beauty of things and leaves that, showing in
its own nature.” Every one who has learnt to enjoy Chinese poetry
will appreciate the delicate precision of this comment. The quality of
their poetry seems to fall into line with the simple, direct, childlike
quality which all observers note in the Chinese themselves. The
unsympathetic “Resident in Peking” describes the well-known
etiquette of politeness in China: “A Chinaman will inquire of what
noble country you are. You return the question, and he will say his
lowly province is so-and-so. He will invite you to do him the honour
of directing your jewelled feet to his degraded house. You reply that
you, a discredited worm, will crawl into his magnificent palace.” Life
becomes all play. Ceremony—the Chinese are unequalled for
ceremony, and a Government Department, the Board of Rites and
Ceremonies, exists to administer it—is nothing but more or less
crystallised play. Not only is ceremony here “almost an instinct,” but,
it has been said, “A Chinese thinks in theatrical terms.” We are
coming near to the sphere of art.
The quality of play in the Chinese character and Chinese civilisation
has impressed alike them who have seen China from afar and by
actual contact. It used to be said that the Chinese had invented
gunpowder long before Europeans and done nothing with it but
make fireworks. That seemed to the whole Western world a terrible
blindness to the valuable uses of gunpowder, and it is only of late
years that a European commentator has ventured to remark that
“the proper use of gunpowder is obviously to make fireworks, which
may be very beautiful things, not to kill men.” Certainly the Chinese,
at all events, appreciate to the full this proper use of gunpowder.
“One of the most obvious characteristics of the Chinese is their love
of fireworks,” we are told. The gravest people and the most
intellectual occupy themselves with fireworks, and if the works of
Bergson, in which pyrotechnical allusions are so frequent, are ever
translated into Chinese, one can well believe that China will produce
enthusiastic Bergsonians. All toys are popular; everybody, it is said,
buys toys of one sort or another: paper windmills, rattles, Chinese
lanterns, and of course kites, which have an almost sacred
significance. They delight, also, in more complicated games of skill,
including an elaborate form of chess, far more difficult than ours.[7]
It is unnecessary to add that to philosophy, a higher and more
refined form of play, the Chinese are peculiarly addicted, and
philosophic discussion is naturally woven in with an “art of exquisite
enjoyment”—carried probably to greater perfection than anywhere
else in the world. Bertrand Russell, who makes this remark, in the
suggestive comments on his own visit to China, observes how this
simple, child-like, yet profound attitude towards life results in a
liberation of the impulses to play and enjoyment which “makes
Chinese life unbelievably restful and delightful after the solemn
cruelties of the West.” We are reminded of Gourmont’s remark that
“pleasure is a human creation, a delicate art, to which, as for music
or painting, only a few are apt.”
The social polity which brings together the people who thus view life
is at once singular and appropriate. I well remember how in youth a
new volume of the Sacred Books of the East Series, a part of the
Confucian Lî-kî, came into my hands and how delighted I was to
learn that in China life was regulated by music and ceremony. That
was the beginning of an interest in China that has not ceased to
grow, though now, when it has become a sort of fashion to exalt the
spiritual qualities of the Chinese above those of other peoples, one
may well feel disinclined to admit any interest in China. But the
conception itself, since it seems to have had its beginning at least a
thousand years before Christ, may properly be considered
independently of our Western fashions. It is Propriety—the whole
ceremony of life—in which all harmonious intercourse subsists; it is
“the channel by which we apprehend the ways of Heaven,” in no
supernatural sense, for it is on the earth and not in the skies that
the Confucian Heaven lies concealed. But if human feelings, the
instincts—for in this matter the ancient Chinese were at one with our
modern psychologists,—are the field that has to be cultivated, and it
is ceremony that ploughs it, and the seeds of right action that are to
be planted on it, and discipline that is to weed it, and love that is to
gather in the fruits, it is in music, and the joy and peace that
accompany music, that it all ends. Indeed, it is also in music that it
all begins. For the sphere in which ceremonies act is Man’s external
life; his internal life is the sphere of music. It is music that moulds
the manners and customs that are comprised under ceremony, for
Confucius held that there can be music without sound where “virtue
is deep and silent”; and we are reminded of the “Crescendo of
Silences” on the Chinese pavilion in Villiers de l’Isle Adam’s story, “Le
Secret de l’ancienne Musique.” It is music that regulates the heart
and mind and with that development brings joy, and joy brings
repose. And so “Man became Heaven.” “Let ceremonies and music
have their course until the earth is filled with them!”
It is sometimes said that among Chinese moralists and philosophers
Lao-tze, the deepest of them all, alone stands aside from the chorus
in praise of music and ceremony. When once Confucius came to
consult Lao-tze concerning the rules of propriety, and reverence for
the teaching of the sages of antiquity, we are told, Lao-tze replied:
“The men of whom you speak, sir, have, if you please, together with
their bones, mouldered.” Confucius went away, puzzled if not
dissatisfied He was willing to work not only from within outwards,
but from without inwards, because he allowed so large a place for
social solidity, for traditionalism, for paternalism, though he
recognised that ceremony is subordinate in the scheme of life, as
colour is in a painting, the picture being the real thing. Lao-tze was
an individualist and a mystic. He was little concerned with moralities
in the ordinary sense. He recognised no action but from within
outwards. But though Confucius could scarcely have altogether
grasped his conception, he was quite able to grasp that of Confucius,
and his indifference to tradition, to rule and propriety was simply an
insistence on essential reality, on “music.” “Ceremonies,” he said,
“are the outward expression of inward feeling.” He was no more
opposed to the fundamental Chinese conception than George Fox
was opposed to Christianity in refusing to observe the mere forms
and ceremonies of the Church. A sound Confucianism is the outward
manifestation of Taoism (as Lao-tze himself taught it), just as a
sound socialism is the outward manifestation of a genuine
individualism. It has been well said that Chinese socialistic solidarity
rests on an individualistic basis, it is not a bureaucratic State
socialism; it works from within outward. (One of the first European
visitors to China remarked that there a street was like a home.) This
is well shown by so great and typical a Chinese philosopher as Meh-
ti,[8] who lived shortly after Confucius, in the fifth century B.C. He
taught universal love, with universal equality, and for him to love
meant to act. He admitted an element of self-interest as a motive for
such an attitude. He desired to universalise mutual self-help.
Following Confucius, but yet several centuries before Jesus, he
declared that a man should love his neighbour, his fellow man, as
himself. “When he sees his fellow hungry, he feeds him; when he
sees him cold, he clothes him; ill, he nurses him; dead, he buries
him.” This, he said, was by no means opposed to filial piety; for if
one cares for the parents of others, they in turn will care for his. But,
it was brought against him, the power of egoism? The Master
agreed. Yet, he said, Man accepts more difficult things. He can
renounce joy, life itself, for even absurd and ridiculous ends. A single
generation, he added, such is the power of imitation, might suffice
to change a people’s customs. But Meh-ti remained placid. He
remarked that the great ones of the earth were against human
solidarity and equality; he left it at that. He took no refuge in
mysticism. Practical social action was the sole end he had in view,
and we have to remember that his ideals are largely embodied in
Chinese institutions.[9]
We may understand now how it is that in China, and in China alone
among the great surviving civilisations, we find that art animates the
whole of life, even its morality. “This universal presence of art,”
É
remarks an acute yet discriminating observer, Émile Hovelaque,
whom I have already quoted,[10] “manifested in the smallest utensil,
the humblest stalls, the notices on the shops, the handwriting, the
rhythm of movement, always regular and measured, as though to
the tune of unheard music, announces a civilisation which is
complete in itself, elaborated in the smallest detail, penetrated by
one spirit, which no interruption ever breaks, a harmony which
becomes at length a hallucinatory and overwhelming obsession.” Or,
as another writer has summed up the Chinese attitude: “For them
the art of life is one, as this world and the other are one. Their aim
is to make the Kingdom of Heaven here and now.”
It is obvious that a natural temperament in which the art-impulse is
so all-embracing, and the æsthetic sensibility so acute, might well
have been of a perilous instability. We could scarcely have been
surprised if, like that surpassing episode in Egyptian history of which
Akhenaten was the leader and Tell-el-Amarna the tomb, it had only
endured for a moment. Yet Chinese civilisation, which has
throughout shown the dominating power of this sensitive
temperament, has lasted longer than any other. The reason is that
the very excesses of their temperament forced the Chinese to fortify
themselves against its perils. The Great Wall, built more than two
thousand years ago, and still to-day almost the most impressive
work of man on the earth, is typical of this attitude of the Chinese.
They have exercised a stupendous energy in fortifying themselves
against the natural enemies of their own temperament. When one
looks at it from this point of view, it is easy to see that, alike in its
large outlines and its small details, Chinese life is always the art of
balancing an æsthetic temperament and guarding against its
excesses. We see this in the whole of the ancient and still prevailing
system of Confucian morality with its insistence on formal ceremony,
even when, departing from the thought of its most influential
founder,—for ceremonialism in China would have existed even if
Confucius had not lived,—it tended to become merely an external
formalism. We see it in the massive solidarity of Chinese life, the
systematic social organisation by which individual responsibility, even
though leaving individuality itself intact, is merged in the
responsibility of the family and the still larger group. We see it in the
whole drift of Chinese philosophy, which is throughout sedative and
contemplative. We see it in the element of stoicism on the one hand
and cruelty on the other which in so genuinely good-natured a
people would otherwise seem puzzling. The Chinese love of flowers
and gardens and landscape scenery is in the same direction, and
indeed one may say much the same of Chinese painting and Chinese
poetry.[11] That is why it is only to-day that we in the West have
reached the point of nervous susceptibility which enables us in some
degree to comprehend the æsthetic supremacy which the Chinese
reached more than a thousand years ago.
Thus, during its extremely long history—for the other great
civilisations with which it was once contemporary have passed away
or been disintegrated and transformed—Chinese civilisation has
borne witness to the great fact that all human life is art. It may be
because they have realised this so thoroughly that the Chinese have
been able to preserve their civilisation so long, through all the
violent shocks to which it has been subjected. There can be no
doubt, however, that, during the greater part of the last thousand
years, there has been, however slow and gradual, a decline in the
vitality of Chinese civilisation, largely due, it may well be, to the
crushing pressure of an excessive population. For, however
remarkable the admiration which China arouses even to-day, its
finest flowering periods in the special arts lie far in the past, while in
the art of living itself the Chinese have long grown languid. The
different reports of ancient and modern travellers regarding one
definite social manifestation, the prevalence of beggary, cannot fail
to tell us something regarding the significant form of their social life.
Modern travellers complain of the plague constituted by the
prevalence of beggars in China; they are even a fixed and
permanent institution on a trades-union basis. But in the sixteenth
century Galeotto Perera noticed with surprise in China the absence
of beggars, as Marco Polo had before him, and Friar Gaspar de Cruz
remarked that the Chinese so abhorred idleness that they gave no
alms to the poor and mocked at the Portuguese for doing so: “Why
give alms to a knave? Let him go and earn it.” Their own priests, he
adds, they sometimes whipped as being knaves. (It should be noted
at the same time that it was considered reasonable only to give half
the day to work, the other half to joy and recreation.) But they built
great asylums for the helpless poor, and found employment for blind
women, gorgeously dressed and painted with ceruse and vermilion,
as prostitutes, who were more esteemed in early China than they
have been since. That is a curious instance of the unflinching
practicality still shown by the Chinese in endless ways. The
undoubted lassitude in the later phases of this long-lived Chinese
culture has led to features in the art of life, such as beggary and dirt
among the poor, not manifested in the younger offshoot of Chinese
and Korean culture in Japan, though it is only fair to point out that
impartial English observers, like Parker, consider this prevalence of
vermin and dirt as simply due to the prevalence of poverty, and not
greater than we find among the poor in England and elsewhere in
the West. Marco Polo speaks of three hundred public baths in one
city alone in his time. We note also that in the more specialised arts
the transcendence of China belongs to the past, and even
sometimes a remote past. It is so in the art of philosophy, and the
arts of poetry and painting. It is so also in the art of pottery, in
which Chinese supremacy over the rest of the world has been
longest recognised—has not the word “china” for centuries been our
name for the finest pottery?—and is most beyond measure. Our
knowledge of the pottery of various cultures excels that of any other
human products because of all it is the most perdurable. We can
better estimate their relative æsthetic worth now than in the days
when a general reverence for Greek antiquity led to a popular belief
in the beauty of Greek pottery, though scarcely a single type of its
many forms can fairly be so considered or even be compared to the
products of the Minoan predecessors of Greek culture, however
interesting they may still remain for us as the awkward and
inappropriate foundation for exquisite little pictures. The greatest
age of this universal human art was in China and was over many
centuries ago. But with what devotion, with what absolute
concentration of the spirit, the Chinese potters of the great period
struggled with the problem of art is finely illustrated by the well-
known story which an old Chinese historian tells of the sacrifice of
the divine T’ung, the spirit who protects potters. It happened that a
complicated problem had baffled the potters. T’ung laid down his life
to serve them and to achieve the solution of the problem. He
plunged into the fire and the bowl came out perfect. “The vessel’s
perfect glaze is the god’s fat and blood; the body material is the
god’s body of flesh; the blue of the decoration, with the brilliant
lustre of gems, is the essence of the god’s pure spirit.” That story
embodies the Chinese symbol of the art of living, just as we embody
our symbol of that art in the Crucifixion of Jesus. The form is
diverse; the essence is the same.
V
It will be seen that when we analyse the experiences of life and look
at it simply, in the old-fashioned way, liberated from the artificial
complexities of a temporary and now, it may be, departing
civilisation, what we find is easy to sum up. We find, that is to say,
that Man has forced himself to move along this line, and that line,
and the other line. But it is the same water of life that runs in all
these channels. Until we have ascended to a height where this is
clear, to see all our little dogmatisms will but lead us astray.
We may illuminatingly change the analogy and turn to the field of
chemistry. All these various elements of life are but, as it were,
allotropic forms of the same element. The most fundamental among
these forms is that of art, for life in all its forms, even morality in the
narrowest sense, is, as Duprat has argued, a matter of technique,
and technique at once brings us to the elements of art. If we would
understand what we are dealing with, we may, therefore, best study
these forms under that of art.
There is, however, a deeper chemical analogy than this to be seen.
It may well be, indeed, that it is more than an analogy. In chemistry
we are dealing, not merely with the elements of life, but with the
elements of the world, even of what we call our universe. It is not
unreasonable to think that the same law holds good for both. We
see that the forms of life may all be found, and then better
understood, in one form. Some day, perhaps, we shall also see that
that fact is only a corollary of the larger fact—or, if any one prefers
so to regard it, the smaller fact—that the chemical elements of our
world can be regarded as all only transmutations of one element.
From of old, men instinctively divined that this might be so, though
they were merely concerned to change the elements into gold, the
element which they most highly valued. In our own times this
transmutation is beginning to become, on a minute scale, a
demonstrable fact, though it would seem easier to transmute
elements into lead than into gold. Matter, we are thus coming to see,
may not be a confused variety of separate substances, but simply a
different quantitative arrangement of a single fundamental stuff,
which might possibly be identical with hydrogen or some other
already known element. Similarly we may now believe that the men
of old who thought that all human life was made of one stuff were
not altogether wrong, and we may, with greater assurance than they
were able to claim, analyse the modes of human action into different
quantitative or other arrangements of which the most fundamental
may well be identical with art.
This may perhaps become clearer if we consider more in detail one
of the separate arts, selecting the most widely symbolic of all, the
art that is most clearly made of the stuff of life, and so able to
translate most truly and clearly into beautiful form the various
modalities of life.
CHAPTER II
THE ART OF DANCING
I
Dancing and building are the two primary and essential arts. The art
of dancing stands at the source of all the arts that express
themselves first in the human person. The art of building, or
architecture, is the beginning of all the arts that lie outside the
person; and in the end they unite. Music, acting, poetry proceed in
the one mighty stream; sculpture, painting, all the arts of design, in
the other. There is no primary art outside these two arts, for their
origin is far earlier than man himself; and dancing came first.[12]
That is one reason why dancing, however it may at times be scorned
by passing fashions, has a profound and eternal attraction even for
those one might suppose farthest from its influence. The joyous beat
of the feet of children, the cosmic play of philosophers’ thoughts rise
and fall according to the same laws of rhythm. If we are indifferent
to the art of dancing, we have failed to understand, not merely the
supreme manifestation of physical life, but also the supreme symbol
of spiritual life.
The significance of dancing, in the wide sense, thus lies in the fact
that it is simply an intimate concrete appeal of a general rhythm,
that general rhythm which marks, not life only, but the universe, if
one may still be allowed so to name the sum of the cosmic
influences that reach us. We need not, indeed, go so far as the
planets or the stars and outline their ethereal dances. We have but
to stand on the seashore and watch the waves that beat at our feet,
to observe that at nearly regular intervals this seemingly
monotonous rhythm is accentuated for several beats, so that the
waves are really dancing the measure of a tune. It need surprise us
not at all that rhythm, ever tending to be moulded into a tune,
should mark all the physical and spiritual manifestations of life.
Dancing is the primitive expression alike of religion and of love—of
religion from the earliest human times we know of and of love from
a period long anterior to the coming of man. The art of dancing,
moreover, is intimately entwined with all human tradition of war, of
labour, of pleasure, of education, while some of the wisest
philosophers and the most ancient civilisations have regarded the
dance as the pattern in accordance with which the moral life of men
must be woven. To realise, therefore, what dancing means for
mankind—the poignancy and the many-sidedness of its appeal—we
must survey the whole sweep of human life, both at its highest and
at its deepest moments.
II
From the vital function of dancing in love, and its sacred function in
religion, to dancing as an art, a profession, an amusement, may
seem, at the first glance, a sudden leap. In reality the transition is
gradual, and it began to be made at a very early period in diverse
parts of the globe. All the matters that enter into courtship tend to
fall under the sway of art; their æsthetic pleasure is a secondary
reflection of their primary vital joy. Dancing could not fail to be first
in manifesting this tendency. But even religious dancing swiftly
exhibited the same transformation; dancing, like priesthood, became
a profession, and dancers, like priests, formed a caste. This, for
instance, took place in old Hawaii. The hula dance was a religious
dance; it required a special education and an arduous training;
moreover, it involved the observance of important taboos and the
exercise of sacred rites; by the very fact of its high specialisation it
came to be carried out by paid performers, a professional caste. In
India, again, the Devadasis, or sacred dancing girls, are at once both
religious and professional dancers. They are married to gods, they
are taught dancing by the Brahmins, they figure in religious
ceremonies, and their dances represent the life of the god they are
married to as well as the emotions of love they experience for him.
Yet, at the same time, they also give professional performances in
the houses of rich private persons who pay for them. It thus comes
about that to the foreigner the Devadasis scarcely seem very unlike
the Ramedjenis, the dancers of the street, who are of very different
origin, and mimic in their performances the play of merely human
passions. The Portuguese conquerors of India called both kinds of
dancers indiscriminately Balheideras (or dancers) which we have
corrupted in Bayaderes.[21]
In our modern world professional dancing as an art has become
altogether divorced from religion, and even, in any biological sense,
from love; it is scarcely even possible, so far as Western civilisation
is concerned, to trace back the tradition to either source. If we
survey the development of dancing as an art in Europe, it seems to
me that we have to recognise two streams of tradition which have
sometimes merged, but yet remain in their ideals and their
tendencies essentially distinct. I would call these traditions the
Classical, which is much the more ancient and fundamental, and
may be said to be of Egyptian origin, and the Romantic, which is of
Italian origin, chiefly known to us as the ballet. The first is, in its
pure form, solo dancing—though it may be danced in couples and
many together—and is based on the rhythmic beauty and
expressiveness of the simple human personality when its energy is
concentrated in measured yet passionate movement. The second is
concerted dancing, mimetic and picturesque, wherein the individual
is subordinated to the wider and variegated rhythm of the group. It
may be easy to devise another classification, but this is simple and
instructive enough for our purpose.
There can scarcely be a doubt that Egypt has been for many
thousands of years, as indeed it still remains, a great dancing centre,
the most influential dancing-school the world has ever seen,
radiating its influence to south and east and north. We may perhaps
even agree with the historian of the dance who terms it “the
mother-country of all civilised dancing.” We are not entirely
dependent on the ancient wall-pictures of Egypt for our knowledge
of Egyptian skill in the art. Sacred mysteries, it is known, were
danced in the temples, and queens and princesses took part in the
orchestras that accompanied them. It is significant that the musical
instruments still peculiarly associated with the dance were originated
or developed in Egypt; the guitar is an Egyptian instrument and its
name was a hieroglyph already used when the Pyramids were being
built; the cymbal, the tambourine, triangles, castanets, in one form
or another, were all familiar to the ancient Egyptians, and with the
Egyptian art of dancing they must have spread all round the shores
of the Mediterranean, the great focus of our civilisation, at a very
early date.[22] Even beyond the Mediterranean, at Cadiz, dancing that
was essentially Egyptian in character was established, and Cadiz
became the dancing-school of Spain. The Nile and Cadiz were thus
the two great centres of ancient dancing, and Martial mentions them
both together, for each supplied its dancers to Rome. This dancing,
alike whether Egyptian or Gaditanian, was the expression of the
individual dancer’s body and art; the garments played but a small
part in it, they were frequently transparent, and sometimes
discarded altogether. It was, and it remains, simple, personal,
passionate dancing, classic, therefore, in the same sense as, on the
side of literature, the poetry of Catullus is classic.[23]
Ancient Greek dancing was essentially classic dancing, as here
understood. On the Greek vases, as reproduced in Emmanuel’s
attractive book on Greek dancing and elsewhere, we find the same
play of the arms, the same sideward turn, the same extreme
backward extension of the body, which had long before been
represented in Egyptian monuments. Many supposedly modern
movements in dancing were certainly already common both to
Egyptian and Greek dancing, as well as the clapping of hands to
keep time which is still an accompaniment of Spanish dancing. It
seems clear, however, that, on this general classic and Mediterranean
basis, Greek dancing had a development so refined and so special—
though in technical elaboration of steps, it seems likely, inferior to
modern dancing—that it exercised no influence outside Greece.
Dancing became, indeed, the most characteristic and the most
generally cultivated of Greek arts. Pindar, in a splendid Oxyrhynchine
fragment, described Hellas, in what seemed to him supreme praise,
as “the land of lovely dancing,” and Athenæus pointed out that he
calls Apollo the Dancer. It may well be that the Greek drama arose
out of dance and song, and that the dance throughout was an
essential and plastic element in it. Even if we reject the statement of
Aristotle that tragedy arose out of the Dionysian dithyramb, the
alternative suppositions (such as Ridgeway’s theory of dancing round
the tombs of the dead) equally involve the same elements. It has
often been pointed out that poetry in Greece demanded a practical
knowledge of all that could be included under “dancing.” Æschylus is
said to have developed the technique of dancing and Sophocles
danced in his own dramas. In these developments, no doubt, Greek
dancing tended to overpass the fundamental limits of classic dancing
and foreshadowed the ballet.[24]
The real germ of the ballet, however, is to be found in Rome, where
the pantomime with its concerted and picturesque method of
expressive action was developed, and Italy is the home of Romantic
dancing. The same impulse which produced the pantomime
produced, more than a thousand years later in the same Italian
region, the modern ballet. In both cases, one is inclined to think, we
may trace the influence of the same Etruscan and Tuscan race which
so long has had its seat there, a race with a genius for expressive,
dramatic, picturesque art. We see it on the walls of Etruscan tombs
and again in pictures of Botticelli and his fellow Tuscans. The
modern ballet, it is generally believed, had its origin in the
spectacular pageants at the marriage of Galeazzo Visconti, Duke of
Milan, in 1489. The fashion for such performances spread to the
other Italian courts, including Florence, and Catherine de’ Medici,
when she became Queen of France, brought the Italian ballet to
Paris. Here it speedily became fashionable. Kings and queens were
its admirers and even took part in it; great statesmen were its
patrons. Before long, and especially in the great age of Louis XIV, it
became an established institution, still an adjunct of opera but with
a vital life and growth of its own, maintained by distinguished
musicians, artists, and dancers. Romantic dancing, to a much
greater extent than what I have called Classic dancing, which
depends so largely on simple personal qualities, tends to be vitalised
by transplantation and the absorption of new influences, provided
that the essential basis of technique and tradition is preserved in the
new development. Lulli in the seventeenth century brought women
into the ballet; Camargo discarded the complicated costumes and
shortened the skirt, so rendering possible not only her own lively
and vigorous method, but all the freedom and airy grace of later
dancing. It was Noverre who by his ideas worked out at Stuttgart,
and soon brought to Paris by Gaetan Vestris, made the ballet a new
and complete art form; this Swiss-French genius not only elaborated
plot revealed by gesture and dance alone, but, just as another and
greater Swiss-French genius about the same time brought sentiment
and emotion into the novel, he brought it into the ballet. In the
French ballet of the eighteenth century a very high degree of
perfection seems thus to have been reached, while in Italy, where
the ballet had originated, it decayed, and Milan, which had been its
source, became the nursery of a tradition of devitalised technique
carried to the finest point of delicate perfection. The influence of the
French school was maintained as a living force into the nineteenth
century,—when it was renovated afresh by the new spirit of the age
and Taglioni became the most ethereal embodiment of the spirit of
the Romantic movement in a form that was genuinely classic,—
overspreading the world by the genius of a few individual dancers.
When they had gone, the ballet slowly and steadily declined. As it
declined as an art, so also it declined in credit and in popularity; it
became scarcely respectable even to admire dancing. Thirty or forty
years ago, those of us who still appreciated dancing as an art—and
how few they were!—had to seek for it painfully and sometimes in
strange surroundings. A recent historian of dancing, in a book
published so lately as 1906, declared that “the ballet is now a thing
of the past, and, with the modern change of ideas, a thing that is
never likely to be resuscitated.” That historian never mentioned
Russian ballet, yet his book was scarcely published before the
Russian ballet arrived to scatter ridicule over his rash prophecy by
raising the ballet to a pitch of perfection it can rarely have
surpassed, as an expressive, emotional, even passionate form of
living art.
The Russian ballet was an offshoot from the French ballet and
illustrates once more the vivifying effect of transplantation on the art
of Romantic dancing. The Empress Anna introduced it in 1735 and
appointed a French ballet-master and a Neapolitan composer to
carry it on; it reached a high degree of technical perfection during
the following hundred years, on the traditional lines, and the
principal dancers were all imported from Italy. It was not until recent
years that this firm discipline and these ancient traditions were
vitalised into an art form of exquisite and vivid beauty by the
influence of the soil in which they had slowly taken root. This
contact, when at last it was effected, mainly by the genius of Fokine
and the enterprise of Diaghilev, involved a kind of revolution, for its
outcome, while genuine ballet, has yet all the effect of delicious
novelty. The tradition by itself was in Russia an exotic without real
life, and had nothing to give to the world; on the other hand, a
Russian ballet apart from that tradition, if we can conceive such a
thing, would have been formless, extravagant, bizarre, not subdued
to any fine æsthetic ends. What we see here, in the Russian ballet
as we know it to-day, is a splendid and arduous technical tradition,
brought at last—by the combined skill of designers, composers, and
dancers—into real fusion with an environment from which during
more than a century it had been held apart; Russian genius for
music, Russian feeling for rhythm, Russian skill in the use of bright
colour, and, not least, the Russian orgiastic temperament, the
Russian spirit of tender poetic melancholy, and the general Slav
passion for folk-dancing, shown in other branches of the race also,
Polish, Bohemian, Bulgarian, and Servian. At almost the same time
what I have termed Classic dancing was independently revived in
America by Isadora Duncan, bringing back what seemed to be the
free naturalism of the Greek dance, and Ruth St. Denis, seeking to
discover and revitalise the secrets of the old Indian and Egyptian
traditions. Whenever now we find any restored art of theatrical
dancing, as in the Swedish ballet, it has been inspired more or less,
by an eclectic blending of these two revived forms, the Romantic
from Russia, the Classic from America. The result has been that our
age sees one of the most splendid movements in the whole history
of the ballet.
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.
ebookname.com