Comment on the tutorial

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

Comment on the tutorial

Stephen Davies-3
Hi,

In the tutorial, step 6, you are shown how to add a "Add a new entry" link to your viewMain.

The added code looks like so:

        e addBreak.
        e addLinkTo: self text: 'Add a new entry'  view: #add.

 When I did this, I was puzzled by the generated URL for the linked to page:
        http://localhost:8888/an%20ademoaddressbookapp.html?view=add
 
When I thought about it, I realised that the reason was that the link was to the ADemoAddressBookApp instance, and not the ADemoAddressBook.
Whilst the functionality works fine, this seems to break the usual convention which is that URLs point at the model objects, not at the view.
I changed the above code to:
	e addBreak.
	e addLinkTo: self observee text: 'Add an entry'  view: #add.
And got the expected URL:
              http://localhost:8888/addressbook.html?view=add
Things worked just the same, and this seems more correct to me.
(It does seem wrong to me that the view for adding an address is in the AddressBook model, but I leave that to another post).
Thanks for comments,
Steve


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

Re: Comment on the tutorial

Nicolas Petton
Hi,

In AIDA/Web, domain objects have urls. In fact, the idea behing this is
that each object has its own url. So, we create links between objects,
never between applications.

So, yes, it's :
"e addLinkTo: self observee..."

>
> (It does seem wrong to me that the view for adding an address is in the AddressBook model, but I leave that to another post).

No! View methods are always in the applications. The model doesn't deal
with view and action methods.

So, when you create a link to an object, what's going on?
To keep it simple, it's similar to:

Click on the link to the model -> Find an application for the model -> Display the view method of the application

I hope this helps.

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: Comment on the tutorial

Stephen Davies-3
Hi,

2008/9/22 nico <[hidden email]>
Hi,

In AIDA/Web, domain objects have urls. In fact, the idea behing this is
that each object has its own url. So, we create links between objects,
never between applications.

So, yes, it's :
"e addLinkTo: self observee..."


So the tutorial should be corrected. 


>
> (It does seem wrong to me that the view for adding an address is in the AddressBook model, but I leave that to another post).

No! View methods are always in the applications. The model doesn't deal
with view and action methods.


Sorry - I made a mistake in my comment and so my objection wasn't clear.

The tutorial tells you to create a viewAdd method to the ADemoAddressBookApp class.  I understand that it is on the "App" class - that's the "View" in my understanding of MVC.

But the viewAdd method has to know all about the insides of an "ADemoAddress".  So its in the wrong place.  The code that knows what's inside an ADemoAddress should ideally be in the ADemoAddress class, not so?  Or, maybe the ADemoAddressApp.

Actually, the same objection stands for the viewMain method in ADemoAddressBookApp, which knows the names of the "columns" (instance variables) of the ADemoAddress.

Am I picking nits?  

Steve


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

Re: Comment on the tutorial

Nicolas Petton
Le lundi 22 septembre 2008 à 21:23 +0200, Stephen Davies a écrit :

> Hi,
>
> 2008/9/22 nico <[hidden email]>
>         Hi,
>        
>         In AIDA/Web, domain objects have urls. In fact, the idea
>         behing this is
>         that each object has its own url. So, we create links between
>         objects,
>         never between applications.
>        
>         So, yes, it's :
>         "e addLinkTo: self observee..."
>
>
>
>
> So the tutorial should be corrected.
>
>
>        
>         >
>         > (It does seem wrong to me that the view for adding an
>         address is in the AddressBook model, but I leave that to
>         another post).
>        
>        
>         No! View methods are always in the applications. The model
>         doesn't deal
>         with view and action methods.
>
>
>
>
> Sorry - I made a mistake in my comment and so my objection wasn't
> clear.
>
>
> The tutorial tells you to create a viewAdd method to the
> ADemoAddressBookApp class.  I understand that it is on the "App" class
> - that's the "View" in my understanding of MVC.
>
>
> But the viewAdd method has to know all about the insides of an
> "ADemoAddress".  So its in the wrong place.  The code that knows
> what's inside an ADemoAddress should ideally be in the ADemoAddress
> class, not so?  Or, maybe the ADemoAddressApp.
Yes, you're right. But for a first tutuorial, I guess it was simpler to
do it this way.
>
>
> Actually, the same objection stands for the viewMain method in
> ADemoAddressBookApp, which knows the names of the "columns" (instance
> variables) of the ADemoAddress.
>
>
> Am I picking nits?  

Well, it's just a tutorial, but for real aida applications it's better
to write views (#viewAdd in this case) in the right place :)


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: Comment on the tutorial

Janko Mivšek
In reply to this post by Stephen Davies-3
Hi Stephen,

Stephen Davies wrote:

>     So, yes, it's :
>     "e addLinkTo: self observee..."
>
  > So the tutorial should be corrected.

Yep, you are right, I just correct the tutorial in 6.Forms. Please if
you see any other strange thing in tutorial, report it. I also corrected
square brackets to be actually shown. In Scribo editor square brackets
mean new page link, but you can escape it wit two opening brackets: [[.

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: Comment on the tutorial

Janko Mivšek
In reply to this post by Stephen Davies-3
Stephen Davies wrote:

>      > (It does seem wrong to me that the view for adding an address is
>     in the AddressBook model, but I leave that to another post).
>
>     No! View methods are always in the applications. The model doesn't deal
>     with view and action methods.
>
>
>
> Sorry - I made a mistake in my comment and so my objection wasn't clear.
>
> The tutorial tells you to create a viewAdd method to the
> ADemoAddressBookApp class.  I understand that it is on the "App" class -
> that's the "View" in my understanding of MVC.
>
> But the viewAdd method has to know all about the insides of an
> "ADemoAddress".  So its in the wrong place.  The code that knows what's
> inside an ADemoAddress should ideally be in the ADemoAddress class, not
> so?  Or, maybe the ADemoAddressApp.
>
> Actually, the same objection stands for the viewMain method in
> ADemoAddressBookApp, which knows the names of the "columns" (instance
> variables) of the ADemoAddress.
>
> Am I picking nits?  

You were confused by that missing addLinkTo: self observee. After that
MVC separation is again as you expected. self observee namely provides
that link between VC and M part of MVC. That way model stays responsible
for his part of job while an App (VC) is responsible for web
presentation of domain object (self observee).

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: Comment on the tutorial

Stephen Davies-3
In reply to this post by Janko Mivšek


2008/9/22 Janko Mivšek <[hidden email]>
I also corrected
square brackets to be actually shown. In Scribo editor square brackets
mean new page link, but you can escape it wit two opening brackets: [[.



Steve


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

Re: Comment on the tutorial

Janko Mivšek
Stephen Davies wrote:

> 2008/9/22 Janko Mivšek <[hidden email]

>     I also corrected
>     square brackets to be actually shown. In Scribo editor square brackets
>     mean new page link, but you can escape it wit two opening brackets: [[.
>
> I used HTTPString decodedHTTPFrom:
> 'http://www.aidaweb.si/object/o7036622.html?view=add&title=%09%09%09(WebElement%20new)%20addLinkTo%3A%20each%20text%3A%20each%20surname 
> <http://www.aidaweb.si/object/o7036622.html?view=add&title=%09%09%09(WebElement%20new)%20addLinkTo%3A%20each%20text%3A%20each%20surname>.'
> to extract the rest of the code.

If you open normally the tutorial, is code is now correct everywhere?

It is important that the tutorial is actually valid and we need to be
careful in the future, that it will be so, always.

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: Comment on the tutorial

Stephen Davies-3
In reply to this post by Janko Mivšek


2008/9/22 Janko Mivšek <[hidden email]>
You were confused by that missing addLinkTo: self observee. After that
MVC separation is again as you expected. self observee namely provides
that link between VC and M part of MVC. That way model stays responsible
for his part of job while an App (VC) is responsible for web
presentation of domain object (self observee).


No - my issue is simpler really.  Its just that I think that the function that creates the view that adds a new address should be associated with the AddressApp class, not the AddressBookApp.  Cos we are making an address, not an addressBook.

Does that make sense?

Steve


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

Re: Comment on the tutorial

Stephen Davies-3
In reply to this post by Janko Mivšek


2008/9/23 Janko Mivšek <[hidden email]>
If you open normally the tutorial, is code is now correct everywhere?


Yes, thanks Janko.

Steve


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