Saturday, September 26, 2020

Bold source is available!

Yes, finally Bolds source is available !

To make a long story short, her are Bold for Delphi repository.

The longer story

I begin working with Attracs in autumn 2005. I had no knowledge about Bold or even Delphi. First Bold seems hard to learn and cryptic. But after a while, I saw the beauty in it. Less code that does more. The level of abstraction is increased. This is perfect for complex business logic. It felt strange that it was only available for a few developers because Borland/CodeGear/Embarcadero keep the IP and have no maintenance.

May 2012. Seriously I started the idea to make Bold available for the whole Delphi community at summer. By an accident, my achilles tendon was cut off. I could not work, have to use crutches and I was restless. I thought what a waste of time and intellectual resources with many unofficial forks of the same thing, original Bold. I wanted Bold as open-source, free to everyone to use, inspect, and improve the code. Probably I was naive that I could change the current situation. But I realize that send a single email to Embarcadero wouldn’t change anything. A petition could be a possibility. So I set it up and tried to spread the word. Not much happened. But after a while, ADUG posted a blog about this on DelphiFeeds. And the number of signs increased. A lot of comments revealed the frustration of the situation. It appears that there was a lot more demand for a framework like Bold than I initially guessed.

August 2012. Now I got attention from Embarcadero. After some emails, I and representatives from my employer Attracs had a Skype meeting with Embarcadero. We all agreed on NDA. I was so amazed and happy that they talk about to publish the code. Finally! But Embarcadero was busy to deploy new versions of RAD Studio so 3 versions passed, XE3, XE4 and XE5. Occasionally I have discussions with Embarcadero when they had time.

October 2013. Finally, we arranged a second meeting on Skype with Embarcadero, myself and representatives from Attracs. Unfortunately, the meeting failed. Embarcadero had terms for the license that Attracs could not accept.

January 2014. I had another Skype meeting with Embarcadero. We discussed how to continue as we both have common interests in Bold. But no concrete result from this.

September 2014. Meeting by phone with a representative from a german company. They are stuck with Bold and D2007 like Attracs but unlike Attracs that have no access to the full source. We agreed they will contact a german lawyer to clarify the legal situation. The lawyer got access to the license draft from Embarcadero and our BoldScala license from 2002. A clause was added to the license to protect developers in case Embarcadero change license conditions. The license was inspected by Embarcadero.

When Marco Cantu begins working as a product manager at Embarcadero I begin to email him. We agreed that it makes sense to have Bold as open source. But he thought it would take a long time before it would happen. And he was correct, it took a long time. I have dreamed about this but it is real now! We should send a big THANKS to Marco Cantu for his work to realize this. I don't believe it has happened without him.

But this is just the first step on the journey. There is so much to do.
There is now a Slack space dedicated to Bold for Delphi and how to organize stuff.
If you are interested in Bold I can invite you if you send an email to roland(dot)bengtsson(at)gmail(dot)com.

Current situation and roadmap
  • Current source is for D2006/D2007. There is a missing file due to copyright problem but we work to solving that
  • Attracs Bold version is for Delphi Sydney. We will publish that when som dependencies are removed.
  • Bold have no visual UML editor. There are discussions of the best options.
  • The documentation is a bit old. Not many examples and demos for beginners. If you feel not confidence to change in Bold itself here is a field that welcome more contributions. Maybe a Youtube video "Getting started with Bold for Delphi"!
  • We have some unittests but as always there is much room for improvement.
  • Currently it feels like we try to support D2007 but has focus on later Delphi versions.

Finally I want to thanks to all that signed the petition. Without that I don't think we got the attention from Embarcadero and Bold would still be closed. To ADUG that posted my petition, that step spread the word a lot. And to Embarcadero company that agreed to publish the source to customers.

Roland Bengtsson

Wednesday, August 19, 2020

Bold will be open source !!!

 Wow, I have never been so excited about a sentence in a blog post.

I started eight years ago trying to convince Embarcadero that open source is the only way to move forward. I created a petition about it Thanks for those that signed it and make attention to Embarcadero. And today I see this blog

This summer we will also open source the code base of Bold, which is a sort of low code solution for RAD Studio. We have a passionate group of Delphi community experts who will take that effort forward.

We have our Bold source in a private repository and can contribute anytime. It has been in production for 17 years now. We make continuous bugfixes and optimizations in the source. Sometimes also new features. Currently, we are using Delphi 10.3 Rio but will soon switch to 10.4 Sydney.

If you are a Bold developer or maybe just interested in model-driven development you can send a message to me at  roland.bengtsson(at) with questions or thoughts. But the first and most important move, to wait for Embarcadero publish to the source 

Roland Bengtsson

Saturday, February 24, 2018

Validation of data

Sometimes when I analyze data in database I discover bugs.
For example if a class/table TripEvent contains 2 date attributes ArriveDate and CompleteDate.
Of course ArriveDate is always before CompleteDate. But for some reason the order is wrong in database. There is logic in code that decide the dates but I have no idea how it can happen.

I can add validation of data before it is persisted to database. The method TBoldObject.PrepareUpdate is virtual and is called just before the object is persisted. This is a good place to validate data. The business rule:

ArriveDate <= CompleteDate

ArriveDate should always be less or equal to CompleteDate.
What happens if this rule is violated it is up to us to decide.
In this case I want an exception  so no data is saved to database. This is done by a rollback in the global exceptionhandler. I use Assert as this is a convenient way to validate data. Just check that Assertions is enabled in compiler settings.

procedure TTripEvent.PrepareUpdate;
  if not (M_ArriveDate.IsNull or M_CompleteDate.IsNull) then
    Assert(ArriveDate <= CompleteDate,
      Format('Validation failed as ArriveDate %s > CompleteDate %s', [DateTimeToStr(ArriveDate)DateTimeToStr(CompleteDate)]));

Before validation there must be a nullcheck as there is no point compare null values.
Now if validation failed an exception is raised and that is logged with callstack.
I can now see where in the source it is called and easier fix it.

Sunday, June 11, 2017

True Unit tests in Bold ?

I think you all heard about unit testing. Maybe some of you even practise it?

I recently bought Dependency Injection book by Nick Hodges. It is about to have loose coupled classes. And this is a precondition for true unit-test where each class is tested independently.

This make me thinking. How would that be possible in Bold? An important part in Dependency Injection is interfaces but the model don't support that now. Ex class TPerson have a link to TAdress. There may also be a method like TAdress.AddPerson(aPerson: TPerson).

To test AddPerson with a unit-test one interface is needed IPerson. The signature need to be changed to TAdress.AddPerson(aPerson: IPerson). Now the interface can be used instead. The same is true for any relations between classes. If there is a single link TPerson.homeAdress: TAdress that should be changed to TPerson.homeAdress: IAdress.

Our main Application Attracs have a huge model. Over 400 classes. So to change this some kind of automation is needed. I thought about to scan businessclasses.pas with a program and generate a new file businessclasses_Interfacedef.pas to differentiate with the original businessclasses_interface.pas.

The new file would contain interfaces to classes in businessclasses_interface.pas like IPerson, IAdress etc. The public methods in each class should be added manually as you cannot indtroduce a lot of interfaces in am application in one step. Easier to divide it in smaller steps. So the generation of file businessclasses_Interfacedef.pas preserve existing methods. New interfaces has no methods.

Next step would be to change application code to use interfaces.

Instead of

vPerson.homeAddress as TAddress;


vPerson.homeAddress as IAddress;

And I think this is the main issue, a lot of changes is required.
But it can at least be done in smaller steps, class by class.

And the rewards is possibility to use true unit-testing. Test all methods in a class. As interfaces is used in relations and parameters fake instances can be used.

Comments are welcome because all this is completely untested. I just brainstorm here :)

Tuesday, March 7, 2017

Saturday, January 7, 2017

Help me to make Bold open source project!

About 4 years ago I started this petition to make Bold open source. 
Right now there is 278 supporters.

What is Bold
It is an ORM framework founded by a Swedish company Boldsoft that later was bought by Borland around 2002. The idea with Bold is that the UML model is the core of an Bold application. It is in the model you store the logic classes and relations. This is then automatically translated to a SQL script to be applied to the database and class definitions. 

Bold do the translations of rows in database to objects in memory in both directions.

For example to read the name of a table called Person

myName := Person.Name;

To update the name:

person.Name := 'Bob';

So this is much more intuitive that writing SQL and less error prone.
It has also a lot more to offer like:

  • OCL that is a side effect free (readonly) query language invented by IBM.
  • Derived members to calculate links and values automatically when needed.
  • The algorithm can be implemented in OCL or in Delphi code.
  • As no direct SQL is used switch database is often painless. Bold framework use only basic SQL for DB communication.
  • GUI is automatically updated. Bold components that show values is automatically updated whenever value in database is changed. This is even true in a multiuser environment. One user can make a change, one second later all other clients is updated with new value. Bold do all the work behind with the service (OSS Object Synchronization Service).
  • For those that have bought Devexpress VCL components there is a separate repository that adapt the components for Bold. Result is a much modern look & feel and Bolds features.

More information about Bold in wikipedia or just ask me.

Latest official release of Bold was in Delphi 7 Architect.
There is also an unofficial version for D2006 (and D2007 as they are binary compatible).
But after this Borland, CodeGear and Embarcadero have been quiet about Bold.
And this left many customers behind that hope for updates. I think many developers left Delphi because of this. 

The future ?
But Bold has been actively developed for those that have the source. My company is an example of that. We have fixed both bugs, optimized it and add more features. We love the idea of Bold as open source. But Embarcadero owns the IP, so we must have their explicit permission before we publish anything. Bold has shown the strength in our case as it is been used in production since 2003.

I restarted the dialog with Embarcadero again about Bold as open source. 

What can you do ?
So what we want to know is this:

  1. What are the interests for Bold now ?
  2. So if Bold was opensource, compatible with Delphi Berlin and actively developed, what are the chances you upgrade to latest Delphi ? Would you buy several licenses ?
  3. Does it matters if Bold is true open source developed independently. Or is it better to have same state as VCL ? Then the source is maintained by Embarcadero and shipped with the Delphi installation.

Please answer if you have the slightest interests to use Bold in the future for your applications with all those amazing features I listed above.
You make no promises. We just want to investigate the interests.

Comments, questions is encouraged!