Monday, July 5, 2010

First Impressions of new Book

Overall I think the cookbook is pretty good. I am not very far in it yet, but it seems like the author is a lively creative technically proficient person who will probably do a good job covering some intermediate/advanced JSF 2.0 implementation topics. I would say beginner also, but I think there is too much left out to really call this a manual that helps beginners.

If you would like to see my first impressions as I had them please keep reading…

6/25/2010 6:35:24 PM

Sounds like Anghel Leonard (author) has some good experience writing books and developing Java and maybe other technologies.

When reading a technical manual I always study the table of contents. After doing so I am usually more excited about what I am reading because I am aware, not only aware of what the book covers, but also of topics and combinations of things that I have never thought of before. That is certainly the case with Mr. Leonard's book's Table of Contents. I come away from his TOC thinking that if I can learn about 1/7th of what is in this book I will be learning quite a bit! He covers not only JSF 2.0, but apparently how it integrates with 30 or 40 other technologies. So: I am looking forward to continuing to read. On to the Preface…

"What this book covers" is an elaboration on the TOC. After reading that and the following section, "What you need for this book," I am beginning to wonder if this is more of a JSF book with some JSF 2.0 thrown in…? Not sure there seems to be some indication that you can use this book with JSF 1.2 or 2.0. I am wondering how that would/will be accomplished? At any rate, even if the subject matter had little or nothing to do with JSF 2.0, the range of topics seems amazing…and I am still looking forward to continuing my read…although…if JSF 2.0 is not so much the focus, maybe the book should not be called JSF 2.0? OK, I will shut up and continue reading to see what Mr. Leonard's bent is.

The who is this book for section: I am not a newbie to JSF, but I would love a look at some "best JSF practices," so I can improve my coding ability and compare the code I have seen in projects that others have written, and code that I have written and see how it compares/sizes up.

I just noticed something kind of funny. In order to assure that copyright is maintained for the e-book copy they gave me, they have given me a pdf with a not at the bottom saying this book is registered to me, then it gives my address, but instead of <city>, <state> <zipcode> …they have put <city>, <county> <zipcode> …I guess I am easily amused. Just like when I first started trying to learn a bit about Hindi, I learned that /dood/ means "friend". I found this funny because "dude" in English is sort of slang for "guy", or about 15 other meanings…probably including "friend"…in fact some people communicate *only* using the word "dude" with different emphases and inflections. Aside over.

Well, I found my first typo on page 8; typos are probably the price you pay for getting relevant textbooks out before they are out of date… I can live with typos, as long as the example code works. I will download the errata, example code, netbeans, and other software needed for the exercises in this book (looks like about 25 different software packages!).

OK, now wait a minute. The author used a phrase "converter lifecycle." Strictly speaking it is the JSF Request Lifecycle he is referring to. And what is a "render page?" I know he knows what he is talking about, and I am probably picking at nits…so I will try to tone it down a notch.

I can tell that reading this manual will take some getting used to. I am not sure where the author is from, but I am having a bit of trouble negotiating his explanations. Right now, however, I am kind of tired; so perhaps this is an unfair statement. Maybe with more sleep and a little patience I will have a better "meeting of the minds" with Mr. Leonard.

I can tell he is covering the material. It kind of seems like he has 1000 different ideas in his mind in his head about a particular subject and the sentences he reveals come out like lottery balls. But let's face it: his goals for the audience of this book and the breadth of the topics he covers, this book may end up being more like trying to read War and Peace, by carefully tearing each page out of that book, stapling these pages to the Bonnyville Salt Flats in a straight line, fixing a camera pointing downward on the side of the Blue Flame car, and then trying to read this novel through the camera's eye view while the driver uses the line of pages as a guide-line to drive next to.

6/27/2010 7:49:26 PM


I think I am in a better frame of mind now. Sorry for the whining…anyone who might be reading this. I have downloaded the code and started filing errata on this text.


It is fairly embarrassing but I have never tried net beans. I downloaded version 6.9. Since I already had glassfish v3 installed. I saw from the startup script for my already-installed glassfish app server that the default domain name was domain1. So I was relieved when I gave Netbeans the install directory (c:\glassfish3 on my machine) and it found domain1 automatically and installed it. I just had to go to the window menu, services sub-menu, and specify I wanted to add a server by right-clicking the servers node and choosing "add server…".


Then I opened the Projects window, and right-clicked New Project…


I created a new Java EE project. It activated "Java Web". I took the defaults on this application. So it created an application with two Java EE modules: an EJB module, and a war module. These basically correspond to the model and viewController projects on a JDeveloper application. The war module had a libraries directory, to which I added the JSF 2.0 libraries. Then I created a new page under the war module's Web Pages folder. The page type I created was "JSF Page"; this allows you to create a facelets page. When I created a facelets page, netbeans automatically added a web.xml file.


Netbeans creates a default "hello world" facelets page. I was able to run it by right-clicking the .xhtml file I had created in the Projects Window, and choosing run file.


At that point I was able to simply put the code into the ide.


7/2/2010 6:26:56 PM


I like the simple example that Mr. Leonard starts off with. I wish that the text had not chosen to put a line break in the middle of the "faces-redirect" directive/parameter; the author used this feature but did not really explain why. The other JSF 2.0 book I read did not use this until they had explained why. Not sure which is the better approach. This directive does not work if there is a line break. I am assuming the sample code is OK in this regard so that one can check this. Probably though, since the line break does not throw an error, anyone that copies the text out of the book will never know that it was wrong, but perhaps they will see it and it will start their subconscious mind working on getting-used-to-seeing-it so that later, when it will probably be introduced in earnest, the learning will come easier.


But, as I said I do like the first example, because of its simplicity. This simplicity allowed me to find my feet with netbeans, to experiment with explicit conversion (explicitly using a double converter when the backing bean property is an int…just to see what it would do.


Aside: in case anyone is wondering why I am focusing so much on JSF 2.0 lately, I am thinking that Oracle will maybe keep using JSF and eventually adopt this standard…perhaps even soon. So, we will see; just trying to paddle ahead of the wave so I can surf to shore in style. End of aside.


I think the use of the term "recipe" in this book may not be the best word; while the code is enough for me, the beginning of the book says one sort of audience this book is supposed to cater to is people who know the basics of JSF and not much more. Such a user may not know anything about, say, setting up netbeans or glassfish and could be given a little more help possibly. Typically a recipe in a cookbook spells out precisely what you need to do to make it happen. Of course if you do not have a tablespoon, or know what a degree of temperature is, or what an oven or a stove is…well you have a problem. I will continue to reserve judgment.


The second example is a good example for f:convertNumber component; it shows lots of different usages for anybody needing them. At the moment I do not, but it is nice to know this resource exists for reference or to teach a beginner. Also I enjoyed seeing some usages of Max* attributes, as I have mostly used patterns when I needed them.


I really like the next example…especially the usage of locale. I have not used the locale features of JSF much, and it is nice to know there is that flexibility whenever we may need it.


The next recipe is a toughy. This seems like a tip/trick, of which it will take me a while to discover the true value. This recipe deals with JSF sometimes inconvenient habit of not being able to use a converter to deal with null values, because converters are not fired. This is an annoying feature of JSF. The nice thing about JSF 2.0 is that there have been some new additions to help alleviate this pain (NOTE TO SELF: GO RESEARCH WHAT THESE ARE AGAIN). But it is always good to have many ways to do something in case one particular method has side effects you do not like. So thank you very much, Mr. Leonard. I will have to read it through a few times and maybe implement the recipe before I completely get what it is doing.


This keeps occurring in this book. I can tell that Mr. Leonard is probably not a native English-speaker (just like I did not grow up speaking Romanian, which may be Mr. Leonard's nationality and native tongue). What keeps occurring is I keep getting distracted by certain usages of the English language. These usages may make sense in Romanian (assuming that is Mr. Leonard's native tongue), or they may be perfectly fine usages of this word in some dialect of English, or perhaps they sound like other English words and get swapped out for the correct word, or perhaps Mr. Leonard is just creative. At any rate, I am having trouble reading the text of this book quickly because of strange usages of interjections that are not used quite right (in my opinion), words that are close to some other word like "particularity", and words that are not helpful, like "Placebo.". In the case of particularity, I think he might have meant "peculiarity" or probably some other word. He seemed to want to say that the hash codes on null objects will be different than the hash codes of non-null objects when using this class. And the use of Placebo brings to mind the usage of a sugar pill instead of actual medicine. Maybe NullConverterObjectHelper would have been another choice that would have made more sense when read back.


Still though, I would have never thought of this approach; so: bravo, Mr. Leonard, for your creativity, and thanks for the tip and the insight into directly overcoming this problem.

7/5/2010 1:52:33 PM


I implemented his example, and now I see clearly what he was trying to accomplish: whereas before I thought he was trying to obtain a substitute for the required attribute for EditableValueHolder components, which would still run use the converter, I see in his example he is trying to also intercept an initial value as well of the managed bean property in question. I am not sure however why he decided to make hashcode Placebo return a value…why not just look for instanceof Placebo in the converter? I am also trying to decide in my own mind if Placebo was really the ideal name for this class. It's purpose is to substitute for a null value…but it serves a real purpose, unlike a real-life placebo…ah, who knows anyway…I know what he means.




No comments: