problems
- easy to forget default limit is there - get dropdowns with just a few options, etc
- have to specify arbitrary-ish big number for
page_size
to remove limit. how to choose?
benefits
- not having to remember to implement paging
- query performance by default
possible solutions
- don't used
PagedView<>
for lookups or queries where consumer probably won't want paging - don't make
page_number
optional for queries with paging: throw error if missing. can't mistake that it's a paged view then - only use paging if
page_number
/page_size
specified
KJ - prefer 1&2, 3 could mean getting in the habit of not paging, having slow queries + big results pages?
I agree that 1,2 are good ideas. I have seen a couple of cases where PagedView has been used when it probably shouldn't have been (unfortuantley can't remember where exactly). I think making
page_number
required for paged queries would have helped in these cases and possibly would have made the developer question whether PagedView was the best option. Could it be a part of the code review to check that limits and defaults are sensible?