The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

tbcrowe (3) [Avatar] Offline
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
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.