Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Convention on listeners/actions handling

    6 answers - 428 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi,
    Just wondering what the general consensus is on where to "handle"
    operations leading to another page It seems there are 2 approaches:
    1. Handle the calls to service layer on the current page and just
    activate the next page at the end of the listener method;
    2. Get the next page and pass execution (and the cycle) to that next
    page by calling a method from that page right away
    Br,
    -Yves-
  • No.1 | | 539 bytes | |

    Yves Sy <yves.sy <atgmail.comwrites:

    1. Handle the calls to service layer on the current page and just
    activate the next page at the end of the listener method;
    2. Get the next page and pass execution (and the cycle) to that next
    page by calling a method from that page right away

    (1), otherwise how can you get the user input?

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
  • No.2 | | 1177 bytes | |

    Well of course for getting input you use (1), but I've seen samples
    even in the Tapestry in Action book where it goes like:

    public void myLinkCliked(IRequestCycle cycle) {
    NextPage n = (NextPage) cycle.getPage("nextPage");
    n.showNextPage(cycle);
    }

    which uses (2).

    course the code in n.showNextPage() could easily be in
    myLinkClicked() and would work the same

    I'm a bit concerned about this because I've already seen some code in
    a project where it got quite inconsistent (using both 1 and 2) and I
    found it messy.

    5/6/05, Kent Tong <kent (AT) cpttm (DOT) org.mowrote:
    Yves Sy <yves.sy <atgmail.comwrites:

    1. Handle the calls to service layer on the current page and just
    activate the next page at the end of the listener method;
    2. Get the next page and pass execution (and the cycle) to that next
    page by calling a method from that page right away

    (1), otherwise how can you get the user input?

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
  • No.3 | | 876 bytes | |

    Yves Sy <yves.sy <atgmail.comwrites:

    Well of course for getting input you use (1), but I've seen samples
    even in the Tapestry in Action book where it goes like:

    public void myLinkCliked(IRequestCycle cycle) {
    NextPage n = (NextPage) cycle.getPage("nextPage");
    n.showNextPage(cycle);
    }

    which uses (2).

    course the code in n.showNextPage() could easily be in
    myLinkClicked() and would work the same

    That really depends what showNextPage() does and is a question
    of where the logic should reside. However, I wouldn't bother
    much as this issue is very cmomon in our daily programming
    life (which class to put this method?).

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
  • No.4 | | 1285 bytes | |

    Its very common yet you couldn't give a straight answer!

    I AM bothered because I'd want some convention on where to put logic
    (actually, controller logic NT biz logic), or at least a rule of
    thumb that everyone on a team should follow. I wouldn't want one guy
    to do something one way and another guy doing it another way

    5/8/05, Kent Tong <kent (AT) cpttm (DOT) org.mowrote:
    Yves Sy <yves.sy <atgmail.comwrites:

    Well of course for getting input you use (1), but I've seen samples
    even in the Tapestry in Action book where it goes like:

    public void myLinkCliked(IRequestCycle cycle) {
    NextPage n = (NextPage) cycle.getPage("nextPage");
    n.showNextPage(cycle);
    }

    which uses (2).

    course the code in n.showNextPage() could easily be in
    myLinkClicked() and would work the same

    That really depends what showNextPage() does and is a question
    of where the logic should reside. However, I wouldn't bother
    much as this issue is very cmomon in our daily programming
    life (which class to put this method?).

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
  • No.5 | | 814 bytes | |

    Yves Sy <yves.sy <atgmail.comwrites:

    Its very common yet you couldn't give a straight answer!

    I AM bothered because I'd want some convention on where to put logic
    (actually, controller logic NT biz logic), or at least a rule of
    thumb that everyone on a team should follow. I wouldn't want one guy
    to do something one way and another guy doing it another way

    well, if you really want a straight answer, you can apply
    the following simple principle: Do you have duplicate code?
    If yes, extract it to put it where it belongs. If no, the
    logic is probably in the right place.

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
  • No.6 | | 994 bytes | |

    That's what I figured out myself. Basically when the code can get
    called from several places

    Thanks,
    -Yves-
    5/10/05, Kent Tong <kent (AT) cpttm (DOT) org.mowrote:
    Yves Sy <yves.sy <atgmail.comwrites:

    Its very common yet you couldn't give a straight answer!

    I AM bothered because I'd want some convention on where to put logic
    (actually, controller logic NT biz logic), or at least a rule of
    thumb that everyone on a team should follow. I wouldn't want one guy
    to do something one way and another guy doing it another way

    well, if you really want a straight answer, you can apply
    the following simple principle: Do you have duplicate code?
    If yes, extract it to put it where it belongs. If no, the
    logic is probably in the right place.

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org

Re: Convention on listeners/actions handling


max 4000 letters.
Your nickname that display:
In order to stop the spam: 7 + 6 =
QUESTION ON "Java"

EMSDN.COM