# Makumba: query-centric web-applications for NGOs

FSCONS Gothenburg, 07-09 December 2007

Manuel Gay

, <manuel@makumba.org>

# Introduction

- framework for web-development, spanning from the data to the interface (JSP)
- developed since 2001, currently version 0.7 (revision 2153)
- basic training takes 2h
- NGO BEST (Board of European Students of Technology)
- textual replacement for Lotus Notes
- BEST IT group:
  - approx. 20 amateur developers, high turnover of members (10 new / year)
  - loosely coupled group (spread everywhere over Europe)

# Makumba Philosophy

- be easy to learn, yet powerful for advanced users
- have easily readable and understandable code
- be simple to configure
- query-centric: SQL-like language, easy to read
- HTML as a simple language, familiar to many
- scale for large applications and large developement teams
  - Karamba! webapp: 2800+ JSPs, 200+ Java Business Logic files, 100+ data structures
  - doubled its size since 2002

# Makumba Data Definitions (MDDs)

- each data definition represents one object
- MDDs are simple propery files
- few types (char, int, real, text, intEnum, binary) easy to learn
- relational types: ptr (pointer), set
- any language employing these database-like concepts (e.g. Hibernate mappings) can provide data definitions

### Example:

      # Person - simple data for a person
      name = char[50]          ;Name
      surname = char[50]       ;Surname or last name
      gender = int{"Male" = 10, "Female" = 20} ; Gender
      brother = ptr Person ;the brother
      cars = set Car       ;Cars of this person

      # Car - simple data for a car
      name = char[50]    ;Name of the car
      colour = int{"Green" = 10, "Blue" = 20, "Red" = 30}

# Displaying data: Makumba List

- query-based iteration
- can be nested and optimal queries will be composed
- query languages: OQL (Object Query Language), HQL (Hibernate Query Language)

### Example:

      <mak:list from="Person p" where="p.age > 18">
        <em><mak:value expr="p.name" /> <mak:value expr="p.surname" /></em><br/>
        Cars:
        <mak:list from="p.cars c" separator=", "><mak:value expr="c.name" /></mak:list><br/>
      </mak:list>

### Result:

John Doe
Cars: Audi TT, Audi A6
Foo Bar
Cars: BMW Z3

# Entering data: Makumba Forms (1/2)

- build on familiarity with HTML forms
- aim: getting things into the database with a minimum of efforts
- automatically generates the HTML necessary to display the form, depending on the data type of the fields

### Example:

      <mak:newForm type="Person" action="listPersons.jsp">
        Name:    <mak:input field="name"/><br />
        Surname: <mak:input field="surname"/><br />
        Gender:  <mak:input field="gender"/><br />
        <br />
        <input type="submit" value="Create" />
      </mak:newForm>

### Result:

Name:
Surname:
Gender:

# Entering data: Makumba Forms (2/2)

- combined list and forms
- can be nested

### Example:

    <mak:form action="editPersonCars.jsp">
      <mak:list from="Person p">
        <em><mak:value expr="p.name"/> <mak:value expr="p.surname"/></em><br/>
        <mak:list from="p.cars c">
          <mak:editForm object="c">
            Car ${mak:count()} name: <mak:input field="name" /><br/>
          </mak:editForm>
        </mak:list>
      </mak:list><br/>
      <input type="submit" value="Change">
    </mak:form>

### Result:

John Doe
Car 1 name:
Car 2 name:
Foo Bar
Car 1 name:

# Makumba Developer Support

- Source Viewer
- Code Generator
- Query interface

# Makumba Business Logics & Controller

## Business Logics:

- based on java
- at the moment, "per page" business logic
- makes it possible to perform validation, response actions (e.g. e-mail sending) and advanced processing before and after an object is created/modified/deleted

## Controller:

- "weak" MVC
- scales for large applications with a distributed development team (! Struts, template engines...)
- ensures independence between developers (possibility to easily divide tasks between members)

# Future

- Per-object Business Logic
- Hibernate / POJO-based business logic
- Query Fragments
  query functions in the MDD:

      cars = set Car ;cars of this person
      numberOfRedCars() = count(c) from cars c where c.color = 'Red'

  used in the JSP:

      <mak:list from="Person p">
        <mak:value expr="p.name" /> - <mak:value expr="p.numberOfRedCars()" />
      </mak:list>

- Per-object authorisation

      canEdit(Person p)= p.age > 18 AND p.numberOfCars() > 0

- further integration with Hibernate and Struts

# Thanks for your attention

## http://www.makumba.org

slide 1/12
* help? contents? restart?Copyright © 2005 W3C (MIT, ERCIM, Keio)