I was reading through Matt's rundown of Struts 2 (does it suck?) and he strayed into one of my most passionate areas: feedback.
He gave an example of an incorrect property name, and how that would be reported to the user. He showed examples from all the major frameworks, and the Tapestry 4 version, even without its proper CSS styles, won hands-down.
However, as I was reading and responding, it struck me that while other framework can barely tell you what you've done wrong, Tapestry 5 should be telling you how to fix it. In this case, advising you about the possible properties you could have specified, which I've added as TAPESTRY-1737 and fixed.
Here's the result. Not bad for ten minutes work. And remember: property names in Tapestry 5 are already case insensitive, which wipes out probably 50% of your typical typing errors anyway.
hi howard,
ReplyDeletecool!
What happens if the class has lots of properties ?
Let's say someone typed "mail" incorrectly.
should you be showing them properties that all start with "m" OR should you show them properties starting with adjacent characters in the charset "l" or "n".
OR
how about adjacent characters in the keyboard "n", "k" (nothing starts with a COMMA(",") ).
Makes sense ?
BR,
~A
I've been thinking of ways in which the list of potential matches could be formatted better, including having the most likely match(es) highlighted ... but this is already light years ahead of any similar framework and I have bigger fish to fry.
ReplyDeleteWow, cool feature. Nice to have it at tapestry 4 ;-)
ReplyDeleteAs far a getting the correct property if the error is a mis-spelling, you could find the Levenstein Distance, and Apache commons StringUtils object has a nice getLevensteinDistance method.
ReplyDeleteJust use soundex from commons codec to match a similar sounding variable name. That's how spell checks work.
ReplyDeleteHere's the difference between programming and software development: programming is easy and software development is hard. You have to budget your time, be disciplined, sometimes make compromises.
ReplyDeleteAll this "suggest the right thing" stuff is doable, but low priority.
If you think it is very important, this is an excellent opportunity to do two things:
1) Add an issue requesting the new feature to Tapestry's JIRA
2) Submit a patch
As far as I'm concerned, nothing that isn't in JIRA exists. If it's important enough to someone to warrant a change, it's important enough for them to register with JIRA and add an issue. And if it's really important, they'll add a patch.
Does anyone know how to make T5 create all page instances at deploy time in Tomcat? For example, the Hibernate project suggests using a ServletContextListener to create a SessionFactory. Something similar would be great in T5 to get a better response time when the first user hits a page.
ReplyDeleteI know just doing requests from a utility class would be a quick-and-dirty workaround, but surely there has to be a better way.
That's a discussion for the users list.
ReplyDeleteBeanmac,
ReplyDeleteThis isn't a support forum for Tapestry; users@tapestry.apache.org is a support forum for Tapestry, and you're much likely to get a timely answer there.