librelist archives

« back to archive

Shoes pluggable framework

Shoes pluggable framework

From:
Peter Fitzgibbons
Date:
2012-01-12 @ 16:23
Howdy Folks.

I'm at the crossroads to move the BrownShoes project to a "pluggable
framework".

I'd like to hear thoughts and conversation around the following :

   - Every Shoes Class has a Framework base-class : Shoes::Animation <
   Shoes::Animation::Framework
   - Each Shoes "GUI" lives "on its own", implementing the ::Framework
   classes
   - For now, the frameworks will be in files ./lib/shoes-<framework-name>,
   a sibling of ./lib/shoes.  IE: ./lib/shoes-swt
   - Packaging and Gemification can happen later.  For now all frameworks
   will be in the shoes source (no different than RedShoes)
   - An Rspec "Framework Suite" of shared_expectations will be coded that
   defines the "interface requirement" of any Framework Implementation
   - The Shoes Rspec suite will mock framework and test only the
   "frontend".  This represents the "pure-Ruby" part of RedShoes +++.

Thanks for your feedback and ideas.

Peter Fitzgibbons
(847) 859-9550
Email: peter.fitzgibbons@gmail.com
IM GTalk: peter.fitzgibbons
IM AOL: peter.fitzgibbons@gmail.com

Re: [shoes] Shoes pluggable framework

From:
Eric Watson
Date:
2012-01-13 @ 21:06
On Jan 12, 2012, at 10:23 AM, Peter Fitzgibbons wrote:

> I'd like to hear thoughts and conversation around the following :
> 	• Every Shoes Class has a Framework base-class : Shoes::Animation < 
Shoes::Animation::Framework

Rather than using inheritance, I would consider using composition, so that
each Shoes::* object has an instance variable that is framework specific, 
e.g.

class Shoes::Animation
  def initialize(framework=RedShoes)
    @framework_object = framework.const_get(:Animation).new
  end
end

so that when you create a new Shoes object, it comes with an appropriate 
framework object

1.9.2p290 :024 > s = Shoes::Animation.new
 => #<Shoes::Animation:0x007fe2eb931860 
@framework_object=#<RedShoes::Animation:0x007fe2eb931838>> 

but you can specify the framework:

bs = Shoes::Animation.new(BrownShoes)
 => #<Shoes::Animation:0x007fe2eb9167e0 
@framework_object=#<BrownShoes::Animation:0x007fe2eb9167b8>> 

And it would be better designed than this ;) perhaps using a config style,
like I saw in RuGUI:

Shoes.config[:framework] = :brown_shoes

> 	• Each Shoes "GUI" lives "on its own", implementing the ::Framework classes
> 	• For now, the frameworks will be in files 
./lib/shoes-<framework-name>, a sibling of ./lib/shoes.  IE: 
./lib/shoes-swt
> 	• Packaging and Gemification can happen later.  For now all frameworks 
will be in the shoes source (no different than RedShoes)
> 	• An Rspec "Framework Suite" of shared_expectations will be coded that 
defines the "interface requirement" of any Framework Implementation

These all sound reasonable to me.

> 	• The Shoes Rspec suite will mock framework and test only the 
"frontend".  This represents the "pure-Ruby" part of RedShoes +++.

I think the ShoesSpec suite can test all the way down to the Framework 
calls (using a MockShoes framework). It can verify that the proper 
messages are being sent to the framework.

I would say that this represents "the future pure-Ruby part of RedShoes" 
since right now in RedShoes, lots of that interface is written in C.

> Thanks for your feedback and ideas.

Thanks to you for pushing us onward!

Eric