User:DatabaseBot

{{bot|Gsonnenf|status=unapproved}}

This bot will be used to maintain a pseudo database for rendering Lists, Infoboxes and other templates.

=MVC=

This bot is a fan of model–view–controller (MVC) architecture and believes data should be separated from its control and view. For those unfamiliar with the MVC architecture the following gives a brief description as it applies to this particular implementation:



  • Model - This contains some data you might want to display. This would be held in some sort of data structure or database.

  • View - This displays data to an end user. This would be the HTML page given to a user in our case.

  • Controller - This converts the data into a form that can be used by the view. In our case, this would be a template such as infobox or listbox.

DatabaseBot doesn't utilize strict MVC but instead follows MVC principle within the Wikipedia framework.

=Visitor Pattern=

This bot utilizes the Visitor Pattern in its databases. This model allows rendering logic to be injected into a data structure. This pattern works exceptionally well with the Wikipedia template style. Other patterns may be usable but may add unnecessary complexity and difficulty to implementations.

  • Data structure (Model): A template with the following form.
     {{ {{{visiting template}}} | data_name_1 = data_value_1 | ... | data_name_N = data_value_N }} 
  • Visitor (controller) : A Template that uses some data:
     ... "Template text" {{{data_name_x}}} "template text"... 
  • Usage (view): The following tag can be used to display the above members in a page:
    {{ Datastructure | Visitor }}

=Example Usage=

Model example

Page:User:DatabaseBot/Data:Example

Page Contains:

 {{ {{{1}}} | data1 = somedata1 | data2 = somedata2 | randomdata = adfdsfasdf }} 

Control example

Page1:User:DatabaseBot/Template:ExampleTemplate1

example1:

 Your data is {{{data1}}} your randomdata is {{{randomdata}}}. I do not display data2.

Page:User:DatabaseBot/Template:ExampleTemplate2

example2: This templates does display data2. Here it is {{{data2}}}.

View example

Example1 code:

 {{User:DatabaseBot/Data:Example | User:DatabaseBot/Template:ExampleTemplate1 }} 

Example1 View: {{User:DatabaseBot/Data:Example | User:DatabaseBot/Template:ExampleTemplate1 }}

Example1 code:

 {{User:DatabaseBot/Data:Example | User:DatabaseBot/Template:ExampleTemplate1 }} 

Example1 View: {{User:DatabaseBot/Data:Example | User:DatabaseBot/Template:ExampleTemplate2 }}

=Example #2=

{{ User:DatabaseBot/testpage | Infobox Software }}

class="wikitable sortable" style="font-size: 85%; text-align: center; width: auto;"
Name

!Developer

!Latest release version

!latest release date

!programming language

!operating system

!genre

!license

!website

{{ User:DatabaseBot/testpage | User:DatabaseBot/Template:list }}

{{ User:DatabaseBot/testpage | User:DatabaseBot/Template:list }}

{{ User:DatabaseBot/testpage | User:DatabaseBot/Template:list }}

{{ User:DatabaseBot/testpage | User:DatabaseBot/Template:list }}

{{ User:DatabaseBot/testpage | User:DatabaseBot/Template:list }}

{{ User:DatabaseBot/testpage | User:DatabaseBot/Template:list }}