- We design and build extraordinary applications for companies looking to make the next great idea a reality.
- learn more
GWT Conference: Best Practices for Building Libraries
Joel and Kelly stepped us through 10 principles for writing good GWT libraries.
- Design for real use cases
- Create independently useful pieces (don't try to prematurely wire everything together)
- Don't use a Widget when all you need is HTML. (Widgets let you handle events. If you don't need to handle events, or can handle it in an upstream (parent) Widget, don't use a Widget)
- Design with compiler optimizations in mind (ditch static initializers if you don't need them, stay tuned for more documentation about the compiler and its optimizations)
- Identify your invariants and make them immutable (example, instead of a LinearPanel whose direction you could change, they now have VerticalPanel and HorizontalPanel)
- Beware of implementation inheritance (No brainer. Work with interfaces. GoF is 80% about refactoring class inheritance.)
- Make it work in Mozilla, IE6/7, Safari and Opera (If it is a GWT library, it should work everywhere that GWT supports)
- Use the builder pattern (see RequestBuilder for an example)
- OO is a tool, not a goal. (Don't create objects just for the sake of creating objects, it sucks for GC)
- Read Effective Java
The discussion devolved into IE bashing (with occasional shots at Safari 2). One of the GWT engineers mentioned the possibility of performing object pooling at the compiler level, but that is somewhat off in the future.
"The cost of a bad decision in application code is just restricted to that application; in library code, the cost of a bad decision is multiplied by all the people who use the library." -- JW
"Design to real use cases, not to someone's fantasy." -- KN
"99.9% of all the use cases I have seen for adding widgets to trees involve adding images or check boxes." -- JW
"IE6 has perhaps the worst garbage collector ever written." -- JW
"Handing out mutable copies of your internal state is just a bug waiting to happen." -- JW
Topics: GWT
Leave a comment
About Pathfinder
Recent
- Push Button Phones and the Limits of User Testing
- Firefox Plugin Malware ‘Trojan.PWS.ChromeInject.A’
- Pathfinder releases version 1 of the its Flash Platform microsite (codename Mica)
- Pimp my Rails: Five Plugins & Gems to Make Rails Better
- iPhone: Using Pre-processor Directives for Device Testing
- Subtle OpenGL Projection Matrix Difference Between iPhone Simulator and Device
- App Security: Throw Out the Org Chart!
- Pimp my jQuery: Five plugins to replace the features Prototype and Scriptaculous users expect
- Thanksgiving 2008: What We’re Thankful For (In Rails)
- iPhone SDK: Testing with TextMate & GTM
Archives
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006

