Knowing what my co-workers are like, these are the most important things that I say to them. So this list is directed towards them in particular.
1. When receiving parameters in a constructor or method, a model (an instance of IModel) is almost always the right choice instead of a raw model object. Almost everyone here has mentioned this rule in different words (probably most better than mine). 2. Apply your generic object-oriented programming skills to web page programming. When dealing with pages and panels, know when to use inheritance and when not to. Inheritance is something you should usually try to avoid and use composition instead. Inheritance might save you a couple lines of code but it tends to make the code crazy difficult to understand. Having said that, it must be mentioned that there are plenty of situations where using inheritance is justified. I just think the cost of using inheritance in the wrong place is so high that it deserves to be feared. 3. A page's markup must be kept very clean. It should never be no more than 50 lines, or so. Use panels to separate parts of the page. A (positive) result of this is that the page's java file is probably clean too. The main reason for this rule is that it should always be easy for everyone to get an idea of the general structure of a page. 4. When a markup contains a wicket:id, the corresponding java file should probably contain a corresponding add-method invocation. I.e. the corresponding add-method invocation shouldn't be located in some other (unrelated) java file. For understandability's sakes. 5. Don't be afraid to refactor source codes. Even those that were originally made by someone else. There are plenty of reasons why this is important. One of them is that nobody makes perfect code the first time. You shouldn't even try to make perfect code the first time. It's usually fine if you make monolithic panels (not pages), use plenty of inner classes and make inefficient code. They will be refactored later if they are modified often and if people adhere to this rule. 6. With Wicket as the web application framework you rarely if ever need to create servlets. File downloading is possible with resources and it's possible to create bootstraps too. Okay, this rule doesn't deserve to be in the top 10, but I seriously don't want to see more servlets being made - EVER! :) 7. It's pretty important to learn about all the different types of models. They may be a little more difficult concept to understand than components. 8. WebMarkupContainer is a simple yet useful component that does nothing unless you program it do something. WebComponent is equally simple but less often useful because it can't be a parent to other components. ----- Original Message ----- From: Jeremy Thomerson Sent: 07/28/11 01:29 AM To: users@wicket.apache.org Subject: RFC: Ten things every Wicket programmer must know? Hello all, I'm writing an article for a Java magazine and would like to include in it a list of "ten things every Wicket programmer must know". Of course, I have my list, but I'd be very curious to see what you think should be on that list from your own experience. Or, put another way, maybe the question would be "what I wished I knew when I started Wicket" - what tripped you up or what made you kick yourself later? Please reply back if you have input. Please note that by replying, you are granting me full permission to use your response as part of my article without any attribution or payment. If you disagree with those terms, please respond anyway but in your response mention your own terms. Best regards, -- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org* --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org