Sunday, March 3, 2024

Paginator on pseudo object example

This example it show the evolution of the application of variables.


Lets look at a paginator.


Often we only declare one variable : "string paginator_result". and applay the math directly on it. So it may end width something like : paginator regult = (100 / 10 = 10).

 But some parts repeat throw all programing languages. Expecialy the variables involved in Math in this case: total rows will devide by rows per page to achieve the amount of pages to be filled or be display in the interface. 

So we have 100 rows per 10 items we goat 10 pages and this need to go in to the interface. By this example you can understand that our prototypes start to assemble. As we dismount more and more parts of the planning in to the structure that's why i call it structural programming we start to assemble a structure throw prototypes.


lets see the new look, but if we separte in to parts the paginator :


  • paginator_total = 100
  • paginator_rows_page = 5
  • paginator_current_page = 1 
  • paginator_generated_pages = 20


paginator_generated_pages = paginador_total_rows / paginador_rows_page = 20


If we lather need to access any of the parts things are much more robust.

  • paginator_name 
  • paginator_id 
  • paginator_total = 100
  • paginator_rows_page = 5
  • paginator_current_page = 1 
  • paginator_generated_pages = 20
  • paginator_db_extension = mysql
  • paginator_type = dtr



This secound code already allow to a much more robuest inter action. We can decompose this new form in to small types of actions. For example to load paginators in to the DB if you want to do more complex things. Have diferent types of paginatores working in diferent ways or languages.

In paginator type we could define like 3 types = text / DB / Code . 

  • Code will be just a raw paginator
  • DB a dinamic throw the db
  • Test a DTR dinamic file access

No comments:

Post a Comment

hi

Rules

Rules, Steps & methods This is the current way to implement and be implemented but there could be more things to add : Root or loader  (...