An Afternoon With Cappuccino 5

Posted by Justin Reagor Sat, 28 Mar 2009 19:16:00 GMT

Ok, so I know all about the Cocoa inspired, Javascript framework, SproutCore (with it's tiny bit of Ruby for the "build process"). It definitely has the leverage of being based on current web technologies. As well as used by Apple for the "highly successful" MobileMe service (hehe). While making excellent use of the fat client pattern.

However, I just tried out Cappuccino, by way of Objective-J, and ran through some tutorials. The power of the GNUstep/Cocoa frameworks are definitely something to be seen within your web browser.

I am starting to think I prefer this more for utilizing desktop applications on the web. In a similar vein as Java applets or Flash web apps. Because that's what Cappuccino and SproutCore were built for, desktop-like web applications. Not traditional "web sites" or hyper text documentation.

Short Intro

Objective-J is the language written using Javascript. Where Cappuccino is the framework built with Obj-J. A rewrite of Cocoa and GNUstep for the DOM.

The wiki defines Objective-J as...

... a programming language developed as part of the Cappuccino web development framework. Its syntax is nearly identical to the Objective-C syntax and it shares with JavaScript the same relationship that Objective-C has with the C programing language: that of being a strict, but small, superset; adding traditional inheritance and Smalltalk/Objective-C style dynamic dispatch to JavaScript. Pure JavaScript, being a prototype-based language, already has a notion of object orientation and inheritance, but Objective-J adds the use of class-based programming to JavaScript.

Taking a small look at some of the code you will see its heavy Obj-C syntax...

@import <Foundation/CPObject.j>   

@implementation AppController : CPObject {   
  CPTextField label;   
  CPString contentString;   
};   

- (void)applicationDidFinishLaunching:(CPNotification)aNotification {   
  var contentString = @"Hello world!";   
  var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],   
  contentView = [theWindow contentView];   

  label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];   

  [label setStringValue:contentString];   
  [label setFont:[CPFont boldSystemFontOfSize:24.0]];   
  [label sizeToFit];
  [label setAutoresizingMask:CPViewMinXMargin |
                                                   CPViewMaxXMargin |
                                                   CPViewMinYMargin |
                                                   CPViewMaxYMargin ];
  [label setFrameOrigin:CGPointMake((CGRectGetWidth([contentView bounds]) - CGRectGetWidth([label frame])) / 2.0,
                                (CGRectGetHeight([contentView bounds]) - CGRectGetHeight([label frame])) / 2.0)];

  [contentView addSubview:label];
}
@end;

The Pros

No one is suggesting you to ditch your life as a strict web standards developer and embrace the auto-generated presentation layers that Cappuccino provides. Instead, embrace the tool (TWSS). Use it when its the most appropriate.

Here are the positive bits I can identify at first glance...

  • Utilizes a proven platform and framework for desktop applications, Cocoa and GNUstep
  • Automagic cross browser support; from everything being abstracted away from you.
  • Obj-J can have Javascript intermingled, so you can write in a style with a cross between the two (hence the J).
  • NO PLUGINS; They wrote the damn lexer/parser entirely in Javascript. That's not JS ignorance, that's talent.
  • It seems pretty snappy and fast.
  • Used in production, considering 280slides.com is a killer web app.
  • Obj-J command-line interpreter
  • Theme support coming
  • Rake now employed for the "build"

The Cons

I've read through a ton of grips, mostly the introduction on Ajaxian. It seems that people at first believed this was an insult to Javascript. That there wasn't much of a purpose in bringing Obj-C to the web since HTML/CSS/JS work just as well. Of course the same people say the same thing about Java and Flash... but anyway, here are a few I'm watching out for.

  • Layers of abstraction are a plus, and a minus. :<
  • Seems you can only leverage current web tech (HTML/CSS/Canvas) through Cappuccino/Cocoa objects.
  • I haven't experienced their inheritance model yet, so I'm hoping thats not a hinderness (as in creating your own NSTableView or whatever).
  • The HTML source is completely obfuscated, and I imagine you can't make use of the DOM (restricted to Obj-J classes)
  • No command console [IRB]? Haven't found one yet.
  • Some error messages are vague.
  • Test/Behavior driven development? OJUnit does exist, haven't checked it out though.

EOF

The fact that the W3C and the industry are going to take decades to complete HTML5 and full CSS3 compliant browsers demonstrates the viability of this framework. No plugins, no compilation, just run the damn apps is POWERFUL. Also, given the success of Apple's platforms so far, Obj-C is proving itself on the desktop and on the iPhone. It's definitely not the horror that is VB.

Given those I think all-in-all it's a wonderful technology and I look forward to building a few apps with it!

What It's Like To Work At Kinetic

Posted by Justin Reagor Wed, 11 Mar 2009 23:36:00 GMT

The only difference is we have tons of work to do! ;)

Upgrading Git on Mac OS X 5

Posted by Colin A. Bartlett Sat, 07 Mar 2009 13:11:00 GMT

We recently switched to git based capistrano deployments and I quickly found out that these weren’t working from my MacBook Pro. I noticed that my git version was a few behind my coworker’s, so I figured it was time to upgrade.

Following Justin’s original git compilation instructions, I downloaded and compiled the latest Git version, 1.6.2 like so:

curl -O http://kernel.org/pub/software/scm/git/git-1.6.2.tar.gz
tar jxvf git-1.6.2.tar.gz
cd git-1.6.2
make prefix=/usr/local all
make prefix=/usr/local test && echo $?
sudo make prefix=/usr/local install

When the compile was done, it gave me output like this:

!! You have installed git-* commands to new gitexecdir.
!! Old version git-* commands still remain in bindir.
!! Mixing two versions of Git will lead to problems.
!! Please remove old version commands in bindir now.

Thanks to this nice posting, I discovered this always happens when you upgrade to 1.6 and above. Git now only puts the main git binary and a few others in your /usr/local/bin and it tucks the rest away elsewhere. That meant that all the other zillion binaries needed to be deleted from my bin. I simply did:

cd /usr/local/bin/
ls -latr | grep git

Which gave me an ordered list of all the git binaries installed. The ones at the end all had today’s date on them, so I knew those were the new versions. The rest I could whack. The ones I could keep were git-upload-pack, git-upload-archive, git-receive-pack, git, git-shell, git-cvsserver, and gitk. The rest I removed like so:

sudo rm git-var git-update-server-info git-unpack-file git-ssh-upload git-ssh-push git-ssh-pull git-ssh-fetch git-show-index git-send-pack git-peek-remote git-patch-id git-pack-redundant git-mktree git-mktag git-merge-tree git-merge-recursive git-merge-index git-local-fetch git-index-pack git-imap-send git-http-push git-http-fetch git-hash-object git-fetch-pack git-fast-import git-daemon git-convert-objects git-bisect git-write-tree git-whatchanged git-verify-tag git-verify-pack git-update-ref git-update-index git-unpack-objects git-tar-tree git-tag git-symbolic-ref git-svnimport git-svn git-submodule git-stripspace git-status git-stash git-show-ref git-show-branch git-show git-shortlog git-sh-setup git-send-email git-runstatus git-rm git-revert git-rev-parse git-rev-list git-reset git-rerere git-request-pull git-repo-config git-repack git-remote git-relink git-reflog git-rebase--interactive git-rebase git-read-tree git-quiltimport git-push git-pull git-prune-packed git-prune git-parse-remote git-pack-refs git-pack-objects git-name-rev git-mv git-mergetool git-merge-subtree git-merge-stupid git-merge-resolve git-merge-ours git-merge-one-file git-merge-octopus git-merge-file git-merge-base git-merge git-mailsplit git-mailinfo git-ls-tree git-ls-remote git-ls-files git-lost-found git-log git-instaweb git-init-db git-init git-gui git-grep git-get-tar-commit-id git-gc git-fsck-objects git-fsck git-format-patch git-for-each-ref git-fmt-merge-msg git-filter-branch git-fetch--tool git-fetch git-diff-tree git-diff-index git-diff-files git-diff git-describe git-cvsimport git-cvsexportcommit git-count-objects git-config git-commit-tree git-commit git-clone git-clean git-citool git-cherry-pick git-cherry git-checkout-index git-checkout git-check-ref-format git-check-attr git-cat-file git-bundle git-branch git-blame git-archive git-archimport git-apply git-annotate git-am git-add--interactive git-add gitjour

Then I just had to go back and install the manpages for the new version like so:

curl -O http://kernel.org/pub/software/scm/git/git-manpages-1.6.2.tar.bz2
sudo tar xjv -C /usr/local/man -f git-manpages-1.6.2.tar.bz2

And, low and behold, I was now running git 1.6.2! What’s more, my capistrano deployments work now.