Anda di halaman 1dari 6

#110 Get More Refcardz! Visit refcardz.

com

Objective-C
CONTENTS INCLUDE:
n
An Introduction to the Language and Tools
n
The Syntax
n
Memory Management
Tools

for the iPhone and iPad


n

n
Debugging
n
XCode Keyboard Shortcuts and more...
By Ben Ellingson and Matthew McCullough

An Introduction to the Language and tools The keyword @interface can distract developers
coming from some languages such as Java,
Objective-C is the primary language used to create Hot suggesting this is a mere contract. However,
applications for Apple’s Mac OS X and iOS (iPhone and iPad) Tip @interface is indeed the keyword for defining the

platforms. Objective-C was created by Brad Cox and Tom Love properties and method signatures of a concrete
in the early 1980s. In 1988, Objective-C was licensed by NeXT, class in Obj-C.
a company founded and helmed by Steve Jobs during his
absence from Apple. Apple acquired NeXT in 1996, bringing Interfaces
Objective-C to the Macintosh platform. Objective-C interfaces are created using the @protocol
declaration. Any class can implement multiple interfaces.
Objective-C is an object oriented superset of ANSI C. Its Interfaces are typically declared in a .h header file and can be
object syntax is derived from Smalltalk. It supports single included via #import statements in the .h header file of other
inheritance, implementation of multiple interfaces via the classes.
@protocol syntax, and the redefinition and augmentation of
www.dzone.com

// Mappable.h: Declare the Mappable @protocol


(open) classes via categories. Apple’s iPhone SDK for the @protocol Mappable
- (double) latitude;
iOS mobile operating system offers developers a rich set of - (double) longitude;
@end
Objective-C APIs. This free SDK, which includes the Xcode
// Location.h: Specify that Location class implements the Mappable
IDE, is used to create applications for the iPhone, iPad, and // @protocol
#import “Mappable.h”
iPod Touch. @interface Location : NSObject <Mappable> {
}
@end
The Syntax // Location.m: Provide implementations for the Mappable methods
@implementation Location
- (double) latitude {
return 46.553666;
Class Declaration }
- (double) longitude {
Objective-C classes typically include an interface .h and an return -87.40551;
}
implementation .m pair of files. The .h file contains property @end

and method declarations. The .m file contains method


implementations. Primitive Data Types
As a superset of ANSI C, Objective-C supports its same
Objective-C for the iPhone and iPad

Example .h interface file primitive data types.


#import <Foundation/Foundation.h>
@interface Speaker : NSObject { int Integral numbers without decimal points
NSInteger *ID;
NSString *name;
} float Numbers with decimal points
@property NSInteger *ID;
@property(nonatomic,retain) NSString *name;
- (void) doSomething: (NSString *) value anotherValue: (int) value2;
@end

Example .m implementation file


Get over 90 DZone Refcardz
#import “Speaker.h”
@implementation Speaker
@synthesize ID,name; FREE from Refcardz.com!
- (void) doSomething: (NSString *) value anotherValue: (int) value2 {
// do something
}
@end

Inheritance
Class inheritance is specified in the .h interface file with the
syntax: @interface <MyClass> : <ParentClass>. The following
example tells the compiler that the Employee class inherits
from (extends) the Person class.

// Employee.h file
@interface Employee : Person {
}
@end

DZone, Inc. | www.dzone.com


2
Objective-C for the iPhone and iPad

double Same as float with twice the accuracy or size Using Dot Notation Method Invocation
Objective-C 2.0 added the ability to invoke property accessor
char Store a single character such as the letter ‘a’
methods (getters/setters) using “.” notation.
BOOL Boolean values with the constants YES or NO
// Using dot notation calls the book instance’s setAuthor method
book.author = @”Herman Melville”;
Common Object Data Types // equivalent to
[book setAuthor: @”Herman Melville”];
NSObject Root class of the object hierarchy

NSString String value Multi Parameter Methods


NSArray Collection of elements, fixed size, may include duplicates Multi-Parameter methods are more verbose than other
languages. Each parameter includes both an external name,
NSMutableArray Variable sized array
data type, and a local variable name. The external parameter
NSDictionary Key-value pair collection
name becomes a formal part of the method name.
NSMutableDictionary Variable sized key-value pair collection
// declare a method with multiple parameters
NSSet Unordered collection of distinct elements - (void) addBookWithTitle: (NSString *) aTitle andAuthor: (NSString *)
anAuthor;
NSData Byte buffer
// invoke a method with multiple parameters
NSURL URL resource [self addBookWithTitle: @”Moby Dick” andAuthor: @”Herman Melville”];

Instance Variables Self and Super Properties


Class instance variables are declared within a curly braced {} Objective-C objects include a self property and a super
section of the .h file. property. These properties are mutable and can be assigned
// Book.h: Variables declared in a header file in an advanced technique called “swizzling”. Most commonly,
@interface Book : NSObject {
NSString *title; the self attribute is used to execute a method on the
NSString *author;
int pages; enclosing object.
}
@end [self setAuthor: @”Herman Melville”];

// Invoke methods on the “super” property to execute parent class


Notice that the object variable declarations are preceded by // behavior. a method that overrides a parent class method will likely call
// the parent class method
* symbol. This indicates that the reference is a pointer to an - (void) doSomething: (NSString *)value {
[super doSomething: value];
object and is required for all object variable declarations. // do something derived-class specific
}

Dynamic Typing
Objective-C supports dynamic typing via the id keyword. Properties using @property and @synthesize
Objective-C 2.0 added property declaration syntax in order to
NSString *name1 = @”Bob”;
// name2 is a dynamically typed NSString object reduce verbose coding of getter and setter methods.
id name2 = @”Bob”;
if ([name1 isEqualToString:name2]) {
// do something // use of @property declaration for the title variable is equivalent to
} // declaring a “setTitle” mutator and “title” accessor method.
@interface Book : NSObject {
NSString *title;
Methods }
@property (retain, nonatomic) NSString *title;
Methods are declared in the .h header file and implemented in @end

the .m implementation file. // use the @synthesize declaration in the .m implementation file
// to automatically implement setter and getter methods.
@implementation Book
// Book.h: Declare methods in the header file @synthesize title, author; //Multiple variables
@interface Book : NSObject { @synthesize pages; //Single variable
} @end
- (void) setPages: (int) p;
- (int) pages;
@end
Multiple variables may be included in a single @synthesize
// Book.m: Implement methods in the implementation file
@implementation Book declaration. Alternatively, a class may include multiple
- (void) setPages: (int) p {
pages = p; @synthesize declarations.
}
- (int) pages {
return pages; @property Attributes
}
@end Property attributes specify behaviors of generated getter
and setter methods. Attribute declarations are placed in
Method Declaration Syntax parenthesis () after the @property declaration. The most
Method type return type parameter type common values used are (retain, nonatomic). retain
(class or instance)
method name parameter name indicates that the [retain] method should be called on the
newly assigned value object. See the memory management
- (void) setPages: (int) p; section for further explanation. nonatomic indicates that
the assignment operation does not check for thread access
Method Invocation Syntax protection, which may be necessary in multi-threaded
Method invocations are written using square bracket [] environments. readonly may be specified to indicate the
notation. property’s value can not be set.
method target parameter value
method name Object Initialization
Object instances are created in two steps. First, with a call to
[book setPages: 100]; alloc and second, with a call to init.

DZone, Inc. | www.dzone.com


3
Objective-C for the iPhone and iPad

// example of 2 step object initialization Strings


Book *book = [[Book alloc] init];
// equivalent to Objective-C string literals are prefixed with an “@” symbol (e.g.
Book *book2 = [Book alloc];
book2 = [book init]; @”Hello World”). This creates instances of the NSString class;
instead of C language CFStrings.
In order to perform specific object initialization steps, you will
// create a string literal via the “@” symbol
often implement the init or an initWith method. Notice NSString *value = @”foo bar”;
NSString *value2 = [NSString stringWithFormat:@”foo %@”,@”bar”];
the syntax used around the self property in the following // string comparison
if ([value isEqualToString:value2]) {
example. This is a standard init pattern found in Objective-C. // do something
}
Also notice the method uses a dynamic id return type. NSURL *url = [NSURL URLWithString:@”http://www.google.com”];
NSString *value3 = [NSString stringWithContentsOfURL:url];
NSString *value4 = [NSString stringWithContentsOfFile: @”file.txt”];
// Event.m: Implementation overrides the “init” method to assign a default
// date value
@implementation Event NSLog / NSString Formatters
- (id) init {
self = [super init]; Formatters are character sequences used for variable
if (self != nil) {
self.date = [[NSDate alloc] init]; substitution in strings.
}
return self; %@ for objects
} %d for integers
@end %f for floats
// Logs “Bob is 10 years old”
NSLog(@”%@ is %d years old”, @”Bob”, 10);
Class Constructors
Classes often include constructor methods as a convenience. Data Structures
The method type is + to indicate that it is a class (static) Using NSArray
method. // Create a fixed size array. Notice that nil termination is required
NSArray *values = [NSArray arrayWithObjects:@”One”,@”Two”,nil];
// Get the array size
// Constructor method declaration int count = [values count];
+ (Book *) createBook: (NSString *) aTitle withAuthor: (NSString *) // Access a value
anAuthor; NSString *value = [values objectAtIndex:0];
// Create a variable sized array
// Invoke a class constructor NSMutableArray *values2 = [[NSMutableArray alloc] init];
Book *book2 = [Book createBook: @”Moby Dick” withAuthor: @”Herman [values2 addObject:@”One”];
Melville”];

Using NSDictionary
#import Statements NSDictionary *di = [NSDictionary dictionaryWithObjectsAndKeys:
@”One”,[NSNumber numberWithInt:1],
#import statements are required to declare the classes and @”Two”,[NSNumber numberWithInt:2],nil];
NSString *one = [di objectForKey: [NSNumber numberWithInt:1]];
frameworks used by your class. #import statements can be NSMutableDictionary *di2 = [[NSMutableDictionary alloc] init];
[di2 setObject:@”One” forKey:[NSNumber numberWithInt:1]];
included at the top of both .h header and .m implementation
files. Memory Management
Objective-C 2.0 includes garbage collection. However,
// import a class
#import “Book.h” garbage collection is not available for iOS apps. iOS apps
// import a framework must manage memory by following a set of object ownership
#import <MapKit/MapKit.h>
rules. Each object has a retain count which indicates the
number of objects with an ownership interest in that object.
Control Flow Ownership of an object is automatically taken when you call a
// basic for loop
for (int x=0; x < 10; x++) {
method beginning with alloc, prefixed with new, or containing
NSLog(@”x is: %d”,x); copy. Ownership is manually expressed by calling the retain
}
method. You relinquish object ownership by calling release or
// for-in loop
NSArray *values = [NSArray arrayWithObjects:@”One”,@”Two”,@”Three”,nil]; autorelease.

for(NSString *value in values) { When an object is created it has a retain count of 1


// do something When the “retain” message is sent to an object, the retain count is incremented by 1
} When the “release” message is sent to an object, the retain count is decremented by 1
When the retain count reaches 0, it is deallocated
// while loop
BOOL condition = YES;
while (condition == YES) { // alloc sets the retain count to 1
Book *book = [[Book alloc] init];
// doSomething
// do something...
}
// Release message decrements the retain count,
// if / else statements // Retain count reaches 0. Book will be deallocated
BOOL condition1 = NO; [book release];
BOOL condition2 = NO;
if (condition1) {
// do something
dealloc Method
} else if(condition2) { When an object’s retain count reaches 0, it is sent a dealloc
// do other thing
} else { message. You will provide implementations of the dealloc
// do something else
} method, which will call release on the instances retained
// switch statement variables. Do not call dealloc directly.
int x = 1;
switch (x) { // Book.m: Implement release of member variables
case 1: - (void) dealloc
{
// do something
[title release];
break; [author release];
case 2: [super dealloc];
// do other thing }
break;
default:
break; Autorelease Pools
}
An autorelease pool (NSAutoreleasePool) contains references to

DZone, Inc. | www.dzone.com


4
Objective-C for the iPhone and iPad

objects that have received an autorelease message. When the primary tool in the suite of utilities that ship with the SDK.
autorelease pool is deallocated, it sends a release message to Xcode has a long history but has been given a dramatic set
all objects in the pool. Using an autorelease pool may simplify of feature additions in the modern iPhone and iPad releases,
memory management; however, it is less fine grained and may including detection of common user-coded memory leaks and
allow an application to hold onto more memory than it really quick-fixing of other syntax and coding mistakes.
needs. Be watchful of which types and size of objects you use
Plain text editors and command line Make files can be used to
with autorelease.
produce iOS applications. However, Xcode offers compelling
// call autorelease on allocated instance to add it to the autorelease pool
Book *book = [[[Book alloc] init] autorelease];
features such as syntax highlighting and code completion.
These features make writing Objective-C in the Xcode IDE a
Categories delight and a favorite of developers everywhere.
Categories are a powerful language feature which allows
you to add methods to an existing class without subclassing.
Categories are useful to extend the features of existing classes
and to split the implementation of large classes into several
files. Categories are not subclasses. Generally, do not use
methods in a category to extend existing methods except
when you wish to globally erase and redefine the original
method. Categories can not add instance variables to a class. Once the code is in a valid-syntax state, compile it by choosing
// BookPlusPurchaseInfo.h adds purchase related methods to the Book class Build  Build from the menus, or ⌘B. If there are code errors,
#import “Book.h”
@interface Book (PurchaseInfo) they will appear as a yellow or red icon in the lower right corner
- (NSArray *) findRetailers;
@end of the IDE. Clicking on the icon will reveal a panel detailing the
// BookPlusPurchaseInfo.m implements the purchase related methods
#import “BookPlusPurchaseInfo.h” warnings and errors.
@implementation Book (PurchaseInfo)
- (NSArray *) findRetailers {
return [NSArray arrayWithObjects:@”Book World”,nil];
}
@end

// call a method defined in the BookPlusPurchaseInfo category


Book *book = [Book createBook:@”Moby Dick” withAuthor:@”Herman Melvile”];
NSArray *retailers = [book findRetailers];
Deploying an application to the simulator has two simple steps.
Selectors First, choose the Simulator target from the main Xcode toolbar.
Selectors create method identifiers using the SEL datatype. A Building and Deploying can be done in one seamless step
value can be assigned to a SEL typed variable via the by pressing the Command and Enter keys. The simulator will
@selector() directive. Selectors, along with NSObject’s receive the compiled application and launch it.
method performSelector: withObject: enable a class to
choose the desired message to be invoked at runtime.
// Execute a method using a SEL selector and the performSelector method
id target = [[Book alloc] init];

// Action is a reference to the “doSomething” method
SEL action = @selector(doSomething);

// The message sender need not know the type of target object
// or the message that will be called via the “action” SEL
[target performSelector: action withObject:nil ];

Working With Files


iOS applications have access to files in an app-specific home
directory. This directory is a sand-boxed portion of the file
system. An app can read and write files within this its own
hierarchy, but it can not access any files outside of it.
// Get the path to a iOS App’s “Documents” directory
NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, To deploy to an iPhone or iPad, first select Device from the
NSUserDomainMask, YES) lastObject];
aforementioned toolbar menu. Second, right click on the
// List the contents of a directory
NSFileManager *fileManager = [NSFileManager defaultManager]; element beneath the Target node of the Groups and Files tree
NSArray *files = [fileManager contentsOfDirectoryAtPath:docDir error:nil];
for (NSString *file in files) {
and choose Get Info. Choose the Properties tab and ensure
}
NSLog(file); the Identifier matches the name or pattern you established with
// Create a directory
Apple for your Provisioning Profile at http://developer.apple.com/iphone
NSString *subDir = [NSString stringWithFormat:@”%@/MySubDir”,docDir];
[fileManager createDirectoryAtPath:subDir attributes:nil];

// Does the file exist?


NSString *filePath = [NSString stringWithFormat:@”%@/MyFile.txt”,docDir];
BOOL exists = [fileManager fileExistsAtPath: filePath];

Tools

Xcode
The IDE included in the iOS SDK is named Xcode. It is the

DZone, Inc. | www.dzone.com


5
Objective-C for the iPhone and iPad

Organizer community) primarily as a class-instance designer and property


The Organizer window provides a list of favorite projects, value setter.
enumerates your attached iOS devices, streams the current
New elements can be added to a design canvas in a drag-
device console log to screen and displays details of past crash
and-drop WYSIWYG approach via the Library panel, which
logs. It can be opened from Xcode via ⌘+^+O.
can be accessed via the ⌘ + ⇧ +L key combination. After
saving changes, the design’s behavior can be immediately
tested through the Simulate Interface command, which can be
invoked via ⌘ + R.

Debugging
The Xcode platform provides a robust debugger and
supplementary mechanisms for stepping through code.
Breakpoints are easily set by single clicking in the gutter next
to any line of code. A blue arrow indicates a breakpoint is set
and active.

Simulator
Once a breakpoint is hit, variables can be inspected and The iPhone and iPad Simulator is another distinct application
the stack examined via the key combination ⌘ + ⇧ + Y. The in the iPhone SDK that communicates and integrates with the
bottommost panel is called the console, and is where all Xcode IDE and with Interface Builder. In the Xcode section, we
logging output, written via calls such as NSLog(@“My counter saw how to deploy our application to the Simulator, which both
is: %d”, myIntCount), is routed. installs the application and launches it.

While the Simulator offers a great desktop testing experience


that requires no purchase of hardware, it has a few
shortcomings such as the lack of a camera, gyroscope, or
GPS facilities. The lack of camera is somewhat mitigated by a
supply of several stock photos in the Photo application. The
harsh absence of a gyroscope is minimized only by the shake
and rotate gestures possible through the Hardware menu. And
last, the omission of a true GPS simulator is performed by GPS
calls always resolving to 1 Infinite Loop, Cupertino, CA, USA.

The iPhone Simulator offers iPad, iPhone and iPhone 4


simulation modes. The modes are toggled via the Hardware
 Device menu.
During the debugging and testing phase of
development, activate Zombies to place “markers”
in deallocated memory, thereby providing a stack
trace in the console if any invalid attempts are made
to access the freed memory. This is accomplished in
Hot three simple steps:
Tip • Double-click the name of any node beneath the Executables
group of an Xcode project.
• In the dialog that opens, click the Arguments tab.
• In the lower “Variables to be set” region, click the + button and
create a new variable named “NSZombieEnabled” with its
value set to “YES”.

Interface Builder
A tool as powerful as Xcode is Interface Builder. Its name
clearly expresses its use for designing Objective-C NIBs and
XIBs, which are the binary and XML form of user interface
The Simulator ships with a limited number of core applications;
definition files on the Mac, iPhone, and iPad.
namely, the Photos, Settings, Camera, Contacts and
NIBs, though graphically designed, actually instantiate the Safari programs. These are the applications that offer API
objects declared via the tool when called upon via code. connectivity from the source code of your application. For a
Accordingly, it may help to think of IB (as it is known in the broader set of programs and more realistic mobile horsepower

DZone, Inc. | www.dzone.com


6
Objective-C for the iPhone and iPad

CPUs, testing on an actual iOS device is critical. Commercial Unit Testing and Code Coverage
apps that you’ve purchased from the iTunes App Store cannot Currently, the unit testing tools for Objective-C are less mature
be installed on the Simulator for DRM reasons and the vast than those of other languages. XCode currently includes
difference in CPU architecture of x86 desktops and ARM the OCUnit unit testing framework. OCUnit tests are coded
mobile devices. similarly to those of xUnit tests in languages such as Java. The
Xcode Keyboard Shortcuts Google Toolbox for Mac provides several useful enhancements
Common XCode Shortcuts to OCUnit and is the testing solution currently recommended
⌘ = command ⎇ = alt ▲ = up ⇧ = shift ⏎ = return ^ = control by ThoughtWorks for the iOS platform. Complementing
OCUnit is OCMock, an Objective-C implementation of mock
⎇⌘▲ toggle between .h and .m file
objects. CoverStory can be used in concert with OCUnit and
⌘⇧d quickly open a file via search dialog OCMock to check the code coverage of your tests.
⌘b build
Resources
⌘⏎ build and run
SDK
⌘⇧k clean the build Apple Developer Programs - http://developer.apple.com/
iOS SDK - http://developer.apple.com/iphone/index.action
⌘⇧r go to console view

⌘0 go to project view Testing


Google Toolbox for Mac - http://code.google.com/p/google-toolbox-for-mac/
⌘⇧e show / hide upper right pane OCMock - http://www.mulle-kybernetik.com/software/OCMock/
CoverStory - http://code.google.com/p/coverstory/
⎇⌘⇧e show / hide all but the active document window

^1 while in file editor - show / navigate list of recent files Blogs, Videos, Books
WWDC 2010 Session Videos - http://developer.apple.com/videos/wwdc/2010/
^2 while in file editor - show / navigate list of class methods
Objective-C Basics -
⌘y build and debug http://en.wikibooks.org/wiki/Cocoa_Programming/Objective-C_basics
iPhone Development Wiki - http://iphonedevwiki.net/index.php/Main_Page
⎇⌘p debugger continue The Objective-C Programming Language -
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/
⎇ double-click open quick documentation for class at mouse cursor
Bookmarks - http://delicious.com/matthew.mccullough/objectivec

A B OUT t h e A u t h o r s RECO M M ENDED B o o k


Ben Ellingson is a software engineer and consultant. He is The second edition of this book thoroughly covers the
the creator of nofluffjuststuff.com, many related No Fluff Just latest version of the language, Objective-C 2.0. And it
Stuff websites and mobile applications. During Ben’s 13 years shows not only how to take advantage of the Foundation
of development experience, he has helped create systems for framework’s rich built-in library of classes but also how to
conference management, video-on-demand, and online travel. use the iPhone SDK to develop programs designed for the
You can keep up with Ben’s work at http://benellingson.blogspot.com iPhone/iPad platform.
and http://twitter.com/benellingson.
BUY NOW
Matthew McCullough is an energetic 15 year veteran of enterprise
software development, open source education, and co-founder books.dzone.com/books/objective-c
of Ambient Ideas, LLC, a Denver, Colorado, USA consultancy.
Matthew is a published author, open source creator, speaker at
over 100 conferences, and author of three of the top 10 Refcardz
of all time. He writes frequently on software and presenting at his
blog: http://ambientideas.com/blog.

#82

Browse our collection of 100 Free Cheat Sheets


Get More Refcardz! Visit refcardz.com

CONTENTS INCLUDE:


About Cloud Computing
Usage Scenarios Getting Started with

Aldon Cloud#64Computing

Underlying Concepts
Cost
by...

Upcoming Refcardz
youTechnologies ®

Data
t toTier
brough Comply.
borate.
Platform Management and more...

Chan
ge. Colla By Daniel Rubio

tion:
dz. com

also minimizes the need to make design changes to support


CON

tegra ternvasll
ABOUT CLOUD COMPUTING one time events. TEN TS
INC ■
HTML LUD E:

us Ind Anti-PPaat
Basics
Automated growthHTM
ref car

Web applications have always been deployed on servers & scalable


L vs XHT technologies

nuorn

Valid
ation one time events, cloud ML
connected to what is now deemed the ‘cloud’. Having the capability to support

Apache Ant
Usef
Du
ti

ul M.
computing platforms alsoulfacilitate
#84
Open the gradual growth curves

n an
Page Source

o

s
Vis it

However, the demands and technology used on such servers Structure

C
faced by web applications. Tools

Core
By Key ■
Elem

Patte
has changed substantially in recent years, especially with Structur
E: al Elem ents
INC LUD gration the entrance of service providers like Amazon, Google and Large scale growth scenarios involvingents
specialized
NTS and mor equipment
rdz !

ous Inte Change

HTML
CO NTE Microsoft. es e... away by
(e.g. load balancers and clusters) are all but abstracted
Continu at Every e chang
m

About ns to isolat
relying on a cloud computing platform’s technology.
Software i-patter
space

Hadoop
rdz .co


n
Re fca

e Work
Build
riptio
and Ant
Desc
These companies have a Privat
are in long deployed
trol repos
itory
webmana applications
ge HTM
L BAS

Patterns Control lop softw n-con to



that adapt and scale
Deve
les toto large user
a versio ing and making them
bases, In addition, several cloud computing ICSplatforms support data
ment ize merg
rn
Version e... Patte it all fi minim le HTM
Manage s and mor e Work knowledgeable in amany ine to
mainl aspects related tos multip
cloud computing. tier technologies that Lexceed the precedent set by Relational
space Comm and XHT

ref ca

Build
re

Privat lop on that utilize HTML MLReduce,


Practice Database Systems (RDBMS): is usedMap are web service APIs,

Deve code lines a system
d as thescalethe By An
sitory of work prog foundati
Ge t Mo

Buil Repo
This Refcard active
will introduce are within
to you to cloud riente computing, with an
d units
RATION etc. Some platforms ram support large grapRDBMS deployments.

The src
dy Ha
softw
e ine loping and Java s written in hical on of
INTEG attribute
task-o it all
softwar emphasis onDeve es by
Mainl these
ines providers, so youComm can better understand
also rece JavaScri user interfac web develop and the rris
Vis it

Spring Security
codel chang desc
INUOU ding Task Level as the
e code
w ww.dzone.com

NT of buil trol what it is a cloudnize


line Policy sourc es as aplatform
computing can offer your ut web output ive data pt. Server-s e in clien ment. the ima alt attribute ribes whe
T CO cess ion con Code Orga it chang e witho likew mec ide lang t-side ge is describe re the ima
ABOU the pro ject’s vers applications. and subm with uniqu
e name
are from
sourc CLOUD COMPUTING ise hanism. fromAND
PLATFORMS web unavaila
was onc use HTML The eme pages and uages like ge file
it
(CI) is Nested s alte
rd z!

a pro evel Comm the build softw um ble. rnate can be


gration ed to Task-L Label ies to
build minim UNDERLYING CONCEPTS e and XHT rging use HTM PHP tags text that
blem activit the bare standard a very loos Tags found,
ous Inte committ to a pro USAGE SCENARIOS ate all
Autom configurat
ion cies to t
ization, ely-defi
ML as
thei
Ajax
tech L can is disp
Continu ry change cannot be (and freq
nden ymen layed
solution fective ned lang r visual eng nologies
Re fca

Label
Build
manu
al
d tool
depe deplo t need but as if
eve , a ) stalle the same nmen for stan overlap uen
(i.e. , inef Build t, use target enviro Amazon EC2: Industry standard it has
software and uagvirtualization ine. HTM , so <a>< tly are) nest
with terns problem ce pre-in whether dards
ated b></
ory. ns (i.e. Autom Redu ymen
has bec become e with a> is
via pat ticular d deploEAR) in each very little L

Subversion
reposit -patter s that Pay only cieswhat you consume
tagge or Amazon’s cloud
the curr you cho platform
computing isome
heavily based moron fine. b></ ed insid
lained ) and anti the par solution duce nden For each (e.g. WAR es t
ent stan ose to writ more e imp a></ e
not lega each othe
x” b> is
be exp text to “fi are al Depeapplication deployment
Web ge until t a
librarifew years agonmen
t enviro was similar that will softwaredard
industry standard and virtualization app
e HTM technology.
orta nt,
tterns to pro Minim packa nden
Mo re

CI can ticular con used can rity all depe all targe
s will L or XHT arent. Reg the HTM l, but r. Tags
etimes Anti-pa they
tend
es, but to most phone services:
y Integ alizeplans with le that
late fialloted resources, ts with an and XHT simplify all help ML, und ardless
L VS
XHTM <a><
in a par hes som
Centr
end,
Binar
pro cess. the practic enti ng incurred costgeme
nt
whether e a single
such
temp
resources on
were consumed
t enviro
nmen
orthenot. Virtualization MLaare your
othe
you prov
erst of L
b></
in muchallows physical piece of hardware to
ide be HTM
rily bad
Mana based
approac ed with the cial, but, implem anding
Creat targe es to actually r web
nden
cy rties are nt
of the a solid L has
into differe coding.resources
necessa pared to
chang
efi Depe prope itting utilized by multiple operating
function systems.simplerThis allows foundati job adm been arou
associat to be ben
er
Ge t

te builds commo
are not Fortuna
late Verifi e comm than on
n com Cloud computing asRun it’sremo
known etoday has changed this.
befor alitytohas irably, nd for
They they
etc.
Temp Build (e.g. bandwidth, n memory, CPU) be allocated exclusively to tely exp that som
lts whe
ually,
appear effects. Privat y, contin Every elem mov used
to be, HTML
ecte job e time
ed resu The various resourcesPerfo rm a
consumed by webperio applications
dicall (e.g. nt team
pag
individual operating entsinstances. ed to CSS
system Brow d. Earl
y HTM has expand . Whi
gration
opme because
adverse unintend d Builds sitory Build r to devel common e (HTML . ser ed far le it has don
ous Inte web dev manufacture L had very
Stage Repo
e bandwidth, memory, CPU) areIntegtallied
ration on a per-unit CI serve basis or XHT
produc tinu e Build rm an from
extensio .) All are more e its
e.com

ard ML shar limit


tern.
ack elopers rs add than
Con Refc Privat
from zero) by Perfo
(starting all majorated cloud ed man ed layout
feedb computing platforms. As a user of Amazon’s esse
term e, this
on
n. HTM EC2 cloud
ntiallycomputing es certplatform, you are result anybody
the pat
occur came
gration as based is
of the ” cycl such Build Send
autom as they builds proc
assigned esso
an operating L system
files shouin the plai
same wayain elem
as on allents
hosting The late a lack of stan up with clev y competi
supp
ous Inte tional use and test concepts
soon n text ort.
ration ors as ion with r
tinu
Integ entat
ld not in st web dar er wor ng stan
ven “build include
docum
Con be cr kar dar
the con s to the standar
oper
to rate devel
While efer of CI Gene
notion

DZone, Inc.
Cloud Computing

the
s on
expand

ISBN-13: 978-1-934238-75-2
140 Preston Executive Dr. ISBN-10: 1-934238-75-9
Suite 100
50795
Cary, NC 27513

DZone communities deliver over 6 million pages each month to 888.678.0399


919.678.0300
more than 3.3 million software developers, architects and decision
Refcardz Feedback Welcome
$7.95

makers. DZone offers something for everyone, including news,


refcardz@dzone.com
tutorials, cheatsheets, blogs, feature articles, source code and more. 9 781934 238752
Sponsorship Opportunities
“DZone is a developer’s dream,” says PC Magazine.
sales@dzone.com
Copyright © 2010 DZone, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, rev. 1.001 10/08/09
photocopying, or otherwise, without prior written permission of the publisher.

Anda mungkin juga menyukai