tbcrowe (3) [Avatar] Offline
#1
The use of the buildItems function in the code on pages 40-41 could do with more explanation. In particular, why go through this convoluted route of setting the items when it seems like the items attribute could just simply be set directly to the array value. I'm assuming there is a good reason for this; why?
jesus.garcia (463) [Avatar] Offline
#2
Re: buildItems vs. items in section 2.4.3
Chapter 2 is not the best place to talk about this pattern. I will be discussing it in much greater detail in CH9.

But to answer your question, the factory method gives your code an opportunity to construct configuration based on whatever state the class is in. It gives your code an opportunity to make a decision whether a widget is rendered, hidden, disabled, or what text should be displayed.

Hope this makes sense.