There are scenario in project lifecycle where developer creates SOQL or Dynamic SOQL to return expected result. Also if requirement changes they go back and change existing code to reflect updated SOQL. If you are good developer and avoid to change Apex code at most you will save your SOQL in “Custom Settings” and utilize in Dynamic SOQL.
However, There is very good design Developer can suggest to client. Instead of going to your code and changing code for new requirement, how it sounds if we can utilize existing List View inside Apex or Visualforce only 🙂 ? It will solve lots of problems and if requirement changed, just change or create new Listview and it will reflect in your Visualforce code. We can almost have same functionality like Navigation buttons and Paging without writing any complex code logic, thanks to StandardSetController capabilities.
There is also very good article on Salesforce blog on various approaches suggested for pagination and one of them is using StandardSetController.
To keep article simple, I am posting complete Visualforce and Apex code with Comments inside. Account object is used as an example here.