Top Banner
CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions
27

CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Dec 17, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

CAPPUCCINO & OBJECTIVE-J

Evaluation Using Cognitive Dimensions

Page 2: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Outline

Intro Objective-J Cappuccino Cognitive Dimensions

Page 3: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

About

“Cappuccino is an open source framework that makes it easy to build desktop-caliber applications that run in a web browser”

Created by the 280north company Used to implement a browser based keynote

application 280slides.com

Open source hosted on git git://github.com/280north/cappuccino.git

Page 4: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

280Slides.com

Page 5: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Outline

Intro Objective-J Cappuccino Cognitive Dimensions

Page 6: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Objective-J

Objective-J is a standalone language addition to JavaScript.

Objective-J is a strict superset of JavaScript Any valid JavaScript code can be placed into

Objective-J Code Objective-J is derived from the Objective-C

language Trivial Objective-J code can be compiled into

Objective-C

Page 7: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Low Viscosity

Obj-J attempts to have very low viscosity Task: create a string with the current date

Obj-J: [CPString stringWithFormat:@"Today: %@", date]

JavaScript: “Today:”+date

Where JavaScript is easier it can be used inline Objective-J simply enhances JS

Page 8: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Objective-J and Abstraction

Other JavaScript Libraries Prototype, Dojo, jQuery

These libraries add abstraction and functionality to JavaScript Fail to take the extra step of adding new syntax Creates complex method to accomplish tasks

Class declaration

Objective-J Extends functionality AND syntax to present clear usage

Page 9: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Classes

Objective-J extends JS by adding class abstractions as first-order objects

Classes have traditional properties Inheritance Instance variables Static methods

Code example declaring the Desk class as a subclass of the Furniture class.

Page 10: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Objective-J

[Code]@import “Furniture.j”

@implementation Desk : Furniture

{

CPString type @accessors;

}

-(void)putPapers{

}

@end

[/Code]

Page 11: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Dojo

[Code]dojo.declare(”Desk", Furniture,

{

constructor: function(type)

{

this.type=type

},

putPapers: function()

{

}

});[/Code]

Page 12: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Classes vs. Prototype

The ability to define Classes is superior to the prototypes method in clarity Functions are separate from objects Static methods are wrapped in classes Allows for constructs like method_missing

Class extension and modification occur in designated locations, not arbitrarily scatered.

Prototyping is instead encapsulated in categories

Page 13: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Categories

Ability to append functionality to classes without subclassing.

Any class can be the target of Category extension including predefined classes

If a string reversal function was commonly required the CPString class could be modified to provide such a method.

Page 14: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Category implementation

[Code]

@import <Foundation/CPString.j>

@implementation CPString (Reversing) //class (Category)

- (CPString)reverse

{

var reversedString = "", index = [self length];

while(index--) reversedString += [self characterAtIndex: index];

return reversedString;

}

@end

var myString= “12345”;

alert([myString reverse]); //alerts “54321”

[/Code]

Page 15: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Development

Hard to debug Error line numbers are typically not correct due to

library abstraction Same as JavaScript in terms of Progressive

Evaluation Simply requires a browser refresh to view new changes

Syntax lends itself to easy code highlighting and suggestion

Textmate plugin available from website

Page 16: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Outline

Intro Objective-J Cappuccino Cognitive Dimensions

Page 17: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Objective-J and Cappuccino

Obj-J stands alone without Cappuccino as a new library for JavaScript

Obj-J developed for Cappuccino Cappuccino Framework built on Objective-J

Creates a “WebDK” for advanced web based applications.

Attempts to bridge the gap between web and desktop development with minimal effort Low Abstraction Barrier

Page 18: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Cappuccino vs. Web Development

Web development HTML CSS JS / JS DOM API …

Cappuccino Abstracts Hard Mental Operations

You never touch the DOM or code a line of CSS Removes render decisions and handles all browsers without

redundant code on your part. IE 6&7, Firefox 2&3, Safari 3 / Webkit, Google Chrome, Opera…

Page 19: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Library: to name a few

Has 96 predefined classes. CPButton CPDictionary CPMenu

Offers several functional classes CAAnimation

Provides timing and transition effects CALayer

Enables image manipulation through affine transformations Transparency, dependent children layers

Page 20: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Simple syntax

One line to create application window Treats browser as a “bridge” akin to a window

managers role.

Style and size Designs layout through resizing masks

Maintains a decent balance of terse vs. diffuse code Nomenclature accurately describes function.

Page 21: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Example Code

[Code]

//create new window

Var theWindow=[[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], contentView = [theWindow contentView];

//Set a buttons resize mask

[button setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];

[/Code]

Page 22: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Hooks and events

Cappuccino uses a target/action style for defining behavior [button setTarget: theTarget] [button setAction:@selector(theMethod:)];

Both target and action can be dynamically assigned.

Can become a Visibility issue if not well defined.

Page 23: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Undo/Redo

Cappuccino’s high level functionality is awesome. Nativly supports Undo/Redo through CPUndoManager Any action is a valid candidate. Each window is assigned an instance of CPUndoManager

so each window defaults to have independent action stacks. CPUndoManager can be both subclassed or extended

through categories allowing custom undo/redo actions Adding undo and redo requires a single line of code The manager’s logic determines if the action is a pop (redo)

or push (undo) event.

Page 24: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Undo/Redo

[Code]

-(void) editText:(CPString) newText{

//Set up undo

[[[self window] undoManager]

registerUndoWithTarget:self

selector:@selector(editText:)

object:newText];

//Execute rest of method

oldText=newText;

}

[/Code]

Page 25: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Outline

Intro Objective-J Cappuccino Cognitive Dimensions

Page 26: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Reflections on CD

Useful ideas to keep in mind Some of the dimensions are extremely relevant

Viscosity Progressive evaluation

Many of the dimensions are closely related or interdependent Not a bad thing but can cause some confusion in

deciding where a problem or feature belongs.

Page 27: CAPPUCCINO & OBJECTIVE-J Evaluation Using Cognitive Dimensions.

Reference

http://cappuccino.org/