[ANN] Wee 2.0.0 released (Rack, Continuations, Refactoring)


#1

Hi all,

Around 4 years have passed since the last release of Wee.

What is Wee?

Wee is a Seaside-inspired 1 web-framework for building highly-dynamic
component-based web-applications.

What’s new?

  • 100% Rack based
  • Support for continuations
  • JQuery AJAX support
  • Ruby 1.9 ready

Distinctive Features

Wee is not just another web framework. It is completely different.

Continuations

You can use continuations to model the page flow of the your
application, in the same way as you’d call a method in a GUI
application. Continuations are optional; nothing in Wee depends on them.
Example:

you can write code like this:

if callcc YesNoMessageBox.new(‘Really?’)
# do something
else
# something else
end

Without continuations one has to use (ugly) Continuation Passing Style
(CPS):

call YesNoMessageBox.new(‘Really?’) do |res|
if res
# do something
else
# something else
end
end

Backtracking

Backtracking means that the user can naturally use the browsers back
button despite Wee’s statefulness. This is not taken for granted for
stateful web frameworks. Behind the scenes, Wee keeps multiple states
of the application around with only little help by the programmer.

Components

Contrary to the widely used model/view/controller (MVC) paradigm, Wee
tighly couples the controller and the view within a component.
Components itself are highly decoupled from the rest of the application
and can be reused to construct more complex applications. The powerful
programmatic HTML rendering approach further reduces wasting the
programmers mind by avoiding switching files (controller/view) or
languages (Ruby/HTML). Therefore in Wee everything is written in Ruby.
The programmatic HTML renderer is not just a simple HTML builder, it
provides very powerful methods for easily generating HTML constructs
and registering callbacks. Example:

Generating a tag

select an object from these items

items = [1, 2, 3, 4]

the labels shown to the user

labels = items.map {|i| i.to_s}

render it

r.select_list(items).labels(labels).callback {|choosen| p choosen}

render a multi-select list, with objects 2 and 4 selected

r.select_list(items).multi.labels(labels).selected([2,4])

=== Call/Answer mechanism ===

From callback handlers you can call other components which in turn
replace the current components view. The called component can later
return (or answer) back to the calling componenent. Example:

class YesNoMessageBox < Wee::Component
def initialize(msg)
super()
@msg = msg
end

 def render(r)
   r.bold(@msg)
   r.form do
     r.submit_button.value('YES').callback { answer true }
     r.space
     r.submit_button.value('No').callback { answer false }
   end
 end

end

Use call (or callcc) as in the Continuation section above

to call a component:

call YesNoMessageBox.new(‘Really?’)

The classical Hello World Example

require ‘rubygems’ if RUBY_VERSION < “1.9”
require ‘wee’

class HelloWorld < Wee::Component
def initialize
super
add_decoration Wee::PageDecoration.new(title=“Hello World”)
end

 def render(r)
   r.h1 "Hello World from Wee!"
   r.div.onclick_callback { p "clicked" }.with("click here")
 end

end

Wee.run(HelloWorld) if FILE == $0

Now point your browser to http://localhost:2000/

Installation

gem install wee

More Resources

http://rubyforge.org/projects/wee
http://www.ntecs.de/projects/wee/doc/rdoc/

Regards,

Michael


#2

Michael N. wrote:

Hi all,

Around 4 years have passed since the last release of Wee.

Strange that my posting didn’t get through to ruby-talk :frowning:


#3

For some (yet) unknown reasons my announcement didn’t make it to
ruby-talk. You can read the full text here:

http://www.ruby-forum.com/topic/183615#802610

Regards,

Michael


#4

Michael N. wrote:

Michael N. wrote:

Hi all,

Around 4 years have passed since the last release of Wee.

Strange that my posting didn’t get through to ruby-talk :frowning:

(I’ll try to post again. Sorry for any inconveniences)

Hi all,

Around 4 years have passed since the last release of Wee.

What is Wee?

Wee is a Seaside-inspired 1 web-framework for building highly-dynamic
component-based web-applications.

What’s new?

  • 100% Rack based
  • Support for continuations
  • JQuery AJAX support
  • Ruby 1.9 ready

Distinctive Features

Wee is not just another web framework. It is completely different.

Continuations

You can use continuations to model the page flow of the your
application, in the same way as you’d call a method in a GUI
application. Continuations are optional; nothing in Wee depends on them.
Example:

you can write code like this:

if callcc YesNoMessageBox.new(‘Really?’)
# do something
else
# something else
end

Without continuations one has to use (ugly) Continuation Passing Style
(CPS):

call YesNoMessageBox.new(‘Really?’) do |res|
if res
# do something
else
# something else
end
end

Backtracking

Backtracking means that the user can naturally use the browsers back
button despite Wee’s statefulness. This is not taken for granted for
stateful web frameworks. Behind the scenes, Wee keeps multiple states
of the application around with only little help by the programmer.

Components

Contrary to the widely used model/view/controller (MVC) paradigm, Wee
tighly couples the controller and the view within a component.
Components itself are highly decoupled from the rest of the application
and can be reused to construct more complex applications. The powerful
programmatic HTML rendering approach further reduces wasting the
programmers mind by avoiding switching files (controller/view) or
languages (Ruby/HTML). Therefore in Wee everything is written in Ruby.
The programmatic HTML renderer is not just a simple HTML builder, it
provides very powerful methods for easily generating HTML constructs
and registering callbacks. Example:

Generating a tag

select an object from these items

items = [1, 2, 3, 4]

the labels shown to the user

labels = items.map {|i| i.to_s}

render it

r.select_list(items).labels(labels).callback {|choosen| p choosen}

render a multi-select list, with objects 2 and 4 selected

r.select_list(items).multi.labels(labels).selected([2,4])

Call/Answer mechanism

From callback handlers you can call other components which in turn
replace the current components view. The called component can later
return (or answer) back to the calling componenent. Example:

class YesNoMessageBox < Wee::Component
def initialize(msg)
super()
@msg = msg
end

 def render(r)
   r.bold(@msg)
   r.form do
     r.submit_button.value('YES').callback { answer true }
     r.space
     r.submit_button.value('No').callback { answer false }
   end
 end

end

Use call (or callcc) as in the Continuation section above

to call a component:

call YesNoMessageBox.new(‘Really?’)

The classical Hello World Example

require ‘rubygems’ if RUBY_VERSION < “1.9”
require ‘wee’

class HelloWorld < Wee::Component
def initialize
super
add_decoration Wee::PageDecoration.new(title=“Hello World”)
end

 def render(r)
   r.h1 "Hello World from Wee!"
   r.div.onclick_callback { p "clicked" }.with("click here")
 end

end

Wee.run(HelloWorld) if FILE == $0

Now point your browser to http://localhost:2000/

Installation

gem install wee

More Resources

Regards,

Michael


#5

On Apr 7, 2009, at 3:39 AM, Michael N. wrote:

Strange that my posting didn’t get through to ruby-talk :frowning:

I tried to post to announce BlueCloth 2.0 today and it still hasn’t
come through either.