Re: Specifying all biz rules in relational data

From: Fredrik Bertilsson <fredrik_bertilsson_at_passagen.se>
Date: 12 Sep 2004 00:19:16 -0700
Message-ID: <31f7e57d.0409112319.7338f6e0_at_posting.google.com>


> My own experience and inclination has always propelled me towards code
> generators

Code generation is done because the programming language and the used components is too low-level. If you had a languages and components good enough, code generation is unnecessary. Let's have an example.

In my sourceforge project (http://butler.sourceforge.net), I have a code generator that generates java classes for tables in a database schema. If you have a column named "ConctactName", the generator will produce two methods:
* public String getContactName()
* public void setContactName(String name)

But if you have a more powerful language, like Python, with dynamic properties, you can retrive the value for "ContactName" by typing:   record.ContactName
And generated classes is not needed.

It is also very important not to generate more than absolutely necessary. In Butler a fragment of a generated class would look like this:

public String getContactName()
{
  return (String) get("ContactName");
}

As you see the generated code do nothing more than casting the return type and eliminates the usage of typing column names as strings.

The real functionality is inside the get-method of the super class.

> I wonder what the participants in this newsgroup feel about that
> proposition, that being that a database application can have its entire
> behavior defined by scalar values that can themselves be organized into
> relational tables.

I agree with you that most of the GUI in a database-centric application can be defined in a declarative way. But there are also large parts of applications that need as procedural (programming language) definition. But if your solution still makes it possible to have procedural definitions there it is needed, it is a splendid idea. In modern application development (specially the GUI part) there are done a lot of coding that could be solved in a declerative way instead, with much less effort.

But I also think that application development could be simplified using more high-level languages. Some years ago it was very popular with trying to storing business logic in XML-format. But the reality showed that this was only possible in some situations. (For example: Web applications can be defined in XML using tag labraries, but it is much harder to do with swing appl). But using a language like Python would make a very compact solution.

/Fredrik Received on Sun Sep 12 2004 - 09:19:16 CEST

Original text of this message