AppFuse JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile
AppFuse
  • AppFuse
  • APF-404 Tapestry Improvements from Review by ...
  • APF-499

APF-404 subtask: Naming Conventions

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Sub-task Sub-task
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.3
  • Fix Version/s: 2.0-M2
  • Component/s: Web - Tapestry
  • Labels:
    None

Description

Naming conventions:

In Tapestry, the established convention is that page names are CamelCase. Further, the XML specification (.page file), HTML template and Java class should all be named the same. Likewise for components.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Source
  • Reviews
  • Builds
Hide
Permalink
Bryan Noll added a comment - 16/Nov/06 6:11 PM

So... here's the lowdown on potential modifications for this issue. As of now, I've got it going locally as it is described below (passes all cargo tests and deploys and works). Please give it a quick read and provide feedback.

I should note that the modifications discussed will apply for this issue (APF-499, plus APF-500, APF-501, and APF-502, which are all subtasks of APF-404).

A) I believe the following files should keep the names they have because other resources like jsp files in the web-common module refer to them in their current case, and changing them to adhere to the Tapestry convention would force us to change them in all other web distribution options.

./src/main/webapp/WEB-INF/pages/mainMenu.html
./src/main/webapp/WEB-INF/pages/mainMenu.page
./src/main/webapp/WEB-INF/pages/passwordHint.html
./src/main/webapp/WEB-INF/pages/passwordHint.page
./src/main/webapp/WEB-INF/pages/signup.html
./src/main/webapp/WEB-INF/pages/signup.page

B) I've renamed the following *.html*.page files to adhere to the Tapestry convention.

Classnames different than page names:

./src/main/webapp/WEB-INF/pages/ActiveUsers.html
./src/main/webapp/WEB-INF/pages/ActiveUsers.page (class name: BasePage)
./src/main/webapp/WEB-INF/pages/SelectFile.html
./src/main/webapp/WEB-INF/pages/SelectFile.page (class name: FileUpload)
./src/main/webapp/WEB-INF/pages/ShowFile.html
./src/main/webapp/WEB-INF/pages/ShowFile.page (class name: FileDisplay)
./src/main/webapp/WEB-INF/pages/Users.html
./src/main/webapp/WEB-INF/pages/Users.page (class name: UserList)

Classnames same as page names:
./src/main/webapp/WEB-INF/pages/Error.html
./src/main/webapp/WEB-INF/pages/Error.page
./src/main/webapp/WEB-INF/pages/Reload.html
./src/main/webapp/WEB-INF/pages/Reload.page
./src/main/webapp/WEB-INF/pages/UserForm.html
./src/main/webapp/WEB-INF/pages/UserForm.page

C) I've been able to move the './src/main/webapp/WEB-INF/pages' directory to './src/main/webapp/WEB-INF/tapestry', as suggested. In addition, for those pages that have the same as their coreesponding classes (Error, Reload & UserForm), I was able to comment out their '<page name="Error" specification-path="tapestry/Error.page"/>' line in the tapestry.application file, and specify a '<meta key="org.apache.tapestry.page-class-packages" value="org.appfuse.webapp.action"/>' setting so that Tapestry would find them automatically. As for the others (those pages that do not share the same name as their classes), they still have the 'specification-path' setting. Combining the two styles seems to work.

So... here's the two good options as I see them:

1) Don't do anything:
Leave everything the way it is, and just be satisfied that it is not exactly configured the Tapestry way. The disadvantages to this are twofold...
a) A person experienced with Tapestry may expect things to 'be' and 'look' a certain way, so it would be good to conform to that if possible.
b) It seems silly to require folks to have to put more xml in tapestry.application if they don't have to by simply naming things the same way and taking advantage of the 'org.apache.tapestry.page-class-packages' setting.

2) Do something:
2.1) Leave mainMenu, passwordHint & signUp as is so web-common and other web modules don't have to change.
2.2) Make the rest of these pages have the same name as the java class behind them (ActiveUsers becomes BasePage, SelectFile becomes FileUpload, ShowFile becomes FileDisplay, Users becomes UserList), and use the 'org.apache.tapestry.page-class-packages' setting. The advantage to this is... we have a discrete 3 cases where it doesn't adhere to the Tapestry convention for good reason, and from that point forward, we don't need any extra xml configuration.

I'd vote a weak +1 for Option 2. Let me know what you think. If those more experienced with Tapestry care to trump me here, I'm not gonna put up a fight.

Show
Bryan Noll added a comment - 16/Nov/06 6:11 PM So... here's the lowdown on potential modifications for this issue. As of now, I've got it going locally as it is described below (passes all cargo tests and deploys and works). Please give it a quick read and provide feedback. I should note that the modifications discussed will apply for this issue ( APF-499 , plus APF-500 , APF-501 , and APF-502 , which are all subtasks of APF-404 ). A) I believe the following files should keep the names they have because other resources like jsp files in the web-common module refer to them in their current case, and changing them to adhere to the Tapestry convention would force us to change them in all other web distribution options. ./src/main/webapp/WEB-INF/pages/mainMenu.html ./src/main/webapp/WEB-INF/pages/mainMenu.page ./src/main/webapp/WEB-INF/pages/passwordHint.html ./src/main/webapp/WEB-INF/pages/passwordHint.page ./src/main/webapp/WEB-INF/pages/signup.html ./src/main/webapp/WEB-INF/pages/signup.page B) I've renamed the following *.html*.page files to adhere to the Tapestry convention. Classnames different than page names: ./src/main/webapp/WEB-INF/pages/ActiveUsers.html ./src/main/webapp/WEB-INF/pages/ActiveUsers.page (class name: BasePage) ./src/main/webapp/WEB-INF/pages/SelectFile.html ./src/main/webapp/WEB-INF/pages/SelectFile.page (class name: FileUpload) ./src/main/webapp/WEB-INF/pages/ShowFile.html ./src/main/webapp/WEB-INF/pages/ShowFile.page (class name: FileDisplay) ./src/main/webapp/WEB-INF/pages/Users.html ./src/main/webapp/WEB-INF/pages/Users.page (class name: UserList) Classnames same as page names: ./src/main/webapp/WEB-INF/pages/Error.html ./src/main/webapp/WEB-INF/pages/Error.page ./src/main/webapp/WEB-INF/pages/Reload.html ./src/main/webapp/WEB-INF/pages/Reload.page ./src/main/webapp/WEB-INF/pages/UserForm.html ./src/main/webapp/WEB-INF/pages/UserForm.page C) I've been able to move the './src/main/webapp/WEB-INF/pages' directory to './src/main/webapp/WEB-INF/tapestry', as suggested. In addition, for those pages that have the same as their coreesponding classes (Error, Reload & UserForm), I was able to comment out their '<page name="Error" specification-path="tapestry/Error.page"/>' line in the tapestry.application file, and specify a '<meta key="org.apache.tapestry.page-class-packages" value="org.appfuse.webapp.action"/>' setting so that Tapestry would find them automatically. As for the others (those pages that do not share the same name as their classes), they still have the 'specification-path' setting. Combining the two styles seems to work. So... here's the two good options as I see them: 1) Don't do anything: Leave everything the way it is, and just be satisfied that it is not exactly configured the Tapestry way. The disadvantages to this are twofold... a) A person experienced with Tapestry may expect things to 'be' and 'look' a certain way, so it would be good to conform to that if possible. b) It seems silly to require folks to have to put more xml in tapestry.application if they don't have to by simply naming things the same way and taking advantage of the 'org.apache.tapestry.page-class-packages' setting. 2) Do something: 2.1) Leave mainMenu, passwordHint & signUp as is so web-common and other web modules don't have to change. 2.2) Make the rest of these pages have the same name as the java class behind them (ActiveUsers becomes BasePage, SelectFile becomes FileUpload, ShowFile becomes FileDisplay, Users becomes UserList), and use the 'org.apache.tapestry.page-class-packages' setting. The advantage to this is... we have a discrete 3 cases where it doesn't adhere to the Tapestry convention for good reason, and from that point forward, we don't need any extra xml configuration. I'd vote a weak +1 for Option 2. Let me know what you think. If those more experienced with Tapestry care to trump me here, I'm not gonna put up a fight.
Hide
Permalink
Bryan Noll added a comment - 18/Nov/06 8:22 PM

Resolved as discussed in the previous comment. Check in notes:

Author: bnoll
Date: Sat Nov 18 18:15:10 2006
New Revision: 2054

Show
Bryan Noll added a comment - 18/Nov/06 8:22 PM Resolved as discussed in the previous comment. Check in notes: Author: bnoll Date: Sat Nov 18 18:15:10 2006 New Revision: 2054
Hide
Permalink
Matt Raible added a comment - 21/Nov/06 11:05 PM

While I think it's a good idea to conform AppFuse's standard Tapestry setup to what HLS suggests, I think it might be a good idea to ask the larger Tapestry community their opinion. URLs are typically lower-cased, so having CamelCase page names may be the Tapestry-way, but it's not the Internet Way.

Thanks for all your help on this to date Bryan. I'll try to post a blog entry addressed at the Tapestry community to see if they agree with everything HLS says.

Show
Matt Raible added a comment - 21/Nov/06 11:05 PM While I think it's a good idea to conform AppFuse's standard Tapestry setup to what HLS suggests, I think it might be a good idea to ask the larger Tapestry community their opinion. URLs are typically lower-cased, so having CamelCase page names may be the Tapestry-way, but it's not the Internet Way. Thanks for all your help on this to date Bryan. I'll try to post a blog entry addressed at the Tapestry community to see if they agree with everything HLS says.
Hide
Permalink
Bryan Noll added a comment - 06/Dec/06 12:07 PM

Sounds good to me Matt. Just point me towards the feedback you receive, and I can change it accordingly. There are other good things to do with some of the other subtasks, and I'm mostly just using this issue as a platform to get more familiar and comfortable with Tapestry in general. I don't have a strong opinion on things like this, so I have no problem catering to what the community at large feels here.

Show
Bryan Noll added a comment - 06/Dec/06 12:07 PM Sounds good to me Matt. Just point me towards the feedback you receive, and I can change it accordingly. There are other good things to do with some of the other subtasks, and I'm mostly just using this issue as a platform to get more familiar and comfortable with Tapestry in general. I don't have a strong opinion on things like this, so I have no problem catering to what the community at large feels here.
Hide
Permalink
Matt Raible added a comment - 28/Dec/06 11:11 PM

http://www.nabble.com/CamelCase-page-names-URLs-in-Tapestry-tf2893433.html

Show
Matt Raible added a comment - 28/Dec/06 11:11 PM http://www.nabble.com/CamelCase-page-names-URLs-in-Tapestry-tf2893433.html
Hide
Permalink
Matt Raible added a comment - 22/Jan/07 6:09 PM

FYI... This thread also contains information on how to use Tapestry's annotations:

http://www.nabble.com/CamelCase-page-names-URLs-in-Tapestry-tf2893433.html#a8137130

Show
Matt Raible added a comment - 22/Jan/07 6:09 PM FYI... This thread also contains information on how to use Tapestry's annotations: http://www.nabble.com/CamelCase-page-names-URLs-in-Tapestry-tf2893433.html#a8137130

People

  • Assignee:
    Bryan Noll
    Reporter:
    Bryan Noll
Vote (0)
Watch (0)

Dates

  • Created:
    03/Nov/06 11:28 AM
    Updated:
    22/Jan/07 6:09 PM
    Resolved:
    18/Nov/06 8:22 PM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for AppFuse. Try JIRA - bug tracking software for your team.