Creating a user interface from a database - good, bad, and ugly?

I read the instructions somewhere that creating a user interface automatically from a database layout (or business objects or any other business level) is a bad idea. I can also introduce some good challenges that you will have to face in order to do something like this.

However, I did not see (and could not find) any examples of people's attempts. So I wonder - is it really that bad? This is definitely not easy, but can it be done with any success? What are the main obstacles? It would be great to see some examples of successes and failures.

To clarify - with “user interface generation automatically”, I mean that all forms with all their controls are generated completely automatically (at run time or compilation time), based possibly on some tips in the metadata about how the data should be presented . This is different from manually designing forms (as most people do).

Added: Found this somewhat related question

Added 2: OK, it seems that one of the ways to get good results is the availability of metadata related to the presentation. For this approach, how much will be “enough”, and will it work less than constructing a form manually? Does it also provide more flexibility for future changes?

+6
user-interface auto-generate
source share
6 answers

We had a project that will generate database tables / stored procedure, as well as a user interface from business classes. This was done in .NET, and we used many custom attributes for classes and properties to make it behave the way we wanted it to. It worked great, and if you manage to follow your design, you can easily customize your software. We also had a way to enter “custom” user controls for some very exceptional cases.

All in all, it worked well for us. Unfortunately, this is a sold banking product and there are no available sources.

+5
source share

this is fine for something tiny where all you need is a utilitarian method for entering data.

for anything that looks like a real application, although this is a terrible idea. what a good user interface does is the humanization factor, a bit that you tweak to make sure that this machine responds well to human touch.

you just can't get it when your interface is created mechanically ... well, maybe with something approaching AI. :)

edit - to clarify: the user interface created with the / db code is great as a starting point, it's just the garbage endpoint.

+4
source share

hey it's not at all complicated, and not at all a bad idea. it all depends on your project needs. many software products (of course, not projects, but products) depend on this model - therefore, they do not need to rewrite their / ui code logic for different customer needs. Clients can customize their ui the way they want to use the design form in the admin system.

I used xml to save metadata for this kind of thing. Some of the attributes that I saved for each field were:

  • friendlyname (signature)
  • haspredefinedvalues ​​(yes to delete the list down / multi-flag)
  • multiselect (if yes, then check the list box, if there is no drop-down list)
  • data type
  • MaxLength
  • required
  • Minvalue
  • MAXVALUE
  • RegularExpression
  • enabled (show or not show)
  • sortkey (order on web form)

in terms of positioning - it was all the same to me and just generating tables tr td tags 1 under another - however, if you want to implement this as well, you can have 1 more CssClass attribute where you can define specific properties of ui (look and feel, positioning and etc.) here

UPDATE: also note that many e-commerce products follow this kind of dynamic ui when you want to enter product information - as their customers can sell everything under the sun from furniture to sex toys ;-) so instead of rewriting they simply allow their customers to enter metadata for product attributes through the admin form: -)

I will also recommend that you take a look at the cost model of an attribute object — it has its pros and cons, but I feel that it can make good use of your requirements.

0
source share

There are some things in my opinion that you should think about:

  • Does the user require a user interface customization feature?
  • Are there many different attributes or elements?
  • Should I try to create such a "rendering engine"?

Well, I think it's pretty obvious why you should think about it. It really depends on your project, if such a model makes sense ... If you want to create several forms that can be customized at runtime, this model can be very convenient. In addition, if you need to make many small tools, and you use it as a kind of “engine”, then this may be worth it because you can save a lot of time. With this “rendering engine,” you can automatically add error reports, check values, or add other things that always accumulate with the same template. But if you have too many of these things, elements or attributes, performance can quickly decline. Another thing that becomes interesting in large projects is that the changes that must occur in each form must be made in the engine, not in every form. This can save a lot of time if there is an error in the finished application.

In our company, we use a similar model for the interface generator between cash-software (right now I can’t remember the right word for it ...) and our application, just that it does not create a user interface, but an output file for one of the applications. We use XML to define the structure and how to translate values, etc.

0
source share

I would say that in most cases the data is not suitable for generating a user interface. That is why you almost always set up a layer of logic between interpreting database information to the user. Another thing is that when you create a user interface from the database, in the end you will see the internal operation of the system, which you usually do not want to do.

But it depends on where the database came from. If it was created to accurately reflect the goals of users of the system. If the user model that the application should help them is stored in the database. Then it might work. But then you have to start from the end of the user. If not, I suggest you not go this way.

0
source share

Can you look at your problem in terms of application architecture? I see you as another database terrorist, trying to solve everything by writing stored procedures. Why do i need an interface? Try to do this in a DB script. In essence, this approach - what composite system will you find yourself on? When the system serves different enterprises - try modulation, selectively detected components, limit links to links. The user interface must be replaced, regardless of the business level. When storing so much data in the database - the hard dependency of the UI system becomes monolithic. How do you implement the MVVM pattern in a script when creating a user interface? Designers such as Blend contain many features that cannot be replaced by most futuristic user interface generators - unless your development platform is Notepad.

0
source share

All Articles