Rawpixel Ltd.

I was asked to chime in on a question on FaceBook… 

The question

“What should I use for writing database centric desktop applications? FireDAC or TMS Aurelius”

Many good replies were made, and I attempted to make one too.
Unfortunately Facebook did not accept my quite lengthy reply, hence this blogpost which I assume can be of use for others aswell.

The reply

Jens Fudge Absolutely…. I’m always up for doing some promotion for kbmMW  

First why not to use kbmMW (as we know it from the old days):
 
In this case it has been mentioned it is a database centric desktop application. Hence there are no direct mentioned requirement for a multitier solution, although I would argue that if there are going to be multiple desktop applications that will access the same database, I would recommend looking for a 3-tier solution with an application server in the middle, which is the original design goal for use of kbmMW.
 
However, now I will mention why to use kbmMW (as it is today):
 

1) The ORM:

You obviously have looked at how to abstract datastorage, since you have TMS Aurelius on your list of interesting tools.
 
kbmMW contains a very capable ORM (Object Relational Modelling) tool probably with many similarities to other tools in the sense that you can define (or get defined) a set of Delphi classes thru which you can operate your database.
 
Hence if you have a “person” table you would usually also have a Delphi class (a model) named TPerson which (depending on framework) match the database table in various ways.
 
kbmMW is able to make those models for you, and it can even keep track of minute changes in the models vs how the actual database table has been designed and make any change needed while keeping your data intact.
 
So if you need a field, you simply add it to your model. Lets say you need an Age field in your TPerson model, then you just add it potentially as a field or a combination of field and property as you would normally do in Delphi code:
 
property Age:integer read FAge write FAge;
 
Then tell kbmMW to update your database based on the model like this: ORM.CreateOrUpgradeTable(TPerson);
kbmMW will figure out everything by itself, and ensure you will have another field in the database.
 
When you want to look for a person instance, you will use ORM.Query<TPerson>(…..)
where the arguments to Query can be a the model fields to search on or a kbmMW SQL query statement if you want to do something more complex. eg:
 
SELECT Name,Age*2 FROM uMyModels.TPerson ORDER BY Age DESC
 
It supports joins, grouping, and much much more.
 
I chose to use an own SQL syntax because most people know SQL, and the attempts where you have to combine various Delphi statements to get the same result are usually much less readable.
 
What is important to understand, is that kbmMW does not just forward the statement as is to the database (unless you want it to). It compiles it itself, and applies the result on the database, using whatever syntax the database supports. Hence you only need to know one SQL syntax (kbmMW’s) and it will work against all databases supported by kbmMW’s ORM.
 
There are obviously many other details in this. There are loads of info about the ORM here:
 
 

2) SmartBinding

 
SmartBinding is designed from scratch for end user applications, doing something of the same as LiveBinding is doing, but in a completely different way, which means it is easy to refactor your applications without loosing your bindings. Further SmartBinding use one syntax for binding just about any type of model or control with any other type of model or control with a single syntax. No weird intermediate class instances are needed. Everything is handled by SmartBinding.
 
You can read more about SmartBinding here:
 
 
 

3) SmartEvents

 
Where SmartBind is the glue between data and presentation, SmartEvent is the glue between triggers and events. What happens when?
It is basically Delphi’s events on steroids, and made in such a way, that you can always refactor your application without your event setup being damaged, unlike Delphi events.
That also means you can easily load in and unload visual frames or forms and have them automatically get live data and bind the frame/form’s functional elements (like buttons etc) into the existing application framework without having to you manually needing to rebind your events.
 
You can read more about SmartEvent here:
 
 
and you can see a presentation about both SmartBinding and SmartEvent here:
 
 

4) Configuration

 
Your application usually will need some sort of configuration. The simplest way is reading stuff from an INI file or the registry. But what if you could make configuration handling easier? kbmMW also bundels that feature which you can read about here:
 
 
The blog mentions REST, but the configuration framework is generic and can be used for anything.
 

5) Logging

 
You will also want some sort of smart logging mechanism. Again kbmMW contains a very advanced one you can use:
 
 
Again this article mentions REST but it is completely generic and can be used everywhere you need it.
 

6) Scheduler

 
Your application most likely needs some sort of timer based stuff… “Do something at specific times” kind of thing. kbmMW comes with the most complete Scheduler for Delphi which you can read about here:
 
 

7) Date/Time

 
Most applications talking directly or indirectly with a database, needs good date/time handling. Delphi has TDateTime, but it is really just a floating point value, which has no knowledge about which time zone the time is in.
 
That results in many developers really not coding for multiple time zones. They expect their application and data will only be used locally within one time zone, but the truth of all is that applications work globally and interaction between data from different places on the globe is increasingly happening. Hence TDateTime is seriously outdated.
 
kbmMW comes with TkbmMWDateTime which is a TDateTime on steroids and supports all sorts of formats and date/time parsing and conversion. Read more about it here:
 
 

8) LINQ

 
It is more a nice to have than need to have feature, but it does make some things much easier.
 
Basically kbmMW’s LINQ allow you to do various operations on an object or a list of objects, datasets, stringlists, XML/JSON/YAML etc. like calculating sum, filtering, grouping and splitting, ordering and much more in a very simple way.
 
Read more about it here:
 
 

9) XML, JSON, BSON, MessagePack, YAML?

 
You may have requirements to manipulate all of these types of data, and you may need to be able to convert seemlessly between them. kbmMW comes with all the tools for that, based on the kbmMW object notation framework. Read more here:
 
 
 
kbmMW even supports analysing your data and produce Delphi classes that can be used for reading, writing the data and convert it to any of kbmMW’s supported formats.
 

10) Memory debugging/leak tracing/stack info.

 
All also available in kbmMW.
Read here:
 
 

11) Security, safe passwords, state of the art encryption, random numbers and hashing methods

 
kbmMW contains it all, inclusive:
 
 
I could go on and on, because kbmMW is simply such a vast toolbox for anything Delphi central framework for all things development. You will not find a framework anywhere with the amount of quality features that kbmMW provides out of the box.
 
So you should choose the method that you feel comfortable with.
If you want the most complete framework, there really are no alternatives to kbmMW.

 734 total views,  5 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.