librelist archives

« back to archive

Understanding the source code - how?

Understanding the source code - how?

From:
Brett
Date:
2010-08-10 @ 03:20
Hi shoes users,
   I'm a new Shoes user (1 week experience!).  After having tried some 
other Ruby GUI toolkits like fxRuby and wxRuby I was surprised how easy 
Shoes was to get started.  I really feel Shoes should get a lot more 
attention and be further improved to make it a leading Ruby GUI toolkit.

   One thing I'm sure all of you have experienced at some point is a 
missing feature in the code.  In my case it was the inability to change 
the text of a button.  I was wondering how hard it would be to add that 
functionality, so I downloaded the source code to see how buttons were 
implemented.  I know C and C++, but I have little experience wrapping 
functions and using the C implementation of Ruby.  I found myself 
confused as to how I could possibly add to what is already there.

   Therefore I'm wondering if anyone here who is actively developing 
Shoes could give me a few pointers as to how to understand the source 
code, i.e. how the underlying GTK widgets have been wrapped and made 
available to Ruby as methods.  Perhaps there's some basic background 
information I'm missing, such as generally how to wrap functions in 
Ruby?  Now, I know some of the leading programmers for the Policeman 
release are probably programming geniuses, and can just hunt through ri 
and rdoc info, the source code, and just get it.  You probably have lots 
of experience working on projects like this which helps.  Are there any 
resources on the net for working on Ruby projects?

   Sorry if this post doesn't make a lot of sense or is a bit vague.  If 
so, just ask me to elaborate more.
   Thanks in advance,
   Brett

Re: [shoes] Understanding the source code - how?

From:
Steve Klabnik
Date:
2010-08-10 @ 03:30
Hey Brett-

On Mon, Aug 9, 2010 at 11:20 PM, Brett <matrix@ninus.ocn.ne.jp> wrote:
> Hi shoes users,
>   I'm a new Shoes user (1 week experience!).  After having tried some
> other Ruby GUI toolkits like fxRuby and wxRuby I was surprised how easy
> Shoes was to get started.  I really feel Shoes should get a lot more
> attention and be further improved to make it a leading Ruby GUI toolkit.

Awesome. Thanks for the kind words. Hopefully Whyday will give us a
nice publicity boost.

> Now, I know some of the leading programmers for the Policeman
> release are probably programming geniuses, and can just hunt through ri
> and rdoc info, the source code, and just get it.  You probably have lots
> of experience working on projects like this which helps.

You'd be surprised, we're only mere mortals like everyone else. ;)
Just the other day, it was brought up in a thread that there's
actually very little information (in english) about embedding Ruby
1.9, and how we might have to look into it a bit more...

It's certainly not easy, it just requires a bit of persistance.

> Are there any
> resources on the net for working on Ruby projects?

Well, most projects have some sort of page explaining how to
contribute. This is actually one of our weaker points, but it's very
similar to one of my existing projects, Hackety Hack. You might be
interested in these two articles from the Wiki, they sort of lay out
the general idea:

http://wiki.github.com/hacketyhack/hacketyhack/an-open-source-overview
http://wiki.github.com/hacketyhack/hacketyhack/contributing-to-hackety-hack

>   Sorry if this post doesn't make a lot of sense or is a bit vague.  If
> so, just ask me to elaborate more.

Nothing you said was vague, but I (at least) would love to see you
(and everyone else) elaborate more all the time! The only way that we
can get good beginner documentation is if we know what problems a
beginner has with getting involved... which means we need a beginner
to speak up about it.

Soooo... if you'd like to try and figure it out, then report back, we
can fix that, and keep going from there. How's that sound? We're
already off to a good start: you can't find any documentation. Did you
look somewhere specific, and not find it? Did you know if there even
was said documentation? How'd you find out about the project, maybe
someone linked you somewhere strange?

Re: [shoes] Understanding the source code - how?

From:
Brett
Date:
2010-08-10 @ 04:19
Hey Steve,
   Thanks for replying so quickly!  10 minutes must be a record!

   I'd be happy to try to put together some documentation for the 
absolute beginner to Shoes development (seeing as I'm in that situation 
myself).
   I forgot to mention in my original email that I'm using Ubuntu 10.04 
and I could compile the github source code successfully.  I'm also using 
Ruby 1.9.1.

> Just the other day, it was brought up in a thread that there's
> actually very little information (in english) about embedding Ruby
> 1.9, and how we might have to look into it a bit more...
>
> It's certainly not easy, it just requires a bit of persistance.
>
>    
   You mention a lack of information in English.  In which language is 
there more information?  If it's Japanese then we're in luck as I'm able 
to read most normal Japanese, so if it is Japanese and you know of some 
Japanese websites then please let me know where to look!


>> Are there any
>> resources on the net for working on Ruby projects?
>>      
> Well, most projects have some sort of page explaining how to
> contribute. This is actually one of our weaker points, but it's very
> similar to one of my existing projects, Hackety Hack. You might be
> interested in these two articles from the Wiki, they sort of lay out
> the general idea:
>
> http://wiki.github.com/hacketyhack/hacketyhack/an-open-source-overview
> http://wiki.github.com/hacketyhack/hacketyhack/contributing-to-hackety-hack
>
>    
   Thanks, I'll check those articles out.

>
> Soooo... if you'd like to try and figure it out, then report back, we
> can fix that, and keep going from there. How's that sound? We're
> already off to a good start: you can't find any documentation. Did you
> look somewhere specific, and not find it? Did you know if there even
> was said documentation? How'd you find out about the project, maybe
> someone linked you somewhere strange?
>    
   Your suggestion is great.  I've looked (of course) at the 
shoes.heroku.com website, most of the info is for Shoes programming and 
not development.  I've looked at http://wiki.github.com/shoes/shoes/ but 
the articles are either about using Shoes, or development articles that 
assume knowledge of how to develop.

   My guess is that there is no beginner development documentation, and 
that's what led me to guess that the Shoes developers gained their 
knowledge from involvement with other projects.  No one gave me a link 
for any Shoes developer documentation.

   I see that if you google for "ruby gui" Shoes is listed as one of the 
first suggestions.  I guess I didn't do that initially, I already knew 
about wxWidgets so I think I googled specifically for "wx ruby" and 
found wxRuby.  Although it was nice, I started getting 
hard-to-figure-out bugs in my code, so I was curious as to what other 
gui's existed for ruby, so finally I found Shoes.

   Cheers Brett

Re: [shoes] Understanding the source code - how?

From:
Devyn Cairns
Date:
2010-08-10 @ 04:35
On Mon, Aug 9, 2010 at 9:19 PM, Brett <matrix@ninus.ocn.ne.jp> wrote:

> Hey Steve,
>   Thanks for replying so quickly!  10 minutes must be a record!
>

Our record is around 5, I think :P


>
>   I'd be happy to try to put together some documentation for the
> absolute beginner to Shoes development (seeing as I'm in that situation
> myself).
>   I forgot to mention in my original email that I'm using Ubuntu 10.04
> and I could compile the github source code successfully.  I'm also using
> Ruby 1.9.1.
>

Alright, Cecil ought to be able to help you if you have any trouble.


> > Just the other day, it was brought up in a thread that there's
> > actually very little information (in english) about embedding Ruby
> > 1.9, and how we might have to look into it a bit more...
> >
> > It's certainly not easy, it just requires a bit of persistance.
> >
> >
>    You mention a lack of information in English.  In which language is
> there more information?  If it's Japanese then we're in luck as I'm able
> to read most normal Japanese, so if it is Japanese and you know of some
> Japanese websites then please let me know where to look!
>

It is! We have ashbb, too; he lives in Japan :P So he could probably give
you the links.


>
>
> >> Are there any
> >> resources on the net for working on Ruby projects?
> >>
> > Well, most projects have some sort of page explaining how to
> > contribute. This is actually one of our weaker points, but it's very
> > similar to one of my existing projects, Hackety Hack. You might be
> > interested in these two articles from the Wiki, they sort of lay out
> > the general idea:
> >
> > http://wiki.github.com/hacketyhack/hacketyhack/an-open-source-overview
> >
> http://wiki.github.com/hacketyhack/hacketyhack/contributing-to-hackety-hack
> >
> >
>    Thanks, I'll check those articles out.
>
> >
> > Soooo... if you'd like to try and figure it out, then report back, we
> > can fix that, and keep going from there. How's that sound? We're
> > already off to a good start: you can't find any documentation. Did you
> > look somewhere specific, and not find it? Did you know if there even
> > was said documentation? How'd you find out about the project, maybe
> > someone linked you somewhere strange?
> >
>    Your suggestion is great.  I've looked (of course) at the
> shoes.heroku.com website, most of the info is for Shoes programming and
> not development.  I've looked at http://wiki.github.com/shoes/shoes/ but
> the articles are either about using Shoes, or development articles that
> assume knowledge of how to develop.
>
>   My guess is that there is no beginner development documentation, and
> that's what led me to guess that the Shoes developers gained their
> knowledge from involvement with other projects.  No one gave me a link
> for any Shoes developer documentation.
>
>   I see that if you google for "ruby gui" Shoes is listed as one of the
> first suggestions.  I guess I didn't do that initially, I already knew
> about wxWidgets so I think I googled specifically for "wx ruby" and
> found wxRuby.  Although it was nice, I started getting
> hard-to-figure-out bugs in my code, so I was curious as to what other
> gui's existed for ruby, so finally I found Shoes.
>

This is how I first found Shoes, back in the era of _why, of course, when
Shoes was still in the early ~300 revisions (Shoes Curious). I too was a
WxRuby user (pre-sugar! it was ugly.)


>
>   Cheers Brett
>



-- 
    ~devyn

Re: [shoes] Understanding the source code - how?

From:
Cecil Coupe
Date:
2010-08-10 @ 05:13
On Tue, 2010-08-10 at 13:19 +0900, Brett wrote:
> Hey Steve,
>    Thanks for replying so quickly!  10 minutes must be a record!
> 
>    I'd be happy to try to put together some documentation for the 
> absolute beginner to Shoes development (seeing as I'm in that situation 
> myself).
>    I forgot to mention in my original email that I'm using Ubuntu 10.04 
> and I could compile the github source code successfully.  I'm also using 
> Ruby 1.9.1.
> 
> > Just the other day, it was brought up in a thread that there's
> > actually very little information (in english) about embedding Ruby
> > 1.9, and how we might have to look into it a bit more...
> >
> > It's certainly not easy, it just requires a bit of persistance.
> >
> >    
>    You mention a lack of information in English.  In which language is 
> there more information?  If it's Japanese then we're in luck as I'm able 
> to read most normal Japanese, so if it is Japanese and you know of some 
> Japanese websites then please let me know where to look!

The Ruby core time can always use JP -> EN volunteers, but that's a
different group of people than Shoes. We are not Ruby core developers.
We just use what we can find on the web and the 1.9.1 embedding api
doesn't have a lot of EN love. 

> 
> 
> >> Are there any
> >> resources on the net for working on Ruby projects?
> >>      
> > Well, most projects have some sort of page explaining how to
> > contribute. This is actually one of our weaker points, but it's very
> > similar to one of my existing projects, Hackety Hack. You might be
> > interested in these two articles from the Wiki, they sort of lay out
> > the general idea:
> >
> > http://wiki.github.com/hacketyhack/hacketyhack/an-open-source-overview
> > http://wiki.github.com/hacketyhack/hacketyhack/contributing-to-hackety-hack
> >
> >    
>    Thanks, I'll check those articles out.
> 
> >
> > Soooo... if you'd like to try and figure it out, then report back, we
> > can fix that, and keep going from there. How's that sound? We're
> > already off to a good start: you can't find any documentation. Did you
> > look somewhere specific, and not find it? Did you know if there even
> > was said documentation? How'd you find out about the project, maybe
> > someone linked you somewhere strange?
> >    
>    Your suggestion is great.  I've looked (of course) at the 
> shoes.heroku.com website, most of the info is for Shoes programming and 
> not development.  I've looked at http://wiki.github.com/shoes/shoes/ but 
> the articles are either about using Shoes, or development articles that 
> assume knowledge of how to develop.
> 
>    My guess is that there is no beginner development documentation, and 
> that's what led me to guess that the Shoes developers gained their 
> knowledge from involvement with other projects.  No one gave me a link 
> for any Shoes developer documentation.

Your guess is mostly correct. Shoes is not Ruby, Shoes is a restricted
Ruby that mostly looks like Ruby. The GUI is Cairo and Pango and the
intersection GTK,Cocoa,Windows. 
> 
>    I see that if you google for "ruby gui" Shoes is listed as one of the 
> first suggestions.  I guess I didn't do that initially, I already knew 
> about wxWidgets so I think I googled specifically for "wx ruby" and 
> found wxRuby.  Although it was nice, I started getting 
> hard-to-figure-out bugs in my code, so I was curious as to what other 
> gui's existed for ruby, so finally I found Shoes.

Shoes will never (IMO) be a replacement for things like wxWidgets. It
can't really handle user defined widgets. Not all properties are exposed
to the Shoes developer. Shoes is a tightly constrained GUI language for
end user wannabe developers. WxWidgets is a unconstrained library for
experienced C/C++/Ruby/GTK/Windows/Cocoa *developers*. Neither is better
and  I've worked on both projects. They are not equivalent.  Different
people, different solutions.
> 
>    Cheers Brett

Re: [shoes] Understanding the source code - how?

From:
ashbb
Date:
2010-08-10 @ 04:35
Hi Brett,

> how to wrap functions in Ruby?
This is my tiny study note: http://github.com/ashbb/extending_ruby_with_c

I'm using Windows, so may be a little bit different.
But,

> if it is Japanese and you know of some Japanese websites
> then please let me know where to look!
Wow, fantastic! Look at the foot of the above tiny note.
I added some links to Japanese web site.

> No one gave me a link for any Shoes developer documentation.
Ah,... not a good documentation, just my personal memo, though,...
http://github.com/ashbb/shoes_hack_note

Hope this helps. ;-)

Cheers,
ashbb

Re: [shoes] Understanding the source code - how?

From:
Brett
Date:
2010-08-10 @ 04:40
Hey ashbb,
   You made my day!  I'll check out your links.  Thanks also for putting 
up all your Shoes-made apps on your homepage, they're very well-done and 
great examples for the rest of us!
   Cheers Brett

On 10/08/10 13:35, ashbb wrote:
> Hi Brett,
>
> > how to wrap functions in Ruby?
> This is my tiny study note: http://github.com/ashbb/extending_ruby_with_c
>
> I'm using Windows, so may be a little bit different.
> But,
>
> > if it is Japanese and you know of some Japanese websites
> > then please let me know where to look!
> Wow, fantastic! Look at the foot of the above tiny note.
> I added some links to Japanese web site.
>
> > No one gave me a link for any Shoes developer documentation.
> Ah,... not a good documentation, just my personal memo, though,...
> http://github.com/ashbb/shoes_hack_note
>
> Hope this helps. ;-)
>
> Cheers,
> ashbb
>