Gsoc08-querybuilder-Internals

From PostgreSQL wiki
Jump to navigationJump to search

Graphical Query Builder for pgAdmin Internals

The following document it's a technical explanation of the development of the Graphical Query Builder improvement for pgAdmin, at the Google Code of Summer 2008 (GSoC).

Main Idea

The main idea behind a graphical query builder, it's the creation of SQL sentences that can be used as basis for our real sentences or even it can be our real sentence, and this should be done in a faster way compare to manually creation of sentence. But the creation of sql sentences from figures drawn in the screen represent a challenge that can be resolved in several ways, some of this are very easy to implement but lacks of flexibility and others add very unneeded complexity to the equation of the GQB. But we should take care about other restrictions too like portability, usability and easy of maintenance.

Because this, from the beginning the main idea was to use the lesson learned from my older projects to create the initial design of the GQB, but always taking care of the development style of the pgAdmin project, and reutilizing source code always it can be possible. This bring me the idea that the source code should be write in way that allow the maintenance for third persons and that can be easy readily while sharing a simple common language for the structure of the software, and for this reason use software patterns for essential parts of the GQB like iterator and model view controller (MVC), and both of them were used in the development stages, but this can be explained in more detail in the next sections.

Development Work Week by Week

Week #1

The development just begun and there are a lot of things to do, but the basis for the GQB should be settled, and this step brings me to the creation of the standard of development for the GQB:

  • All headers files should be create at folder pgadmin\include\gqb.
  • Implementation of headers should be create at folder pgadmin\ gqb
  • All files should use the prefix gqb.
  • The initial interface is very simple and it’s composed of :
    • Tree where all objects that can be used in a query (like tables, views..) are show/stored for the user.
    • A canvas zone where the user can draw their Query using the objects in the Tree.



This week following objects were created for the implementation of the GQB:

  • Base Objects for storing reverse engineering objects from database:
    • gqbObject
    • gqbDatabase
    • gqbSchema
    • gqbTable
    • gqbColumn
  • Base for storing collections of objects:
    • gqbCollectionBase (Interface)
    • gqbIteratorBase (Interface)
    • gqbCollection
    • gqbArrayCollection
    • gqbArrayIterator
    • gqbQueryObjs
    • gqbQueryObject
  • Model View Controller:
    • gqbController
    • gqbView
    • gqbModel
  • User Interface:
    • gqbBrowser

[Explanation of the objects in the section classes]

How Works

The

Classes

Recommened Books

  • Elisabeth Freeman, Eric Freeman, Bert Bates, Kathy Sierra, Head First Design Patterns, O’Reilly, 2004
  • Jack Greenfield, Keith Short, Steve Cook, and Stuart Kent. Software Factories. Wiley Publising Inc., 2004.
  • Object Management Group. Model Driven Architecture Guide, 2003. (http://www.omg.org/mda)
  • Gamma, E., Helm, R., Johnson, R., Vlissides, J. Patrones de Diseño. Addison-Wesley, 2003.
  • Craig Larman. UML y Patrones. Prentice-Hall, 2ª Ed, 2003
  • W. H. Brown et. al, Antipatterns, John Wiley & Sons, 1998.
  • M. Fowler. Refactoring: Improving the Design of Existing Code, Addison-Wesley, 1999
  • M. Fowler. Analysis Patterns, Addison-Wesley, 1996
  • M. Fowler. Enterprise Application Architecture, http://www.martinfowler.com
  • F. Buschmann, et al. Pattern-Oriented Software Architecture. A System of Patterns. John Wiley and Sons,1996.

Other Resources

References