20
Cappuccino Brian Chapados http://chapados.org http://github.com/ chapados @chapados SDRuby August 6, 2009

Cappuccino - SDRuby 2009-08-06

Embed Size (px)

DESCRIPTION

Intro to the Cappuccino web framework (http://cappuccino.org) Embedded version: http://280slides.com/Viewer/?user=2167&name=sdruby-cappuccino&fullscreen

Citation preview

Page 1: Cappuccino - SDRuby 2009-08-06

Cappuccino

Brian Chapadoshttp://chapados.org

http://github.com/chapados@chapados

SDRubyAugust 6, 2009

Page 2: Cappuccino - SDRuby 2009-08-06

What is it?

"Cappuccino is an open source application framework for developing applications that look and feel like the desktop software users are familiar with."

http://cappuccino.org/learn/

Page 3: Cappuccino - SDRuby 2009-08-06

Who made this?

http://280north.com

used framework to build:http://280slides.com

Page 4: Cappuccino - SDRuby 2009-08-06

What is it?

http://280slides.com/Editor

Page 5: Cappuccino - SDRuby 2009-08-06

The Cappuccino Way

build web apps, not web sites

Page 6: Cappuccino - SDRuby 2009-08-06
Page 7: Cappuccino - SDRuby 2009-08-06

The Cappuccino Way

• no HTML• no CSS• no DOM manipulation• support for all major browsers

designed explicitly to build web applications from the ground up

All or nothing...

Page 8: Cappuccino - SDRuby 2009-08-06

Language: Objective-J

Objective-J

• One language, one API• Superset of javascript• use javascript if you need it• tools for building, compiling to JS, bundling resources for distribution/deployment

Page 9: Cappuccino - SDRuby 2009-08-06

Framework: Cappuccino

Cappuccino

• Cocoa-esque API• Battle-tested patterns for building desktop apps

Page 10: Cappuccino - SDRuby 2009-08-06

install (StarterKit)

http://cappuccino.org/download/

Page 11: Cappuccino - SDRuby 2009-08-06

install (github)

git clone git://github.com/280north/cappuccino.git

rake releaserake debugrake install

Page 12: Cappuccino - SDRuby 2009-08-06

capp: setup an appcapp gen -f my-new-app

Generates a new app inmy-new-app

main.jAppController.jindex.htmlindex-debug.html

Info.plistResourcesRakefileFrameworks

Page 13: Cappuccino - SDRuby 2009-08-06

Demo pubmed app

Page 14: Cappuccino - SDRuby 2009-08-06

Common patterns

• target -> action• delegation (instead of subclassing)• Model-View-Controller

Page 15: Cappuccino - SDRuby 2009-08-06

Target : Action

var searchButton = [CPButton buttonWithTitle:"go"];[searchButton setAction:@selector(performSearch:)];[searchButton setTarget:nil];

... define perform search method- (void)performSearch:(id)sender { // do search here}

@selector() a way to encode a method name in a variable

target = nilSearch chain for a responder

Page 16: Cappuccino - SDRuby 2009-08-06

Delegation[_searchCollectionView setDelegate:self];

// search history (CPCollectionView) delegate methods - (void)collectionViewDidChangeSelection:(CPCollectionView)collectionView { // do something in response to selection change}

object "self" will respond to delegate messages

define desgined methods in the delegate class

Page 17: Cappuccino - SDRuby 2009-08-06

MVC

@implementation AppController : CPObject{PMSearch currentSearch;

CPCollectionView _searchCollectionView;}

model

Controller

view

Page 18: Cappuccino - SDRuby 2009-08-06

MVC

@implementation AppController : CPObject{PMSearch currentSearch;

CPCollectionView _searchCollectionView;}

model

Controller

view

Page 19: Cappuccino - SDRuby 2009-08-06

Learn More•http://cappuccino.org/learn•cappuccino mailing list (google groups)•http://cappuccinocasts.com/•example apps:•http://cappuccino.org/learn/demos/

Page 20: Cappuccino - SDRuby 2009-08-06

Cocoa books•Cocoa Programming for Mac OSX (3rd edition) - Hillegass•Apple's Cocoa Documentation

In many cases, replace "NS" with "CP"it works the same way