librelist archives

« back to archive

Why are widgets problematic?

Why are widgets problematic?

From:
Martin DeMello
Date:
2011-04-03 @ 13:18
Forgot that librelist wasn't letting my regular email through :(
Anyway, here's the message again.

m.


---------- Forwarded message ----------
From: Martin DeMello <martindemello@gmail.com>
Date: Thu, Mar 24, 2011 at 11:55 AM
Subject: Why are widgets problematic?
To: shoes@librelist.com


I think it's worth a close look at exactly *why* widgets are
problematic in shoes, and why large programs cannot be easily
organised. My feeling (without having looked at the code in a while)
is that the quirky scoping rules are to blame - if so, should we
reexamine them and see if we can change the way things work so that
modular, widget-based code is better supported?

martin

Re: [shoes] Why are widgets problematic?

From:
Steve Klabnik
Date:
2011-04-03 @ 17:13
>
> I think it's worth a close look at exactly *why* widgets are
> problematic in shoes,


They're just a bit buggy sometimes. I use custom widgets in Hackety, and
they work out. It wasn't a feature that _why had fully fleshed out, that's
all.


> and why large programs cannot be easily
> organised.


I don't think this is true. I think that there just aren't enough good
examples of how to do this. Hackety, for example, is pretty big, and I think
it's reasonably organized.


> My feeling (without having looked at the code in a while)
> is that the quirky scoping rules are to blame


This may be true, I haven't looked at it in a long time.


> - if so, should we
> reexamine them and see if we can change the way things work so that
> modular, widget-based code is better supported?
>

Sure. I'd be down. I've been trying to get Shoes over to 1.9.2, so I haven't
looked at the widget code in a while, but I'd be interested in poking at it
if you are.

Re: [shoes] Why are widgets problematic?

From:
Martin DeMello
Date:
2011-04-03 @ 17:20
On Sun, Apr 3, 2011 at 10:43 PM, Steve Klabnik <steve@steveklabnik.com> wrote:
>> I think it's worth a close look at exactly *why* widgets are
>> problematic in shoes,
>
> They're just a bit buggy sometimes. I use custom widgets in Hackety, and
> they work out. It wasn't a feature that _why had fully fleshed out, that's
> all.

Okay, the impression I'd gotten from following the list was that they
were pretty much too buggy to use in an actual large project.

>> and why large programs cannot be easily
>> organised.
>
> I don't think this is true. I think that there just aren't enough good
> examples of how to do this. Hackety, for example, is pretty big, and I think
> it's reasonably organized.

Fair point. I'll check out the Hackety source and see if I can get any
insights from it. I do remember back when I was actively playing with
shoes, finding it quite hard to keep the GUI code modular.

>> My feeling (without having looked at the code in a while)
>> is that the quirky scoping rules are to blame
>
> This may be true, I haven't looked at it in a long time.
>
>> - if so, should we
>> reexamine them and see if we can change the way things work so that
>> modular, widget-based code is better supported?
>
> Sure. I'd be down. I've been trying to get Shoes over to 1.9.2, so I haven't
> looked at the widget code in a while, but I'd be interested in poking at it
> if you are.

Great :) Do you think green shoes would be the best place to start
with, seeing as how it's installable as a gem?

martin

Re: [shoes] Why are widgets problematic?

From:
Steve Klabnik
Date:
2011-04-04 @ 19:08
>
> Okay, the impression I'd gotten from following the list was that they
> were pretty much too buggy to use in an actual large project.
>

Yeah, sorry, let me rephrase that: They're a feature with no documentation,
and so they have no real defined behavior. I'm using them, and they work,
but.. they're kinda the wild west.


> Fair point. I'll check out the Hackety source and see if I can get any
> insights from it. I do remember back when I was actively playing with
> shoes, finding it quite hard to keep the GUI code modular.
>

I think that understanding modules is the key.



> Great :) Do you think green shoes would be the best place to start
> with, seeing as how it's installable as a gem?
>

I mean, it's a totally new codebase, so...

Re: [shoes] Why are widgets problematic?

From:
ashbb
Date:
2011-04-04 @ 14:00
Hi Martin, Steve et al,

What is the Shoes::Widget class for? ;-)

I have no documents about Shoes::Widget class _why wrote except some ML
posts, e.g.
http://www.mail-archive.com/shoes@code.whytheluckystiff.net/msg02489.html

I've implemented Shoes::Widget class in Green Shoes.
It is just simple to do the following:

 class MyClass < Shoes::Widget
   # you can use all Shoes::App instance methods here, e.g. para, stack,
etc.
 end

 Shoes.app do
   myclass  # This is the same as MyClass.new
 end

But look at the code:
-  https://github.com/ashbb/green_shoes/blob/master/lib/shoes/widget.rb

Yeah, Green Shoes defines method_missing in MyClass automatically.
So, you can't use method_missing as you like. :-P

In contrast, Red Shoes' Widget is a flow.
Look at the code:

- https://github.com/shoes/shoes/blob/develop/lib/shoes.rb#L529
- https://github.com/shoes/shoes/blob/develop/shoes/canvas.c#L2133

So, Green Shoes run the following snippet, but Red Shoes doesn't.
But I don't know this is good or bad.
Because I'm not sure "What is the Shoes::Widget class for?"

class Foo < Shoes::Widget
 def initialize
   para self
 end
end

class Woo < Shoes::Widget
 def initialize
   para self
 end
end

class Goo < Foo
 def initialize
   para self
   big
 end
 def big
   title self
 end
end

Shoes.app do
 goo
 woo
 foo
end

We need to discuss about Shoes spec more and more! :-D
# White Shoes... ?
ashbb