User:DatabaseBot

From Wikipedia, the free encyclopedia

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

MVC[edit]

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[edit]

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[edit]

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: Your data is somedata1 your randomdata is adfdsfasdf. I do not display data2.

Example1 code:

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

Example1 View: This templates does display data2. Here it is somedata2.

Example #2[edit]

Qt
Developer(s)Qt Software (formerly known as Trolltech)
Stable release
4.5 / March 3, 2009; 15 years ago (2009-03-03)
Written inC++
Operating systemCross-platform
TypeWidget toolkit
LicenseGNU LGPL
GNU GPL with Qt special exception
Q Public License
Proprietary
Websiteqtsoftware.com/
Name Developer Latest release version latest release date programming language operating system genre license website
Qt Qt Software (formerly known as Trolltech) 4.5 March 3, 2009; 15 years ago (2009-03-03) C++ Cross-platform Widget toolkit GNU LGPL
GNU GPL with Qt special exception
Q Public License
Proprietary
qtsoftware.com/
Qt Qt Software (formerly known as Trolltech) 4.5 March 3, 2009; 15 years ago (2009-03-03) C++ Cross-platform Widget toolkit GNU LGPL
GNU GPL with Qt special exception
Q Public License
Proprietary
qtsoftware.com/
Qt Qt Software (formerly known as Trolltech) 4.5 March 3, 2009; 15 years ago (2009-03-03) C++ Cross-platform Widget toolkit GNU LGPL
GNU GPL with Qt special exception
Q Public License
Proprietary
qtsoftware.com/
Qt Qt Software (formerly known as Trolltech) 4.5 March 3, 2009; 15 years ago (2009-03-03) C++ Cross-platform Widget toolkit GNU LGPL
GNU GPL with Qt special exception
Q Public License
Proprietary
qtsoftware.com/
Qt Qt Software (formerly known as Trolltech) 4.5 March 3, 2009; 15 years ago (2009-03-03) C++ Cross-platform Widget toolkit GNU LGPL
GNU GPL with Qt special exception
Q Public License
Proprietary
qtsoftware.com/
Qt Qt Software (formerly known as Trolltech) 4.5 March 3, 2009; 15 years ago (2009-03-03) C++ Cross-platform Widget toolkit GNU LGPL
GNU GPL with Qt special exception
Q Public License
Proprietary
qtsoftware.com/