The World’s Leading Microsoft .NET Magazine
   
 
The .NET Addict's Blog

My Top Tags

                                                           

My RSS Feeds








I heart FeedBurner

Latest Diggs - Programming

Computers Blogs - Blog Top Sites

Site Hits

Total: 3,825,508
since: 19 Jan 2005

Cappuccino, Objective-J, and You

posted Wed 10 Sep 08

In case you hadn't yet heard, Cappuccino is a new web application development framework. I know, you're probably thinking, "Why do we need yet another JavaScript library for doing Ajax?!?!" or you might be thinking, "We don't need another RIA technology like Flex or Silverlight!" ... you're right on both accounts, and thankfully Cappuccino is neither of those things!

Traditionally, building a really rich web application inside the context of a browser has always been a pain in the ass. Even when you factor in technologies like Flex or Silverlight, those all work on the concept of plugins. You hit a "rich" page, the page prompts you to download the plugin, you might lose context and be sent off to a different page. Once you've finally got the plugin installed you can go back to your original page and hopefully enjoy the "rich" content.

On the other side of the spectrum you've got the people building web applications using HTML, CSS, and JavaScript. This "pure" implementation of a web application has been getting more and more popular, especially with the advent of more powerful JavaScript/Ajax libraries like jQuery and so on. The problem with this scenario is that your programming model is still this weird mix of client and server side code (server-side code renders your HTML, JavaScript, and CSS, which is actually your client-side code) that can be cumbersome to test and code.

What we all really want is a single unified model for building applications. What we've been craving is a programming model that works in everybody's browser that lets us write rich, unbelievably awesome applications in a way that we as desktop application developers are familiar with. Why? Because more and more web applications are beginning to look like browser-embedded desktop applications, and when browsers start detaching frameless tabs like the Prism project and Chrome's feature, web applications start to look more and more like desktop apps... so the job to code these things is often falling in the laps of people who have experience building desktop apps.

The experience building desktop apps usually don't do us much good when building the web app, other than helping us make some design decisions. But... what if I told you that there was a JavaScript-based framework that gave you a single, unified programming paradigm for all of your client coding needs that didn't use HTML, DHTML, CSS, or even feel very much like JavaScript at all? What if I told you that this unified rich web application programming environment actually felt like Cocoa!? Would you believe me!?

You should, because the folks at 280north have made that vision come true. They've taken JavaScript and extended it to look and feel as much like Objective-C as you can manage. Objective-J is basically a hybrid that incorporates all of the things that we love about Objective-C like the dynamic features, message passing syntax, and the clarity of named, self-documenting parameter names. On top of Objective-C they have included a library of GUI classes that allow us to create views, scrolling regions, graphics, respond to mouse and keyboard events, and much, much more. In essence, if you were to take Cocoa and Objective-C and squeeze them through a web-enabling meat grinder, what came out the other side would be Objective-J and Cappuccino.

Here is some code from one of the Cappuccino tutorials:

var button = [[CPButton alloc] 
   initWithFrame: CGRectMake( CGRectGetWidth([contentView bounds])/2.0 - 40, CGRectGetMaxY([label frame]) + 10, 80, 18 )];
[button setAutoresizingMask:CPViewMinXMargin |
CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
[button setTitle:"swap"]; [button setTarget:self];
[button setAction:@selector(swap:)];
[contentView addSubview:button]; 

If you have ever written a line of Cocoa, you're probably squealing with joy right now, thinking, "Holy crap I can write a web application like THAT?! It's THAT easy!?!" That's right - gone are the days when you have to worry about all kinds of stupid JavaScript syntax, cross-browser compatibility case statements, DOM-model checking, and huge bulky combinations of server code, HTML, CSS, and JavaScript. Now, you can just sit down in your favorite editor and write Cappuccino code in Objective-J. Writing web applications like this is a breath of fresh air for anybody that went through the hell of the Ajax "early years".

What it boils down to is this:

  • If you intend for your application to reside in a single "page", like Outlook Web Access, gmail, 280 slides, and the "MobileMe" apps - then you should really, really, really consider looking at Objective-J and Cappuccino. If you're a Cocoa developer already, it's a no brainer. If you're not, consider Cappuccino a stepping-stone drug ;)
  • If you need what I call "small islands of rich interactivity" within an otherwise static frame of HTML and CSS, then Objective-J and Cappuccino are NOT for you. You're better off sticking with an Ajax framework in that case.
  • If you need a "big island" of rich interaction, like a fixed region of the page that will be a Silverlight or a Flex mini-app / control, then again - Cappuccino is not for you.

Basically if you are thinking about building an interactive web application that takes up the entire browser space available to it, then you should be thinking about doing it in Cappuccino. It's still early in it's development (it was only given to the public a little while ago), but so far it's one of the most promising client-side web application development frameworks I've seen to date. 

I highly recommend you go download it right now and start playing with it. Who knows, pretty soon we might even have Core Data and be able to launch NIBs inside a browser!! (wishful thinking, but hey, a guy needs to be able to dream...)

tags:              

links: digg this    del.icio.us    technorati    reddit

AddThis Social Bookmark Button




1. Ross Boucher left...
Wed 10 Sep 08 2:10 pm

Great post. My only comment is regarding this statement:

"If you need a "big island" of rich interaction, like a fixed region of the page that will be a Silverlight or a Flex mini-app / control, then again - Cappuccino is not for you."

You can use Cappuccino/Objective-J in an iFrame to load large regions of content on an otherwise vanilla HTML page. It's how the 280 Slides embedded viewer works.


2. Kevin Hoffman left...
Wed 10 Sep 08 3:15 pm

good point... I always forget about IFrames.


3. lsinger left...
Wed 10 Sep 08 5:17 pm :: http://blog.singr.org/

Actually, in the Tools directory in the 280North Git repository, there are a "nib2cib" and a "NibTool" folder. I haven't gotten it to work myself yet, but according to one of the developers, there already is preliminary support (just a handful of widgets) for building your Cappuccino application in Apple's InterfaceBuilder. Twisted, I know.

By the way, you have a typo there: "On top of Objective-C they have included" -- it should be Objective-J there. Sometimes, I can't tell them apart neither.


4. Kevin Hoffman left...
Wed 10 Sep 08 7:31 pm

Heh, I typed "Objective-" so many times in the post I was getting confused...


5. Craig left...
Wed 10 Sep 08 10:04 pm :: http://www.typemismatch.com/

Looks cool, have my little app running - as a .net only/windows developer the objective-j looked like greek :) What editors are you guys using or are you all on macs? I think this might be a good excuse to get a basic macbook ;)


6. Kevin Hoffman left...
Thu 11 Sep 08 5:06 am

I use TextMate, Gods own text editor.


7. joseph vodvarka left...

I have devloped a web site and am trying to use several various different techniques to build the site

here ois the link to my site

http://stormspotter.spruz.com/Default.asp?&new_log=yes


Tag Related Posts

Upgrading your Leopard install to Java SE 6 64-Bit

Mon 12 Jan 09 1:38 P GMT-05
tags:            

Apple drops the iPhone NDA for Released Software

Wed 01 Oct 08 3:54 P GMT-05
tags:          

Cappuccino, Objective-J, and You

Wed 10 Sep 08 6:14 P GMT-05

So I'm in the LA Times ;)

Wed 27 Aug 08 2:51 P GMT-05
tags:                  

MobileMe vs. Live Mesh Throwdown - Round 1

Wed 16 Jul 08 10:33 A GMT-05

Building Model Classes in C# and Cocoa

Sun 15 Jun 08 3:13 P GMT-05
tags:            

MobileMe vs. Live Mesh - Round 1

Wed 11 Jun 08 12:20 A GMT-05

My Macbook Air is masculine, dammit!

Mon 17 Mar 08 6:59 P GMT-05
tags:          

iPhone Underrated as a Gaming Device?

Fri 14 Mar 08 1:50 P GMT-05
tags:        

My take on the iPhone SDK

Sat 08 Mar 08 1:39 P GMT-05

Jobs says "not likely" to Flash on the iPhone

Thu 06 Mar 08 1:39 A GMT-05
tags:          

My Macbook Air Review

Sun 02 Mar 08 4:20 P GMT-05

iPhone Roadmap March 6th

Fri 29 Feb 08 10:41 P GMT-05
tags:        

Video of the Macbook Air in Action

Wed 20 Feb 08 3:04 P GMT-05

Macbook Airはきれいですよ!

Sun 17 Feb 08 2:38 A GMT-05

Why is O'Reilly Condoning iPhone Hacking?

Mon 11 Feb 08 3:55 P GMT-05

Evaluating my next laptop purchase

Wed 06 Feb 08 8:40 P GMT-05

Volta is to Ajax what Tums is to my Stomach

Wed 30 Jan 08 4:11 P GMT-05

The iPhone SDK key has been leaked! Oh Noez!!!1

Tue 29 Jan 08 11:36 A GMT-05
tags:        

Why Geeks just don't "get" the Macbook Air

Thu 17 Jan 08 2:30 P GMT-05

Popcorn + TiVo + Macbook Pro + iPhone == Hell Yeah!

Tue 15 Jan 08 3:11 P GMT-05
tags:          

How my ADC membership changed my life

Mon 31 Dec 07 3:57 P GMT-05
tags:      

Leopard Code Sample : Sprinkling in some Bonjour

Tue 27 Nov 07 2:32 P GMT-05
tags:        

Leopard Sample: A Bound NSCollectionView

Mon 29 Oct 07 1:41 A GMT-05

Leopard is out - let the code samples begin!

Fri 26 Oct 07 10:09 A GMT-05
tags:          

My life is complete : iPhone SDK is CONFIRMED.

Wed 17 Oct 07 6:38 P GMT-05
tags:          

Leopard Shipping October 26th!!

Tue 16 Oct 07 4:59 P GMT-05
tags:        

My iPhone Review

Mon 23 Jul 07 1:09 P GMT-05
tags:        

Microsoft Volta - just another codename?

Wed 11 Jul 07 2:43 P GMT-05
tags:        

Microsoft Codename Acropolis - Unwrapped

Wed 20 Jun 07 3:22 P GMT-05
tags:              

The dreaded language bleed-over has begun

Tue 19 Jun 07 6:23 P GMT-05
tags:        

My Appearance in the RIA Shootout on sys-con.tv

Tue 05 Jun 07 11:41 A GMT-05
tags:              

Exploring the Delegate Design Pattern

Mon 14 May 07 6:30 P GMT-05

Core Data - Almost too Easy?

Wed 18 Apr 07 2:23 P GMT-05

Exploring the MVC Pattern in WPF

Tue 10 Apr 07 12:51 P GMT-05
tags:                      

An experience with the Leopard beta

Mon 26 Mar 07 7:45 P GMT-05
tags:                

WPF Bindings == WTF Bindings?

Mon 12 Mar 07 6:31 P GMT-05