Programming Phoenix LiveView: P156

“…With this function, we name the concept of a base query and we provide one common way to build the foundation for all Demographic queries. This type of function is called a constructor. We’ll rely on it to create an initial query for demographics…”

I struggle to understand this paragraph

  1. “with this function “ - which function is being referred to? Query? base? for_user?.

  2. “we name the concept of…” do you mean something like “we introduce the concept of…?”

  3. “…we provide one common way to build the foundation for all Demographic queries…” It’s not clear how we do this.

Given that there are at least three new concepts being introduced here, it would be useful to expand the discussion, and/or provide a diagram or pseudocode to assist.

All great points/questions, thank you @asibbald! I’ll take them one at a time:

“with this function “ - which function is being referred to? Query? base? for_user?.

We do mean the base/0 function. I’ll clarify that in the next release :slight_smile:

“we name the concept of…” do you mean something like “we introduce the concept of…?”

What we mean here is that we are encapsulating the responsibility of the base query and giving it a name.

“…we provide one common way to build the foundation for all Demographic queries…” It’s not clear how we do this.

What we mean here is that the base/0 function provides this common functionality for the first step of writing any new query for demographics.

I think we can add some language to clarify this a bit.

Thanks for the response Sophie. I had figured all these out (so I guess it’s not that unclear!) but it did take quite a lot of reading forward and then coming back to this section a couple of times before the “penny dropped”
If you don’t mind, I’ll keep raising such issues - not so much to get an answer but more in the hope my experience will clarify where the issues are for at least some of your readers.

Please do keep raising these comments! Thank you so much for your feedback :slight_smile: