librelist archives

« back to archive

MVC Architecture?

MVC Architecture?

From:
Maximilian Stroh
Date:
2012-01-16 @ 00:02
Sorry for new topic, but this is my subscribe mail to the mailing list.This
mail is mentioned as a crosstopic post over the last things i read here :)

So, you discuss to make shoes MVC? I agree that such a structure would have
some huge advantages:
- It's easy to split your code into different files. As i started with
shoes, this took me some time to get how it could work.
- When we talk about models, ActiveRecord should *really* be shipped with
shoes by default! i use AR with shoes standalone, but a built-in solution
would be better i think.
- For beginners, i would recommend to use a simple key-value-store, just to
get stuff saved on disk without thinking about data structures too much. I
personally would suggest the "kioku" gem, as i am the maintainer ;)
- it should be easy to run tests (unit or cucumber or ...) against those
structured files. seems hard to to BDD with shoes in the current state in
my opinion.

Before I forget: As I use shoes on Ubuntu/Linux and Windows XP/Vista/7,
there are some things i wish to be solved for the next release ;)
- video support on linux! even building an mp3-player is funny now...
- vista: black screens, ... but vista itself is dead, not important for me.
- windows: the included version of rubygems ist still too old.
- would it be possible to package an app with a custom app-icon? :D
- packager needs some love in general i'd say.

This all is NOT meant as critic, i really love shoes! Use it since nearly 2
years and for several little projects. This are just problems i want to
speak about, in other words: some feedback from a widely happy user :)

- Anonyfox

PS: oh and ashbb; 'gshoes -m' fails at my machine :(

Re: [shoes] MVC Architecture?

From:
Cecil Coupe
Date:
2012-01-16 @ 11:11
Welcome to the list Maximillian!

On Mon, 2012-01-16 at 01:02 +0100, Maximilian Stroh wrote:
> Sorry for new topic, but this is my subscribe mail to the mailing
> list.This mail is mentioned as a crosstopic post over the last things
> i read here :)
> 
> 
> So, you discuss to make shoes MVC? I agree that such a structure would
> have some huge advantages: 
> - It's easy to split your code into different files. As i started with
> shoes, this took me some time to get how it could work.
> - When we talk about models, ActiveRecord should *really* be shipped
> with shoes by default! i use AR with shoes standalone, but a built-in
> solution would be better i think.

Shoes is for beginners. A Teaching tool.  You are not a beginner and
active record does work for you. Inclusion of AR or your kioku gem would
help to do what? They struggle to get a button and a para working.

> - For beginners, i would recommend to use a simple key-value-store,
> just to get stuff saved on disk without thinking about data structures
> too much. I personally would suggest the "kioku" gem, as i am the
> maintainer ;)
> - it should be easy to run tests (unit or cucumber or ...) against
> those structured files. seems hard to to BDD with shoes in the current
> state in my opinion.

You want Shoes to be what you want it to be. Understandable. Many people
want shoes to be something else. Some people are working on the testing
interfaces. Mostly in OSX but so you can contribute.
> 
> 
> Before I forget: As I use shoes on Ubuntu/Linux and Windows
> XP/Vista/7, there are some things i wish to be solved for the next
> release ;)
> - video support on linux! even building an mp3-player is funny now...
This is a difficult problem. Shoes with vlc support uses an old API. Not
that big a problem? Until you see how Shoes did it. Video support in
Linux depends the vlc you happen to have installed in Ubuntu which could
be and has been different that what what Shoes expects. It gets more
complicated when dealing with OSX and Windows. I'd like to find a
solution but we haven't yet
> - vista: black screens, ... but vista itself is dead, not important
> for me.
A known problem but there aren't aren't any Windows savvy developers
willing to fix it.
> - windows: the included version of rubygems ist still too old. 
I think this will be fixed, but see below
> - would it be possible to package an app with a custom app-icon? :D
Seems doable and useful but
> - packager needs some love in general i'd say.
You are too kind in your assessment. Packager was broken six ways to
Sunday, IMO. A few of us care deeply about that. Eric is working on the
OSX issues and since no one else will fix the Windows issues, I'm trying
to cross compile to MingW from Linux just so I can fix the some Windows
packager problems. Thats a long road and windy road but rest assured the
packager is not ignored. Everyone on the mailing lists knows my passion
for it. If only there was a Window savvy person with mingw and msys
installed?
>  
> 
> This all is NOT meant as critic, i really love shoes! Use it since
> nearly 2 years and for several little projects. This are just problems
> i want to speak about, in other words: some feedback from a widely
> happy user
Not taken as a criticism. A Bug report and wish list. The custom icon
for packaged apps shouldn't be that hard to do. Please file that request
on the github issues page so we don't forget and rest assured, I will
beat the packager drum until its fixed or I'm voted off the island.

MVC? The beauty of Shoes is that it doesn't burden beginners with MVC!
That is what makes it easy to use. One can easily go past what Shoes was
intended to be. I've done it. We've all done it. We all know you can't
throw a thousand para's into a slot. Red Shoes or Green Shoes just
chokes on that. If that's what you want to do in MVC purity, try WxRuby.
with a very different but MVC friendly and better performing widgets but
without the the sugar coating of Shoes. Shoes wont scale up, it was
never intended too and it probably shouldn't. IMHO. Then again. it is
open source so it can go wherever you are willing go make it go.





Re: [shoes] MVC Architecture?

From:
Maximilian Stroh
Date:
2012-01-16 @ 12:04
I should clarify my MVC thoughts:

I agree 100% that one benefit of shoes is that you have not to worry about
architecture stuff. Absolute Beginners also worry about very different
stuff as you mentioned. But this said, i believe there is a point when even
a beginner wants to code a little more then a hello world sample. the app
begins to get bigger.

Then i'd introduce a really simple solution to split up the app in some
different files. A leightweight MVC approach would be best in this case (at
least this is what i believe). Many stuff from the software world is
nowadays structured in MVC-architectures, so this would also a benefit if
the shoes-scholar wants to dig into other frameworks.

It is not really an effort to change something within the shoes code, as i
mentioned i already work with some kind of a MVC pattern and shoes.

Why data storage matters? I'd say it is hard to code anything without even
have some basic configs you want to save, or say a little taskmanaging tool
which needs to save data, little stuff like this. I agree that it is not
necessary to include stuff by default to handle data, exspecially kioku is
pure ruby with no dependencys and should work in every environment. So, i
would use it either by set in in the Shoes.setup block. But beginners don't
know about data storing technologies, how they work and what to configure.
That's why I created kioku, to give absolute beginners a dead-easy solution
to just save stuff to disk and read it later. So my thought was, that with
kioku shoes beginners would have a good starting point about saving stuff
without having to read complex stuff. so far, i think it's enough about
kioku, replace this solution with any other you might want. But the core
idea is to give new programmers somethink very easy to save stuff.

When it comes to ActiveRecord: Shoes already has Sqlite3 included, so why
not AR? Seriously, it's not that important, everyone could just add this to
shoes by using this in the Shoes.app block. But here is the problem: the
included RubyGems version is too old to load AR. That's why i thought it
would be useful to integrate... meh.

Linux and Video: i think i know what you mean, and i for my own look for
some solutions to use this stuff in pure ruby, i'll tell when i found
something useful, okay? :)

The packager is one of the features that let shoes shine! i wish you
success to do this, as my skills in C are pretty bad i can not help doing
this i believe :(

As not being a developer for shoes, i still want to help out with shoes.
So, i have build dozens of little apps in shoes, for different use-cases
and people. Although i can't publish them as open source, i started to
collect some "best practices" from this projects how stuff worked best for
me.

Many months ago i IRC'ed with steve (maybe he remembers? :) ) about shoes,
and suggested that i could write a book (free) about shoes. Until now i
collected many experiences about use it in many situations and for various
tasks, also i taught shoes to many people at my university in germany. So,
i think it is time to write it all up in a structured way. I kickstart
beginners to be able to write smart little apps for some everyday uses,
with different technologies. This said, excuse me for some "strange"
whishes or ideas i am posting or will post in future ;)

One last thing: you said that shoes won't scale up. My answer: there is no
need to. IF everything described in the built-in manual would work as
written, everything further depends on how to use shoes. It would be nice
to have video/audio-support, but it is a nice feature, not a must-have.
i'll look into this as far as i have some more time. As my teaching
examples will flourish, i'll post some bugs or suggest some little stuff.
Maybe my feedback can in the meanwhile.

- Anonyfox

Re: [shoes] MVC Architecture?

From:
J. Kaiden
Date:
2012-01-16 @ 11:40
hi Maximillian,

  welcome to the list...

> - video support on linux! even building an mp3-player is funny now...
>

  for a short-term solution to audio and video support you can check out
this wiki about building shoes with gstreamer - works for me... (
https://github.com/lljk/shoes-stuff/wiki/Shoes-and-Gems-with-Native-Dependencies
)
 if you're running windows take a look here for help with installing the
gstreamer library - https://github.com/lljk/rubyWax/wiki/rubyWax-and-Windows -
sections III and IV.


> One can easily go past what Shoes was
> intended to be. I've done it. We've all done it. We all know you can't
> throw a thousand para's into a slot. Red Shoes or Green Shoes just
> chokes on that.
>

  if you use green_shoes, you can call gtk2 widgets directly from the main
Shoes.app, or subclass them as separate widgets - i'll have examples of
that up before long, but it's really easy.

  Shoes On!

  - j

Re: [shoes] MVC Architecture?

From:
Maximilian Stroh
Date:
2012-01-16 @ 12:26
I'll look at this soon, thanks!

and: no, currently i use "red" shoes, for my apps green shoes seems to be
still rough around the edges, some stoff just don't work as i want it to.
but every once and now i re-try stuff with the green shoes variant. if
usable, i'll also try things with the new brown_shoes. but for now, red
shoes is my way to go.

2012/1/16 J. Kaiden <jakekaiden@gmail.com>

> hi Maximillian,
>
>   welcome to the list...
>
> > - video support on linux! even building an mp3-player is funny now...
>>
>
>   for a short-term solution to audio and video support you can check out
> this wiki about building shoes with gstreamer - works for me... (
> 
https://github.com/lljk/shoes-stuff/wiki/Shoes-and-Gems-with-Native-Dependencies
)
>  if you're running windows take a look here for help with installing the
> gstreamer library -
> https://github.com/lljk/rubyWax/wiki/rubyWax-and-Windows - sections III
> and IV.
>
>
>> One can easily go past what Shoes was
>> intended to be. I've done it. We've all done it. We all know you can't
>> throw a thousand para's into a slot. Red Shoes or Green Shoes just
>> chokes on that.
>>
>
>   if you use green_shoes, you can call gtk2 widgets directly from the main
> Shoes.app, or subclass them as separate widgets - i'll have examples of
> that up before long, but it's really easy.
>
>   Shoes On!
>
>   - j
>

Re: [shoes] MVC Architecture?

From:
Date:
2012-01-16 @ 09:30
Hi Anonyfox, you’r probably right about the MVC stuff but I would ask to 
eventually make this an option, not a fact to be taken.

I think of Shoes as a way to quickly make small apps without any fuss, for
the desktop, usually in one file.

If I want to make a structured bigger webapp I would consider Rails or the
RuGui mentioned in last posts but I’d have to study first and invest a lot
of time before I get everything going. For the moment I’m looking into 
Sinatra to do small web-apps.

 

What concerns the wishlist for features, don’t want to put any more stress
on the devs since they have more work than appreciation and I think it 
were better to make a new thread for that but here is mine

-       Making text selectable and copyable also outside edit_line

-       A way to render basic HTML in a slot (I know I’m dreaming here)

 

Ashbb, thanks for taking time to optimize my spottify lookup app, I’m 
looking forward to try it this evening.

 

Peter

 

Re: [shoes] MVC Architecture?

From:
Maximilian Stroh
Date:
2012-01-16 @ 09:46
I confirm about shoes in general. Everyone SHOULD be able to hack together
a small app in one file without learning MVC stuff. But i believe it's
possible to give shoes the possibility to structure your code in files. I
mean, often start coding a single-file app, but when it comes to refactor
or make the gui prettier or implement more features, the file just becomes
too large. The only way i found it works for me now is the following:
- Everything in the main window what interacts in some way is a widget,
which i define in separate files (one per widget) in a subfolder (the
"view")
- Everything logical is held in good old ruby classes
- Data Storage (if necessary) is done via ActiveRecord Classes, or via
kioku which is simple enough to use directly everywhere. This is my "M".

As you can see, i try to work in the MVC way, but this doesn't mean that
everyone should do so. BUT a general guideline how to separate your code
when the app becomes bigger would be recommended i think. A problem for me
in the way I organize my code is actually, that the "url" feature for
switching between files doesn't work. My workaround is to make a widget for
every "window" and switch them in the only main window. feels ugly :(

- Anonyfox

2012/1/16 <peter.marien@cm.be>

> Hi Anonyfox, you’r probably right about the MVC stuff but I would ask to
> eventually make this an option, not a fact to be taken.****
>
> I think of Shoes as a way to quickly make small apps without any fuss, for
> the desktop, usually in one file.****
>
> If I want to make a structured bigger webapp I would consider Rails or the
> RuGui mentioned in last posts but I’d have to study first and invest a lot
> of time before I get everything going. For the moment I’m looking into
> Sinatra to do small web-apps.****
>
> ** **
>
> What concerns the wishlist for features, don’t want to put any more stress
> on the devs since they have more work than appreciation and I think it were
> better to make a new thread for that but here is mine****
>
> **-       **Making text selectable and copyable also outside edit_line****
>
> **-       **A way to render basic HTML in a slot (I know I’m dreaming
> here)****
>
> ** **
>
> Ashbb, thanks for taking time to optimize my spottify lookup app, I’m
> looking forward to try it this evening.****
>
> ** **
>
> Peter****
>
> ** **
>

Re: [shoes] MVC Architecture?

From:
ashbb
Date:
2012-01-16 @ 11:31
Hi Anonyfox,

> this is my subscribe mail to the mailing list.
Wow, welcome!

> Everything in the main window what interacts in some way is a widget,
> which i define in separate files (one per widget) in a subfolder
> (the "view")
You are using the word 'widget'.
Does that mean Shoes::Widget class?
If so, you don't have to use Shoes::Widget class.
If you want to separate a large file, you can use Modules.

> PS: oh and ashbb; 'gshoes -m' fails at my machine :(
Ah,...
On Linux?, Windows?, or both?
Let me know the error message, please.

ashbb

Re: [shoes] MVC Architecture?

From:
Maximilian Stroh
Date:
2012-01-16 @ 12:16
@ashbb
Currently, I sublass Shoes::Widget. For example see
http://pastie.org/3194604
A very trivial sample. If there is a better way to create clean widgets,
please tell me. I collect the best practices!

Shoes -m: see  this http://pastie.org/3194619
(Ubuntu Linux 11.10 with Unity)

2012/1/16 ashbb <ashbbb@gmail.com>

> Hi Anonyfox,
>
>
> > this is my subscribe mail to the mailing list.
> Wow, welcome!
>
>
> > Everything in the main window what interacts in some way is a widget,
> > which i define in separate files (one per widget) in a subfolder
> > (the "view")
> You are using the word 'widget'.
> Does that mean Shoes::Widget class?
> If so, you don't have to use Shoes::Widget class.
> If you want to separate a large file, you can use Modules.
>
>
> > PS: oh and ashbb; 'gshoes -m' fails at my machine :(
> Ah,...
> On Linux?, Windows?, or both?
> Let me know the error message, please.
>
> ashbb
>
>

Re: [shoes] MVC Architecture?

From:
ashbb
Date:
2012-01-16 @ 12:56
Hi Anonyfox,

> For example see http://pastie.org/3194604
> A very trivial sample. If there is a better way to create clean widgets,
please tell me.
Look at this: http://pastie.org/3194706
I'm not sure that is a better way, but not necessary to use Shoes::Widget.

> Shoes -m: see  this http://pastie.org/3194619
> (Ubuntu Linux 11.10 with Unity)
Oh, sorry, I didn't mention about that.
On Linux and OSX, in order to launch built-in manual, you have to install
hpricot by hand (i.e. gem install hpricot).

ashbb

Re: [shoes] MVC Architecture?

From:
Maximilian Stroh
Date:
2012-01-16 @ 13:04
Okay, installed hpricot in the gemset, manual works, thanks!

in the widget pastie: as i can see, then i have a "top level" draw_normal
(or draw_hovered) method? this would be strange if there are many widgets
with method of the same name... or didn't i get something?

2012/1/16 ashbb <ashbbb@gmail.com>

> Hi Anonyfox,
>
>
> > For example see http://pastie.org/3194604
> > A very trivial sample. If there is a better way to create clean widgets,
> please tell me.
> Look at this: http://pastie.org/3194706
> I'm not sure that is a better way, but not necessary to use Shoes::Widget.
>
>
> > Shoes -m: see  this http://pastie.org/3194619
> > (Ubuntu Linux 11.10 with Unity)
> Oh, sorry, I didn't mention about that.
> On Linux and OSX, in order to launch built-in manual, you have to install
> hpricot by hand (i.e. gem install hpricot).
>
> ashbb
>

Re: [shoes] MVC Architecture?

From:
ashbb
Date:
2012-01-16 @ 16:03
Hi Anonyfox,

> this would be strange if there are many widgets with method of the same
name

Exactly! You are right.
Okay, how about this one? http://pastie.org/3195654

Not so simple, but not use Shoes magic (i.e. Shoes::Widget). Just a ruby
program. ;-)

ashbb

Re: [shoes] MVC Architecture?

From:
Maximilian Stroh
Date:
2012-01-16 @ 16:18
whoa, ashbb!

i must go through it when i'm @home, but...
do you believe this is what i should teach programming beginners? ;)

i mean, this is heavy for someone just wants to get a first widget... :D

2012/1/16 ashbb <ashbbb@gmail.com>

> Hi Anonyfox,
>
>
> > this would be strange if there are many widgets with method of the same
> name
>
> Exactly! You are right.
> Okay, how about this one? http://pastie.org/3195654
>
> Not so simple, but not use Shoes magic (i.e. Shoes::Widget). Just a ruby
> program. ;-)
>
> ashbb
>

Re: [shoes] MVC Architecture?

From:
Peter Fitzgibbons
Date:
2012-01-16 @ 17:30
Am I missing something?
Creating a custom Widget is definitely *not* newbie programming.

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

Re: [shoes] MVC Architecture?

From:
Maximilian Stroh
Date:
2012-01-16 @ 18:07
Right, this is something for more advanced users. This is also something
very very useful to unleash the power of shoes. This said, i just look for
the easiest or "best" solution to do this.

I don't like writing just another simple hello world sample. I want to
cover some advanced techniques so a beginner is able to code useful things
in shoes. (obviously i start very very simple, but then there should be a
learning curve to nice, interactive stuff.)
Am 16.01.2012 18:31 schrieb "Peter Fitzgibbons" <peter.fitzgibbons@gmail.com
>:

> Am I missing something?
> Creating a custom Widget is definitely *not* newbie programming.
>
> Peter Fitzgibbons
> (847) 859-9550
> Email: peter.fitzgibbons@gmail.com
> IM GTalk: peter.fitzgibbons
> IM AOL: peter.fitzgibbons@gmail.com
>
>

Re: [shoes] MVC Architecture?

From:
J. Kaiden
Date:
2012-01-16 @ 21:12
hi Max -

  agreed, creating custom widgets is not necessarily for beginners, but
it's also not *that* big a deal - and i think it's important to point out
(even to beginners) the ability to do so.

  i put up a wiki a while back (shameless plug) that talks about creating
custom widgets in red shoes, should be fairly basic stuff for an advanced
beginner - https://github.com/lljk/shoes-stuff/wiki/Shoes-Widgets.  as i
mentioned, i'm also working on one for using custom gtk widgets in
green_shoes - which is probably a bit more advanced.

  as far as breaking up code - i don't see how this is a big deal...  i
regularly break my code up into several files and use them all from the
Shoes main app - is there something difficult that i'm missing?  i use YAML
for data storage - it's easy, and included in the ruby libraries, so works
for me just fine....

  Shoes On!

  - j

Re: [shoes] MVC Architecture?

From:
Maximilian Stroh
Date:
2012-01-16 @ 21:22
Oh, nice! I'll look into this wiki tomorrow! (it's late evening here in
germany ;) )

Of course, breaking up code itself is not that hard. But when it comes to
the question "how", then i try to find a effective and intuitive way. some
kind of very lightweight MVC is the concept i am thinking about. just
enough to explain it in an easy way.

YAML for serializing data is exactly what kioku does. at the moment nothing
special, i requested for wanted features at the ruby-forum.com, but there
were no replies until now. anyway, i am working at this project from time
to time, so i hope for a 1.0 version until next whyday :)

So, you aren't missing something difficult. I just think about some kind of
best practices for different situations.

- Anonyfox

2012/1/16 J. Kaiden <jakekaiden@gmail.com>

> hi Max -
>
>   agreed, creating custom widgets is not necessarily for beginners, but
> it's also not *that* big a deal - and i think it's important to point out
> (even to beginners) the ability to do so.
>
>   i put up a wiki a while back (shameless plug) that talks about creating
> custom widgets in red shoes, should be fairly basic stuff for an advanced
> beginner - https://github.com/lljk/shoes-stuff/wiki/Shoes-Widgets.  as i
> mentioned, i'm also working on one for using custom gtk widgets in
> green_shoes - which is probably a bit more advanced.
>
>   as far as breaking up code - i don't see how this is a big deal...  i
> regularly break my code up into several files and use them all from the
> Shoes main app - is there something difficult that i'm missing?  i use YAML
> for data storage - it's easy, and included in the ruby libraries, so works
> for me just fine....
>
>   Shoes On!
>
>   - j
>

Re: [shoes] MVC Architecture?

From:
J. Kaiden
Date:
2012-01-16 @ 23:53
hey Max,

  kioku looks neat - i'll check it out...

 some kind of very lightweight MVC is the concept i am thinking about. just
> enough to explain it in an easy way.
>
... I just think about some kind of best practices for different situations.
>

  agreed - making things easy (and awesome) is what it's all about!

  one thing i would like to see, and to help with (because with the other
stuff i'm useless!) is better documentation and tutorials for Shoes and all
the various colors.  there's the manual which is useful, and there's a lot
of great information already out there, but it's pretty fragmented at this
point, and there are some pretty big gaps.  you mentioned writing
something, and i've thought of (and done a bit of) the same.  a new thread
might be in order, but i'd be interested in finding folks to collaborate on
something big enough to be useful.

  - j