Example 1: Hello, World! (Original)
Kata 1A: 25 minutes ✔
Add a new line to the page that says, "In one week, the time will be <time>", where <time> is replaced by a timestamp one week later than the timestamp that now appears on the page.
Kata 1B: 10 minutes ✔
Add a button to the page labelled "Refresh". After pushing the button, the times update themselves.
Kata 1C: 20 minutes ✔
Wicket, by default, runs in "Development" mode, but production systems should run in "Deployment" mode. Override the getConfigurationType() method so that Example01 now runs in Deployment mode.
The katas ifor example one were not that bad. I think the hardest part was trying to find the right methods to format the time to add a week. Othere than that, everything seemed pretty straightforward.
Example 2: Links, Lists, Forms, Tables (Original)
Kata 2A: 40 minutes ✔
Add an additional link on the home page that says, "Go to image page". Create this page, which should display an embedded image. This image should be G-rated. It should be in a .jpg file stored with the system, not retrieved from the web.
Kata 2B: 2 hours 30 minutes ✘
Add a button on the home page with the label, "Make font bold". After the user pushes it, all the text on the page should become bold, and the button label should change to "Make font italic". When the user pushes that button, all of the text should change to italic and the button label should change to "Make font normal". Pushing that button changes the text back to its original state and the button label should now say "Make font bold".
General Idea: Find a dynamic way to insert corresponding bold and italic HTML tags at the front and end of the document.
I particularly had some trouble with this task. The first approach I tried was one that I would use in PHP, which involved having a conditional of some sort that would allow a certain Wicket tags to appear under certain conditions. This isn't how Wicket works though. Tags must be in place before the page is loaded or else it will throw some nasty syntax errors saying that either the tag has been created, but it cannot find a variable, or vice-versa. So this idea was not going to work.
Another idea I had was to dynamically change the data that was being assigned to the label using StringResourceModels. I have a feeling that this is the 'correct' way to do it, but implementing these objects was a little bit beyond my current Wicket knowledge. My current understanding of these objects is that under certain conditions, the data that is displayed can change, whether it's being passed a certain type of object, or by using get methods on the object to return data corresponding to the current state of the object.
The third idea I thought was to create every label and button, and adjust their visibility via the Component.setVisible() method. Unfortunately I had some trouble with my buttons setting these values to true or false for some reason. It would seem that every time the page is reloaded it will reinitialize the boolean values to their default values, which didn't help much.
The last pitch effort for this task was to just create 3 static web pages and link them all together and have the corresponding tags and buttons on each page, but I felt that would not really accomplish the assignment from a developer standpoint, even though it would yield the correct output (except the pages would all be different).
Kata 3A: 8 minutes ✔
Add a new tab called "Image" that takes the user to a page containing an embedded image (your choice, G-rated). It should be in a .jpg file stored with the system, not retrieved from the web.
This exercise was very simple. It involves one method call to fetch an image and display it to the screen. Creating the link to the new page was also very easy since it is the same code as the other 4 pages.
This exercise was very simple. It involves one method call to fetch an image and display it to the screen. Creating the link to the new page was also very easy since it is the same code as the other 4 pages.
Kata 4A: 10 minutes ✔
Add a new cheese called "Velveeta", which costs $0.25/lb.
Kata 4B: 30 minutes ✔
Kata 4B: 30 minutes ✔
Add a "country" field to the billing address that appears when checking out. The country field should provide a drop-down menu with a selection of 5 countries.
The first one was fairly simple. You just have to add another item to the list, and you can easily follow the format of the other listed items.
Adding the select form was slightly difficult not because of the difficulty of the coding, but the amount of methods you had to create. Many of them were get/set methods to ensure that the address objects were getting all the info needed to make a shipment. I enjoyed this one, since it involved a bit of tracing.
The first one was fairly simple. You just have to add another item to the list, and you can easily follow the format of the other listed items.
Adding the select form was slightly difficult not because of the difficulty of the coding, but the amount of methods you had to create. Many of them were get/set methods to ensure that the address objects were getting all the info needed to make a shipment. I enjoyed this one, since it involved a bit of tracing.
Kata 6A: 2 minutes ✔
Get rid of the blue columns that appear when displaying the website. These are for development, not deployment purposes.
Kata 6B: 3 minutes ✔
Kata 6B: 3 minutes ✔
Place the image underneath the form, not to the right.
Kata 6C: ✘
It is often convenient for web applications to consult a properties file when starting up in order to get configuration values. An easy way to do this is with the standard Java Properties mechanism. (See Java in a Nutshell for details on properties file manipulation.) For this Kata, modify your Example06 system to read in a file (if present) located in ~/.example06/configuration.properties.
The first two were by far the easiest out of all the katas, requiring you to disable some CSS code, as well as move an image into another div. But the same cannot be said of the last kata. I wish I had more time to figure this one out.
Thoughts
I think it may help that I've been recently trying to teach myself PHP, but the flow between PHP and Wicket have some similarities. I think I could get kata 2B down once I learn how to use more of Wicket's API, but it's always fun to have some dynamic coding for web apps where you have your higher languages spitting out HTML code that will be interpreted not just as characters. I think these exercises helped to sharpen not only my Wicket skills, but also my general web development capabilities. Working with services like Jetty help you realize how all the components of a web server come into play to take in user input, interpret it, and give back the expected results. I will try to update this blog as I complete the last two of these exercises that eluded me.
It is often convenient for web applications to consult a properties file when starting up in order to get configuration values. An easy way to do this is with the standard Java Properties mechanism. (See Java in a Nutshell for details on properties file manipulation.) For this Kata, modify your Example06 system to read in a file (if present) located in ~/.example06/configuration.properties.
The first two were by far the easiest out of all the katas, requiring you to disable some CSS code, as well as move an image into another div. But the same cannot be said of the last kata. I wish I had more time to figure this one out.
Thoughts
I think it may help that I've been recently trying to teach myself PHP, but the flow between PHP and Wicket have some similarities. I think I could get kata 2B down once I learn how to use more of Wicket's API, but it's always fun to have some dynamic coding for web apps where you have your higher languages spitting out HTML code that will be interpreted not just as characters. I think these exercises helped to sharpen not only my Wicket skills, but also my general web development capabilities. Working with services like Jetty help you realize how all the components of a web server come into play to take in user input, interpret it, and give back the expected results. I will try to update this blog as I complete the last two of these exercises that eluded me.
please fix the fonts; you have a black font with a black background for the "Thoughts" section of this posting.
ReplyDelete