WebStyle <---> WebApplication

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

WebStyle <---> WebApplication

Edward Stow
Hi,

I'm continuing on my aida investigation -- and have just struck the
WebStyle and WebApplication classes.


My question, first up,  how would you create two or more WebStyles for
a site? and apply these to particular pages (or rather WebApplication
objects.)

My question led me to investigate WebApplication and WebStyle a bit
more closely.  These two  classes seem very coupled and because of the
obscuring (imho) #dnu: implementation ... that redirects many, many
messages to the style class it makes it difficult to understand the
framework.

WebApplication>>doesNotUnderstand: aMessage
        "forward a message to a style for processing"
        ^self style
                perform: aMessage selector
                withArguments: aMessage arguments

My troubles began in the tutorial and the #pageFrameWith:title:

    viewMain
        | e |
        e := WebElement new.
        e addTextH1: 'Address book'.
        self pageFrameWith: e title: 'Address book'

 I guessed that #pageFrameWith:title: must be setting up the page
layout (the header, menus etc) but was surprised to find that
#pageFrameWith:title: was not implemented in the WebApplication
hierarchy.   Why not directly send the message to the WebStyle object
(and it is less expensive cpu wise) such as:

        self style pageFrameWith: e title: 'Address book'

WebStyle seems to me to incorporate at least the following features:
 -- setup a page template for the *Aida tutorial* site (the  page
headers, footers, navigation bars etc)
-- establish assets for the site (html header information - css files,
images files, script files)

Subclassing WebStyle to create my own web site page template is very
messy (as per the Joomla example ..)

Sorry for the long message -- in part I need to document these issues
to better understand them myself.

--

Edward Stow
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Janko Mivšek
Hi Edward,

Edward Stow wrote:

> My question, first up,  how would you create two or more WebStyles for
> a site? and apply these to particular pages (or rather WebApplication
> objects.)

So far no. WebStyle is originally meant to separate design from site to
site on multi-site hosting environments. For instance I'm running such a
VW image with 35 sites and each such site has its own subclass of WebStyle.

But why would you actually need WebStyle for each App?

> My question led me to investigate WebApplication and WebStyle a bit
> more closely.  These two  classes seem very coupled and because of the
> obscuring (imho) #dnu: implementation ... that redirects many, many
> messages to the style class it makes it difficult to understand the
> framework.

Yes, this one is funny on first sight but very powerful after you
understand it. In a way It extends Apps to a WebStyle, but for each site
differently. But on the other side is hard to debug and hard to
understand for a newbie. Actually calling style methods explicitly:

                anApp style pageFrameWith:title:

is the best way to go and I'll actually change all my code to use this
#style method. Thanks for comming out with that idea!

This method was introduced recently, which is the reason of non-use so far.

>
> WebApplication>>doesNotUnderstand: aMessage
> "forward a message to a style for processing"
> ^self style
> perform: aMessage selector
> withArguments: aMessage arguments
>
> My troubles began in the tutorial and the #pageFrameWith:title:
>
>     viewMain
>         | e |
>         e := WebElement new.
>         e addTextH1: 'Address book'.
>         self pageFrameWith: e title: 'Address book'
>
>  I guessed that #pageFrameWith:title: must be setting up the page
> layout (the header, menus etc) but was surprised to find that
> #pageFrameWith:title: was not implemented in the WebApplication
> hierarchy.   Why not directly send the message to the WebStyle object
> (and it is less expensive cpu wise) such as:
>
>         self style pageFrameWith: e title: 'Address book'
>
> WebStyle seems to me to incorporate at least the following features:
>  -- setup a page template for the *Aida tutorial* site (the  page
> headers, footers, navigation bars etc)
> -- establish assets for the site (html header information - css files,
> images files, script files)

Web site stye in Aida don't mean just CSS, but also a basic layout of
the page, which is usually HTML. That's why you'll find many basic page
components defined in WebStyle sublcass, not in app. Specially those
components, which appear on every page. Reusable components, if you like.

Current WebStyle should better be named as DefaultWebStyle and be
subclasses from an abstract WebStyle. WebStyle would be just with
support methods and maybe some default ones like #pageFrameWith: . That
way it would be easier to subclass by your needs.

> Subclassing WebStyle to create my own web site page template is very
> messy (as per the Joomla example ..)

It's true, for instance currently nulifying superclass css methods needs
to copy and make them return empty string here. Very inpracticall. We
need to finally implement that #addSuperStyles for breaking the
additions of superclass css methods to the final css.

> Sorry for the long message -- in part I need to document these issues
> to better understand them myself.

And we need such questions to improve our docs!

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Giuseppe
Hi Jano, list,

I think, he is talking about 2 webstyles in one app.

In web terms. Think on squeak.org page, I think he is talking about a  
style for Home, other for Download, etc.....

El 01/04/2008, a las 20:35, Janko Mivšek escribió:

> Hi Edward,
>
> Edward Stow wrote:
>
>> My question, first up,  how would you create two or more WebStyles  
>> for
>> a site? and apply these to particular pages (or rather WebApplication
>> objects.)
>
> So far no. WebStyle is originally meant to separate design from site  
> to
> site on multi-site hosting environments. For instance I'm running  
> such a
> VW image with 35 sites and each such site has its own subclass of  
> WebStyle.
>
> But why would you actually need WebStyle for each App?

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Edward Stow
On Wed, Apr 2, 2008 at 5:49 AM, Giuseppe Luigi Punzi Ruiz
<[hidden email]> wrote:
> Hi Jano, list,
>
>  I think, he is talking about 2 webstyles in one app.
>
>  In web terms. Think on squeak.org page, I think he is talking about a
>  style for Home, other for Download, etc....

Yes precisely ... that is exactly what I mean.
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Nicolas Petton
In reply to this post by Janko Mivšek

Le mardi 01 avril 2008 à 20:35 +0200, Janko Mivšek a écrit :

> Hi Edward,
>
> Edward Stow wrote:
>
> > My question, first up,  how would you create two or more WebStyles for
> > a site? and apply these to particular pages (or rather WebApplication
> > objects.)
>
> So far no. WebStyle is originally meant to separate design from site to
> site on multi-site hosting environments. For instance I'm running such a
> VW image with 35 sites and each such site has its own subclass of WebStyle.
>
> But why would you actually need WebStyle for each App?
>
> > My question led me to investigate WebApplication and WebStyle a bit
> > more closely.  These two  classes seem very coupled and because of the
> > obscuring (imho) #dnu: implementation ... that redirects many, many
> > messages to the style class it makes it difficult to understand the
> > framework.
>
> Yes, this one is funny on first sight but very powerful after you
> understand it. In a way It extends Apps to a WebStyle, but for each site
> differently. But on the other side is hard to debug and hard to
> understand for a newbie. Actually calling style methods explicitly:
>
> anApp style pageFrameWith:title:
>
> is the best way to go and I'll actually change all my code to use this
> #style method. Thanks for comming out with that idea!
I personnaly like self pageFrameWith:title:, it is shorter, and use this
very cool overriding of #doesnotunderstand: :)

>
> This method was introduced recently, which is the reason of non-use so far.
>
> >
> > WebApplication>>doesNotUnderstand: aMessage
> > "forward a message to a style for processing"
> > ^self style
> > perform: aMessage selector
> > withArguments: aMessage arguments
> >
> > My troubles began in the tutorial and the #pageFrameWith:title:
> >
> >     viewMain
> >         | e |
> >         e := WebElement new.
> >         e addTextH1: 'Address book'.
> >         self pageFrameWith: e title: 'Address book'
> >
> >  I guessed that #pageFrameWith:title: must be setting up the page
> > layout (the header, menus etc) but was surprised to find that
> > #pageFrameWith:title: was not implemented in the WebApplication
> > hierarchy.   Why not directly send the message to the WebStyle object
> > (and it is less expensive cpu wise) such as:
> >
> >         self style pageFrameWith: e title: 'Address book'
> >
> > WebStyle seems to me to incorporate at least the following features:
> >  -- setup a page template for the *Aida tutorial* site (the  page
> > headers, footers, navigation bars etc)
> > -- establish assets for the site (html header information - css files,
> > images files, script files)
>
> Web site stye in Aida don't mean just CSS, but also a basic layout of
> the page, which is usually HTML. That's why you'll find many basic page
> components defined in WebStyle sublcass, not in app. Specially those
> components, which appear on every page. Reusable components, if you like.
>
> Current WebStyle should better be named as DefaultWebStyle and be
> subclasses from an abstract WebStyle. WebStyle would be just with
> support methods and maybe some default ones like #pageFrameWith: . That
> way it would be easier to subclass by your needs.
I'm working on this. It's almost done, but not committed yet (sorry
about that). I'm also working on a new class WebLibrary, to delegate a
bit. (WebStyle is really overloaded).
>
> > Subclassing WebStyle to create my own web site page template is very
> > messy (as per the Joomla example ..)
>
> It's true, for instance currently nulifying superclass css methods needs
> to copy and make them return empty string here. Very inpracticall. We
> need to finally implement that #addSuperStyles for breaking the
> additions of superclass css methods to the final css.

Will this be needed when we will have an abstract WebStyle class ?

Cheers!

Nico

>
> > Sorry for the long message -- in part I need to document these issues
> > to better understand them myself.
>
> And we need such questions to improve our docs!
>

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Edward Stow
On Wed, Apr 2, 2008 at 8:06 AM, Nicolas Petton <[hidden email]> wrote:

>
>  Le mardi 01 avril 2008 à 20:35 +0200, Janko Mivšek a écrit :
>
> > Hi Edward,
>  >
>  > Edward Stow wrote:
>  >
>  > > My question, first up,  how would you create two or more WebStyles for
>  > > a site? and apply these to particular pages (or rather WebApplication
>  > > objects.)
>  >
>  > So far no. WebStyle is originally meant to separate design from site to
>  > site on multi-site hosting environments. For instance I'm running such a
>  > VW image with 35 sites and each such site has its own subclass of WebStyle.
>  >
>  > But why would you actually need WebStyle for each App?
>  >
>  > > My question led me to investigate WebApplication and WebStyle a bit
>  > > more closely.  These two  classes seem very coupled and because of the
>  > > obscuring (imho) #dnu: implementation ... that redirects many, many
>  > > messages to the style class it makes it difficult to understand the
>  > > framework.
>  >
>  > Yes, this one is funny on first sight but very powerful after you
>  > understand it. In a way It extends Apps to a WebStyle, but for each site
>  > differently. But on the other side is hard to debug and hard to
>  > understand for a newbie. Actually calling style methods explicitly:
>  >
>  >               anApp style pageFrameWith:title:
>  >
>  > is the best way to go and I'll actually change all my code to use this
>  > #style method. Thanks for comming out with that idea!
>
>  I personnaly like self pageFrameWith:title:, it is shorter, and use this
>  very cool overriding of #doesnotunderstand: :)

#doesNotUnderstand:  should come with a warning about the consequences
for its use.  I'm sure that smalltalkers much wiser than me have
expressed similiar sentiments.

To make matters even worse in WebStyle you send message to the app
that are then delegated back to WebStyle via the #dnu: mechanism.

WebStyle>>pageFrameWith: aWebElement wide: aWideElement title: aTitleString
        "set a web page with standard  page look (navigation bar, header) "
        "Wide element comes below content besides navigation and it have full
page width"
        | element |
        self app clear;  title: aTitleString. self app htmlHeaderElements.
" self app add: self headerBanner. "
        element := (WebElement newId: #container)

#htmlHeaderElements is implemented in WebStyle and so this would be better:

        self app clear;  title: aTitleString. self  htmlHeaderElements.

This was the second method that I looked at in WebStyle so I don't
know how prevalent this anti-pattern is in the code.

--
Edward
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Nicolas Petton
In reply to this post by Giuseppe

Le mardi 01 avril 2008 à 20:49 +0200, Giuseppe Luigi Punzi Ruiz a
écrit :
> Hi Jano, list,
>
> I think, he is talking about 2 webstyles in one app.

You can use different pageFrameWith: like methods for different kind of
apps, for example #pageFrameWith:title, #blogPageFrameWith:title and so
on.

Nico

>
> In web terms. Think on squeak.org page, I think he is talking about a  
> style for Home, other for Download, etc.....
>
> El 01/04/2008, a las 20:35, Janko Mivšek escribió:
>
> > Hi Edward,
> >
> > Edward Stow wrote:
> >
> >> My question, first up,  how would you create two or more WebStyles  
> >> for
> >> a site? and apply these to particular pages (or rather WebApplication
> >> objects.)
> >
> > So far no. WebStyle is originally meant to separate design from site  
> > to
> > site on multi-site hosting environments. For instance I'm running  
> > such a
> > VW image with 35 sites and each such site has its own subclass of  
> > WebStyle.
> >
> > But why would you actually need WebStyle for each App?
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Edward Stow
On Wed, Apr 2, 2008 at 8:08 AM, Nicolas Petton <[hidden email]> wrote:

>
>  Le mardi 01 avril 2008 à 20:49 +0200, Giuseppe Luigi Punzi Ruiz a
>  écrit :
>
> > Hi Jano, list,
>  >
>  > I think, he is talking about 2 webstyles in one app.
>
>  You can use different pageFrameWith: like methods for different kind of
>  apps, for example #pageFrameWith:title, #blogPageFrameWith:title and so
>  on.
>
>  Nico

Yes that would work ... should have thought of the obvious solution,
possibly using a decorators on my base WebStyle to provide the
individual features needed for each page layout.

>
>
> >
>  > In web terms. Think on squeak.org page, I think he is talking about a
>  > style for Home, other for Download, etc.....
>  >
>  > El 01/04/2008, a las 20:35, Janko Mivšek escribió:
>  >
>  > > Hi Edward,
>  > >
>  > > Edward Stow wrote:
>  > >
>  > >> My question, first up,  how would you create two or more WebStyles
>  > >> for
>  > >> a site? and apply these to particular pages (or rather WebApplication
>  > >> objects.)
>  > >
>  > > So far no. WebStyle is originally meant to separate design from site
>  > > to
>  > > site on multi-site hosting environments. For instance I'm running
>  > > such a
>  > > VW image with 35 sites and each such site has its own subclass of
>  > > WebStyle.
>  > >
>  > > But why would you actually need WebStyle for each App?
>  >
>  > _______________________________________________
>  > Aida mailing list
>  > [hidden email]
>  > http://lists.aidaweb.si/mailman/listinfo/aida
>
> _______________________________________________
>  Aida mailing list
>  [hidden email]
>  http://lists.aidaweb.si/mailman/listinfo/aida
>
>



--

Edward Stow
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Janko Mivšek
In reply to this post by Edward Stow
Edward Stow wrote:

> #doesNotUnderstand:  should come with a warning about the consequences
> for its use.  I'm sure that smalltalkers much wiser than me have
> expressed similiar sentiments.

In Aida we use two such tricks and both you discover immediately :) One
is #dnu to connect Apps with WebStyle, other is so called "climbing on
the stack" (my term) which finds a reference to the App or session on
which you are currently building the page, in case you don't have other
means to find it. #app method is such one. More below.

About #dnu, I agree with you, it is dangerous for everyday use but
acceptable if used carefully in frameworks like Aida. Specially if it is
hidden enough from average user. Here we can argue that in Aida is too
obvious. Maybe. But we can improve (that is hide it) by using a #style
method where possible. Maybe can even go without #dnu now at all? Let we
inspect that possibility a bit.

> To make matters even worse in WebStyle you send message to the app
> that are then delegated back to WebStyle via the #dnu: mechanism.

#app should delegate to Object>>firstAppFromStack if it can't find app
otherwise. I'll investigate that later.

> WebStyle>>pageFrameWith: aWebElement wide: aWideElement title: aTitleString
> "set a web page with standard  page look (navigation bar, header) "
> "Wide element comes below content besides navigation and it have full
> page width"
> | element |
> self app clear;  title: aTitleString. self app htmlHeaderElements.
> " self app add: self headerBanner. "
> element := (WebElement newId: #container)
>
> #htmlHeaderElements is implemented in WebStyle and so this would be better:
>
> self app clear;  title: aTitleString. self  htmlHeaderElements.
>
> This was the second method that I looked at in WebStyle so I don't
> know how prevalent this anti-pattern is in the code.

As Nicolas said this is hardly called antipattern, just that it is maybe
too obvious/not enough hidden from the user. But really, let we come to
the better solution if possible. Nicolas already proposed to move
#pageFrameWith:title: to WebApplciation to be easily found, you proposed
  strict use of #style, any more idea?

Best regards
Janko


--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Rob Rothwell
As Nicolas said this is hardly called antipattern, just that it is maybe
too obvious/not enough hidden from the user. But really, let we come to
the better solution if possible. Nicolas already proposed to move
#pageFrameWith:title: to WebApplciation to be easily found, you proposed
 strict use of #style, any more idea?

Honestly, I'm just trying to keep up with all the knowledge that is flying back and forth and trying to put together some coherent documents.

I'm on a mission to document...!

Since I am trying to combine the stuff you are explaining to people from many questions, I will send you what I come up with before I actually put anything on the site so as not to put anything incorrect there.

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Janko Mivšek
Hi Rob,

Rob Rothwell wrote:

> Honestly, I'm just trying to keep up with all the knowledge that is
> flying back and forth and trying to put together some coherent documents.
>
> I'm on a mission to document...!
>
> Since I am trying to combine the stuff you are explaining to people from
> many questions, I will send you what I come up with before I actually
> put anything on the site so as not to put anything incorrect there.

Just write documentation directly on the website, then announce it here
and we will make a revision. Don't worry, currently its better that we
have something, not that it is 100% precise. This will come later.

Thank you very much for docs work!

Janko

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Edward Stow
In reply to this post by Rob Rothwell
On Wed, Apr 2, 2008 at 8:57 AM, Rob Rothwell <[hidden email]> wrote:

>
> > As Nicolas said this is hardly called antipattern, just that it is maybe
> > too obvious/not enough hidden from the user. But really, let we come to
> > the better solution if possible. Nicolas already proposed to move
> > #pageFrameWith:title: to WebApplciation to be easily found, you proposed
> >  strict use of #style, any more idea?
> >
>
> Honestly, I'm just trying to keep up with all the knowledge that is flying
> back and forth and trying to put together some coherent documents.
>
>
> I'm on a mission to document...!

Rob,  I noted from your earlier posts that were new to smalltalk ---
so coming to grips with the reflection capabilities of smalltalk -- is
understandably confusing at first.  And probably not necessary for
users of the framework.


--

Edward Stow
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Rob Rothwell
In reply to this post by Janko Mivšek
On Tue, Apr 1, 2008 at 6:17 PM, Janko Mivšek <[hidden email]> wrote:
Just write documentation directly on the website, then announce it here
and we will make a revision. Don't worry, currently its better that we
have something, not that it is 100% precise. This will come later.

Ok...I'll try not to mess too many things up!

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Nicolas Petton
In reply to this post by Edward Stow

Le mercredi 02 avril 2008 à 07:05 +1100, Edward Stow a écrit :

> On Wed, Apr 2, 2008 at 8:06 AM, Nicolas Petton <[hidden email]> wrote:
> >
> >  Le mardi 01 avril 2008 à 20:35 +0200, Janko Mivšek a écrit :
> >
> > > Hi Edward,
> >  >
> >  > Edward Stow wrote:
> >  >
> >  > > My question, first up,  how would you create two or more WebStyles for
> >  > > a site? and apply these to particular pages (or rather WebApplication
> >  > > objects.)
> >  >
> >  > So far no. WebStyle is originally meant to separate design from site to
> >  > site on multi-site hosting environments. For instance I'm running such a
> >  > VW image with 35 sites and each such site has its own subclass of WebStyle.
> >  >
> >  > But why would you actually need WebStyle for each App?
> >  >
> >  > > My question led me to investigate WebApplication and WebStyle a bit
> >  > > more closely.  These two  classes seem very coupled and because of the
> >  > > obscuring (imho) #dnu: implementation ... that redirects many, many
> >  > > messages to the style class it makes it difficult to understand the
> >  > > framework.
> >  >
> >  > Yes, this one is funny on first sight but very powerful after you
> >  > understand it. In a way It extends Apps to a WebStyle, but for each site
> >  > differently. But on the other side is hard to debug and hard to
> >  > understand for a newbie. Actually calling style methods explicitly:
> >  >
> >  >               anApp style pageFrameWith:title:
> >  >
> >  > is the best way to go and I'll actually change all my code to use this
> >  > #style method. Thanks for comming out with that idea!
> >
> >  I personnaly like self pageFrameWith:title:, it is shorter, and use this
> >  very cool overriding of #doesnotunderstand: :)
>
> #doesNotUnderstand:  should come with a warning about the consequences
> for its use.
Not necesseraly. In this case it is very powerful, and anyway if the
webstyle doesn't understand the message, an error will be raised.

This pattern (not an anti-pattern at all!) is used in other frameworks,
in other langages too. If you know Ruby and Rails, you know that
accessors are created on the fly this way. You may not agree, but it is
still useful IMHO.


>   I'm sure that smalltalkers much wiser than me have
> expressed similiar sentiments.

Again, I do not agree. Look at Object>>doesNotUnderstand: inherence and
you will see how many classes override this message to perform a special
pattern. Some example: ObjectExplorer, MagmaCollectionReader (from Magma
OODB), WAModelProxy (from Seaside), and so on.

>
> To make matters even worse in WebStyle you send message to the app
> that are then delegated back to WebStyle via the #dnu: mechanism.
>
> WebStyle>>pageFrameWith: aWebElement wide: aWideElement title: aTitleString
> "set a web page with standard  page look (navigation bar, header) "
> "Wide element comes below content besides navigation and it have full
> page width"
> | element |
> self app clear;  title: aTitleString. self app htmlHeaderElements.
> " self app add: self headerBanner. "
> element := (WebElement newId: #container)
>
> #htmlHeaderElements is implemented in WebStyle and so this would be better:
>
> self app clear;  title: aTitleString. self  htmlHeaderElements.
We agree here, it just would be simpler. I change that immediately,
thanks.


Nico
--
Nicolas Petton
http://nico.bioskop.fr
            ___
          ooooooo
         OOOOOOOOO
        |Smalltalk|
         OOOOOOOOO
          ooooooo
           \   /
            [|]
--------------------------------
Ma clé PGP est disponible ici :
http://nico.bioskop.fr/pgp-key.html

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Edward Stow
On Wed, Apr 2, 2008 at 9:28 AM, Nicolas Petton <[hidden email]> wrote:

>
>  Le mercredi 02 avril 2008 à 07:05 +1100, Edward Stow a écrit :
>
>
> > On Wed, Apr 2, 2008 at 8:06 AM, Nicolas Petton <[hidden email]> wrote:
>  > >
>  > >  Le mardi 01 avril 2008 à 20:35 +0200, Janko Mivšek a écrit :
>  > >
>  > > > Hi Edward,
>  > >  >
>  > >  > Edward Stow wrote:
>  > >  >
>  > >  > > My question, first up,  how would you create two or more WebStyles for
>  > >  > > a site? and apply these to particular pages (or rather WebApplication
>  > >  > > objects.)
>  > >  >
>  > >  > So far no. WebStyle is originally meant to separate design from site to
>  > >  > site on multi-site hosting environments. For instance I'm running such a
>  > >  > VW image with 35 sites and each such site has its own subclass of WebStyle.
>  > >  >
>  > >  > But why would you actually need WebStyle for each App?
>  > >  >
>  > >  > > My question led me to investigate WebApplication and WebStyle a bit
>  > >  > > more closely.  These two  classes seem very coupled and because of the
>  > >  > > obscuring (imho) #dnu: implementation ... that redirects many, many
>  > >  > > messages to the style class it makes it difficult to understand the
>  > >  > > framework.
>  > >  >
>  > >  > Yes, this one is funny on first sight but very powerful after you
>  > >  > understand it. In a way It extends Apps to a WebStyle, but for each site
>  > >  > differently. But on the other side is hard to debug and hard to
>  > >  > understand for a newbie. Actually calling style methods explicitly:
>  > >  >
>  > >  >               anApp style pageFrameWith:title:
>  > >  >
>  > >  > is the best way to go and I'll actually change all my code to use this
>  > >  > #style method. Thanks for comming out with that idea!
>  > >
>  > >  I personnaly like self pageFrameWith:title:, it is shorter, and use this
>  > >  very cool overriding of #doesnotunderstand: :)
>  >
>  > #doesNotUnderstand:  should come with a warning about the consequences
>  > for its use.
>  Not necesseraly. In this case it is very powerful, and anyway if the
>  webstyle doesn't understand the message, an error will be raised.
>
>  This pattern (not an anti-pattern at all!) is used in other frameworks,
>  in other langages too. If you know Ruby and Rails, you know that
>  accessors are created on the fly this way. You may not agree, but it is
>  still useful IMHO.

I have done similiar tricks -- for example on a Row Data Gateway [1]
to access attribute values from a relational dbms table. This usage is
a well known pattern / idiom for the #dnu.

[1] http://martinfowler.com/eaaCatalog/rowDataGateway.html

>
>  >   I'm sure that smalltalkers much wiser than me have
>  > expressed similiar sentiments.
>
>  Again, I do not agree. Look at Object>>doesNotUnderstand: inherence and
>  you will see how many classes override this message to perform a special
>  pattern. Some example: ObjectExplorer, MagmaCollectionReader (from Magma
>  OODB), WAModelProxy (from Seaside), and so on.
>
These examples are implementing a well known pattern(s).  EFor example
WAModelProxy is implementing a proxy that would be difficult without
the dnu.

ObjectExplorer will be doing massive amounts of introspection needed
to support the browsing of objects.

The usage in WebApplication is to delegate messages creating a sort of
mixin class with WebStyle.

I liked this from comp.lang.smalltalk some years ago:

"(Kent Beck had an interesting "koan" button at OOPSLA. It read "Will
override #doesNotUnderstand: for food!" What was most interesting was the
very different reactions it got from those doing Smalltalk for 1 year, 2-5
years, and 5+ years, which went something like "duh," knowing grin, and
pained expression, respectively!)" [2]

[2] http://groups.google.com/group/comp.lang.smalltalk/msg/85fb5f6714fa3d37?

and
David Buck points out some of the dangers [3]

[3] http://tinyurl.com/yrxy9p

and Travis Griggs some of the places that it is useful.

[4] http://tinyurl.com/yosjrs
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Rob Rothwell
In reply to this post by Edward Stow
On Tue, Apr 1, 2008 at 6:18 PM, Edward Stow <[hidden email]> wrote:
Rob,  I noted from your earlier posts that were new to smalltalk ---
so coming to grips with the reflection capabilities of smalltalk -- is
understandably confusing at first.  And probably not necessary for
users of the framework.

I understand it at a high level, and can probably "use" it in my own work, but reading the code of others is still more difficult for me.

Although, I have turned the corner where I can start "finding" methods on my own without too much help...

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Janko Mivšek
In reply to this post by Edward Stow
Hi Edward,

Thanks for all the pointers, I'll refresh myself on them tomorrow. Just
to know that I was aware of that dangers when introduced #dnu 6 years
ago and I definitely take care to not introduce such tricks just because
are cool, but because they are useful or even necessary. We will see if
#dnu it this case is necessary still.

JAnko

Edward Stow wrote:

> On Wed, Apr 2, 2008 at 9:28 AM, Nicolas Petton <[hidden email]> wrote:
>>  Le mercredi 02 avril 2008 à 07:05 +1100, Edward Stow a écrit :
>>
>>
>>> On Wed, Apr 2, 2008 at 8:06 AM, Nicolas Petton <[hidden email]> wrote:
>>  > >
>>  > >  Le mardi 01 avril 2008 à 20:35 +0200, Janko Mivšek a écrit :
>>  > >
>>  > > > Hi Edward,
>>  > >  >
>>  > >  > Edward Stow wrote:
>>  > >  >
>>  > >  > > My question, first up,  how would you create two or more WebStyles for
>>  > >  > > a site? and apply these to particular pages (or rather WebApplication
>>  > >  > > objects.)
>>  > >  >
>>  > >  > So far no. WebStyle is originally meant to separate design from site to
>>  > >  > site on multi-site hosting environments. For instance I'm running such a
>>  > >  > VW image with 35 sites and each such site has its own subclass of WebStyle.
>>  > >  >
>>  > >  > But why would you actually need WebStyle for each App?
>>  > >  >
>>  > >  > > My question led me to investigate WebApplication and WebStyle a bit
>>  > >  > > more closely.  These two  classes seem very coupled and because of the
>>  > >  > > obscuring (imho) #dnu: implementation ... that redirects many, many
>>  > >  > > messages to the style class it makes it difficult to understand the
>>  > >  > > framework.
>>  > >  >
>>  > >  > Yes, this one is funny on first sight but very powerful after you
>>  > >  > understand it. In a way It extends Apps to a WebStyle, but for each site
>>  > >  > differently. But on the other side is hard to debug and hard to
>>  > >  > understand for a newbie. Actually calling style methods explicitly:
>>  > >  >
>>  > >  >               anApp style pageFrameWith:title:
>>  > >  >
>>  > >  > is the best way to go and I'll actually change all my code to use this
>>  > >  > #style method. Thanks for comming out with that idea!
>>  > >
>>  > >  I personnaly like self pageFrameWith:title:, it is shorter, and use this
>>  > >  very cool overriding of #doesnotunderstand: :)
>>  >
>>  > #doesNotUnderstand:  should come with a warning about the consequences
>>  > for its use.
>>  Not necesseraly. In this case it is very powerful, and anyway if the
>>  webstyle doesn't understand the message, an error will be raised.
>>
>>  This pattern (not an anti-pattern at all!) is used in other frameworks,
>>  in other langages too. If you know Ruby and Rails, you know that
>>  accessors are created on the fly this way. You may not agree, but it is
>>  still useful IMHO.
>
> I have done similiar tricks -- for example on a Row Data Gateway [1]
> to access attribute values from a relational dbms table. This usage is
> a well known pattern / idiom for the #dnu.
>
> [1] http://martinfowler.com/eaaCatalog/rowDataGateway.html
>
>>  >   I'm sure that smalltalkers much wiser than me have
>>  > expressed similiar sentiments.
>>
>>  Again, I do not agree. Look at Object>>doesNotUnderstand: inherence and
>>  you will see how many classes override this message to perform a special
>>  pattern. Some example: ObjectExplorer, MagmaCollectionReader (from Magma
>>  OODB), WAModelProxy (from Seaside), and so on.
>>
> These examples are implementing a well known pattern(s).  EFor example
> WAModelProxy is implementing a proxy that would be difficult without
> the dnu.
>
> ObjectExplorer will be doing massive amounts of introspection needed
> to support the browsing of objects.
>
> The usage in WebApplication is to delegate messages creating a sort of
> mixin class with WebStyle.
>
> I liked this from comp.lang.smalltalk some years ago:
>
> "(Kent Beck had an interesting "koan" button at OOPSLA. It read "Will
> override #doesNotUnderstand: for food!" What was most interesting was the
> very different reactions it got from those doing Smalltalk for 1 year, 2-5
> years, and 5+ years, which went something like "duh," knowing grin, and
> pained expression, respectively!)" [2]
>
> [2] http://groups.google.com/group/comp.lang.smalltalk/msg/85fb5f6714fa3d37?
>
> and
> David Buck points out some of the dangers [3]
>
> [3] http://tinyurl.com/yrxy9p
>
> and Travis Griggs some of the places that it is useful.
>
> [4] http://tinyurl.com/yosjrs
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Nicolas Petton
In reply to this post by Edward Stow

Le mercredi 02 avril 2008 à 07:09 +1100, Edward Stow a écrit :

> On Wed, Apr 2, 2008 at 8:08 AM, Nicolas Petton <[hidden email]> wrote:
> >
> >  Le mardi 01 avril 2008 à 20:49 +0200, Giuseppe Luigi Punzi Ruiz a
> >  écrit :
> >
> > > Hi Jano, list,
> >  >
> >  > I think, he is talking about 2 webstyles in one app.
> >
> >  You can use different pageFrameWith: like methods for different kind of
> >  apps, for example #pageFrameWith:title, #blogPageFrameWith:title and so
> >  on.
> >
> >  Nico
>
> Yes that would work ... should have thought of the obvious solution,
> possibly using a decorators on my base WebStyle to provide the
> individual features needed for each page layout.
But do you need it ?

BTW, I added WebApplication>>pageFrameWith:title: in the latest version
on the SS, which simply returns self style pageFrameWith:title:. All you
have to do now is to override this message in your own WebApplication to
change this behaviour.

Cheers!

Nico
--
Nicolas Petton
http://nico.bioskop.fr
            ___
          ooooooo
         OOOOOOOOO
        |Smalltalk|
         OOOOOOOOO
          ooooooo
           \   /
            [|]
--------------------------------
Ma clé PGP est disponible ici :
http://nico.bioskop.fr/pgp-key.html

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: WebStyle <---> WebApplication

Edward Stow
In reply to this post by Janko Mivšek
On Wed, Apr 2, 2008 at 8:38 AM, Janko Mivšek <[hidden email]> wrote:

> Edward Stow wrote:
>
>  > #doesNotUnderstand:  should come with a warning about the consequences
>  > for its use.  I'm sure that smalltalkers much wiser than me have
>  > expressed similiar sentiments.
>
>  In Aida we use two such tricks and both you discover immediately :) One
>  is #dnu to connect Apps with WebStyle, other is so called "climbing on
>  the stack" (my term) which finds a reference to the App or session on
>  which you are currently building the page, in case you don't have other
>  means to find it. #app method is such one. More below.

I did see  'climbing the stack' trick but as I could not see an
obvious replacement for the WebStyle>>app method I let it pass.   I'm
sure a better  / clearer alternative would be possible but sorry, I
don't have the time at the moment to ponder the alternative.

>
>  About #dnu, I agree with you, it is dangerous for everyday use but
>  acceptable if used carefully in frameworks like Aida. Specially if it is
>  hidden enough from average user. Here we can argue that in Aida is too
>  obvious. Maybe. But we can improve (that is hide it) by using a #style
>  method where possible. Maybe can even go without #dnu now at all? Let we
>  inspect that possibility a bit.

I'm sure you can with very little pain.

--

Edward Stow
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida