tag:blogger.com,1999:blog-75777435299489222382024-03-13T13:24:10.361+02:00Bold for DelphiDiscussion and thoughts about Bold for Delphi. The purpose of this blog is to spread knowledge about Bold among Delphi developers.Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.comBlogger26125tag:blogger.com,1999:blog-7577743529948922238.post-57913393207786680562022-07-27T18:34:00.009+03:002022-07-28T11:08:39.341+03:00Choose framework to make your application look modernOur main apps UI have got some critics. It looks old and boring.
I can can just agree. Indeed it looks boring with Delphis default color scheme grey, black and white. None in the team have any graphical talent. We simple prioritize features more than appearance. <div><br /></div><div>But to change that I try to investigate the best way to enhance UI.
The app use <a href="https://www.devexpress.com/Products/VCL/" target="_blank">Developer Express components</a> for grids, textedits, comboboxes etc.
But also standard VCL components at some places. So in other words. We want a general way to apply a style on both VCL and Devexpress components. I evaluated VCL Styles and DevExpress Skins. </div><div><br /></div><div><a href="https://docwiki.embarcadero.com/RADStudio/Alexandria/en/VCL_Styles_Overview" target="_blank">VCL styles</a></div><div><ul style="text-align: left;"><li>Come with Delphi. No dependency to third party components</li><li>There is a separate application Bitmap Style Designer that generate a style file.</li><li>Only one style can be used at a time per application. But possible to change style in runtime if several styles are included. </li><li>Possible to make exception and not style a certain component</li><li>If component is created in runtime it must have an owner or style don't work</li><li>VCL styles are limited to standard VCL components like TForm, TButton, TEdit, TCombobox etc.
Some are used in Attracs, but most are replaced by DevExpress components (This is biggest drawback)</li></ul></div><div><br /></div><div><a href="https://www.almdev.com" target="_blank">StyleControls VCL</a></div><div><ul style="text-align: left;"><li>Commercial package</li><li>Special adapting unit (unfortunately only available for registered users) to support VCL Styles in DevExpress controls. As Devexpress components is used this framework would be mandatory if VCL Styles would be used.</li></ul><div><br /></div></div><div><a href="https://docs.devexpress.com/VCL/150003/ExpressSkinsLibrary/vcl-skin-library" target="_blank">DevExpress skins</a></div><div><ul style="text-align: left;"><li>DevExpress had it own styles, they call it skins. This is built in another way than VCL Styles. </li><li>Skins are a bit more flexible than VCL Styles. I can apply one skin to whole application, a form or a single component.</li><li>Skins can be used both for Devexpress components and VCL components. This is very important for us.</li><li>I can also preview skin directly in designtime. With VCL Styles you have to run the application for that. Or see a sample in bitmap editor. </li><li>Beside bitmap skins there is vector skins. This is good for high resolution monitors as it never be pixelated when scale up. </li><li>There is also a skin editor that look more polished than builtin Bitmap Style Designer. </li><li>Change skin in runtime feels faster than change VCL Style.
</li><li>To generate an own custom skin is a bit more complicated. Often an existing skin is used as template like VCL Styles. A modified copy is then used. A new delphi source is generated from Skin Editor. That is then references in Application uses.</li></ul></div><div><br />To summarize. VCL Styles works fine. But DevExpress skins is better in most ways. Better performance, more flexibility and more polished in my opinion. If you can afford it, DevExpress is really the best choice.</div>Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-50357969284581601172021-03-16T08:27:00.002+02:002021-03-16T08:27:33.323+02:00Unittests in Bold. Is it possible ?<p> I started to explore interfaces. One of the reasons I want to know more about interfaces is that I want to use unittests. Interfaces are a key part that makes it easier to make the code more testable.<br />I worked with Delphi for a long time and I know the concept behind interfaces but never really created new ones and used them. I believe one reason for this is that Bold generates code for classes in the model in one file businessclasses.pas. businessclasses.pas is a hotspot. It must be included whenever you want to reference a class or member in the model.</p><p>The structure of this big file is this:</p><p><span style="font-family: courier; font-size: x-small;">(*****************************************)<br /></span><span style="font-family: courier; font-size: small;">(* This file is autogenerated *)<br /></span><span style="font-family: courier; font-size: small;">(* Any manual changes will be LOST! *)</span><span style="font-family: courier; font-size: small;">(*****************************************)<br /></span><span style="font-family: courier; font-size: x-small;">(* Generated 09.02.2021 17:51:02 *)</span><span style="font-family: courier; font-size: small;">(*****************************************)<br /></span><span style="font-family: courier; font-size: small;">(* This file should be stored in the *)<br /></span><span style="font-family: courier; font-size: small;">(* same directory as the form/datamodule *)<br /></span><span style="font-family: courier; font-size: small;">(* with the corresponding model *)</span><span style="font-family: courier; font-size: small;">(*****************************************)</span></p><p><span style="font-family: courier; font-size: x-small;">unit BusinessClasses;</span></p><p><span style="font-family: courier; font-size: x-small;">{$INCLUDE BusinessClasses_Interface.inc}</span></p><div><div><span style="font-family: courier; font-size: x-small;">{$INCLUDE AmObject.inc}</span></div><div><span style="font-family: courier; font-size: x-small;">{$INCLUDE Quantity.inc}</span></div></div><div><span style="font-family: courier; font-size: x-small;">// and 80 other include files</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><div><span style="font-family: courier; font-size: x-small;">procedure TBusinessClassesRootList.Add(NewObject: TBusinessClassesRoot);</span></div><div><span style="font-family: courier; font-size: x-small;">begin</span></div><div><span style="font-family: courier; font-size: x-small;"> if Assigned(NewObject) then</span></div><div><span style="font-family: courier; font-size: x-small;"> AddElement(NewObject);</span></div><div><span style="font-family: courier; font-size: x-small;">end;</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">function TBusinessClassesRootList.IndexOf(anObject: TBusinessClassesRoot): Integer;</span></div><div><span style="font-family: courier; font-size: x-small;">begin</span></div><div><span style="font-family: courier; font-size: x-small;"> result := IndexOfElement(anObject);</span></div><div><span style="font-family: courier; font-size: x-small;">end;</span></div></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">// And example of code for class TPlanMission in model.<br />// The link TPlanMission.StateInProcess can be read and changed</span></div><div><span style="font-family: courier; font-size: x-small;">// The model contains thousands of these</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><div><span style="font-family: courier; font-size: x-small;">function TPlanMission._Get_M_stateInProcess: TBoldObjectReference;</span></div><div><span style="font-family: courier; font-size: x-small;">begin</span></div><div><span style="font-family: courier; font-size: x-small;"> assert(ValidateMember('TPlanMission', 'stateInProcess', 194, TBoldObjectReference));</span></div><div><span style="font-family: courier; font-size: x-small;"> Result := TBoldObjectReference(BoldMembers[194]);</span></div><div><span style="font-family: courier; font-size: x-small;">end;</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">function TPlanMission._GetstateInProcess: TVehiclePool;</span></div><div><span style="font-family: courier; font-size: x-small;">begin</span></div><div><span style="font-family: courier; font-size: x-small;"> Result := TVehiclePool(M_stateInProcess.BoldObject);</span></div><div><span style="font-family: courier; font-size: x-small;"> if (assigned(Result) and not (Result is TVehiclePool)) then</span></div><div><span style="font-family: courier; font-size: x-small;"> Assert(false, SysUtils.format(BoldMemberAssertInvalidObjectType, [ClassName, 'stateInProcess', Result.ClassName, 'TVehiclePool']));</span></div><div><span style="font-family: courier; font-size: x-small;">end;</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">procedure TPlanMission._SetstateInProcess(const value: TVehiclePool);</span></div><div><span style="font-family: courier; font-size: x-small;">begin</span></div><div><span style="font-family: courier; font-size: x-small;"> M_stateInProcess.BoldObject := value;</span></div><div><span style="font-family: courier; font-size: x-small;">end;</span></div></div><p style="text-align: left;"><span style="font-family: inherit;"><br />BusinessClasses_Interface.inc contains actual class definitions.</span></p><p><span style="font-family: courier; font-size: x-small;">interface</span></p><p><span style="font-family: courier; font-size: x-small;">uses<br /></span><span style="font-family: courier; font-size: small;"> AttracsAttributes,<br /></span><span style="font-family: courier; font-size: small;"> BoldAttributes,<br /></span><span style="font-family: courier; font-size: small;"> Classes,<br /></span><span style="font-family: courier; font-size: small;"> SysUtils;<br /><br /></span></p><p><span style="font-family: courier; font-size: x-small;">type<br /></span><span style="font-family: courier; font-size: small;"> TBusinessClassesRoot = class;<br /></span><span style="font-family: courier; font-size: small;"> TBusinessClassesRootList = class;<br /></span><span style="font-family: courier; font-size: small;"> TAmObject = class;<br /></span><span style="font-family: courier; font-size: small;"> TAmObjectList = class;</span></p><p><span style="font-family: courier; font-size: x-small;">// About 900 more forward declarations of classes</span></p><div><div><span style="font-family: courier; font-size: x-small;"> TBusinessClassesRoot = class(TBoldObject)</span></div><div><span style="font-family: courier; font-size: x-small;"> private</span></div><div><span style="font-family: courier; font-size: x-small;"> protected</span></div><div><span style="font-family: courier; font-size: x-small;"> public</span></div><div><span style="font-family: courier; font-size: x-small;"> end;<br /><br />// To make it easier to read I only left Created property in AmObject and a override method in Bold CompleteOverride</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span><div><span style="font-family: courier; font-size: x-small;"> TAmObject = class(TBusinessClassesRoot)</span></div><div><span style="font-family: courier; font-size: x-small;"> private</span></div><div><span style="font-family: courier; font-size: small;"> function _Get_M_Created: TBADateTime;</span></div><div><span style="font-family: courier; font-size: x-small;"> function _GetCreated: TDateTime;</span></div><div><span style="font-family: courier; font-size: x-small;"> procedure _SetCreated(const NewValue: TDateTime);</span></div><div><span style="font-family: courier; font-size: small;"> protected</span></div><div><span style="font-family: courier; font-size: small;"> procedure CompleteCreate; override;</span></div><div><span style="font-family: courier; font-size: small;"> public</span></div><div><span style="font-family: courier; font-size: small;"> property M_Created: TBADateTime read _Get_M_Created;</span></div><div><span style="font-family: courier; font-size: small;"> property Created: TDateTime read _GetCreated write _SetCreated;</span></div><div><span style="font-family: courier; font-size: small;"> end;</span></div><div><br /></div></div></div><div><span style="font-family: courier; font-size: x-small;">// Definitions of other 479 classes follows here</span></div><div><br /></div><div><div><span style="font-family: courier; font-size: x-small;">implementation</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">uses</span></div><div><span style="font-family: courier; font-size: x-small;"> {$INCLUDE Attracs_Implementation_Uses.inc} ,</span></div></div><div><br /></div><div>So the result can be big, really big. <br />Attracs have 480 classes. <br />BusinessClasses.pas has 88902 lines</div><div>BusinessClasses_Interface.inc has 37480 lines<br /><span style="font-family: inherit;">Attracs_Implementation_Uses.inc has only 90 lines</span></div><div><span style="font-family: courier; font-size: small;"><br /></span></div><div>Those files are generated from the model. Only inc-files like AmObject.inc, Quantuty.inc, etc with the actual code for methods can be manually edited.<br /><br />So now when we know about the structure the BIG question is. How can I make unit tests for classes in businessclasses.pas ? This is the main reason I wrote this post to get some input from other developers.<br />I think the main problem with businessclasses.pas is the size and it is generated code.<br />Generally, a developer wants to split it so each unit only contains one or a couple of classes. These make the code more flexible. Attracs_Implementation_Uses.inc also include other units not related to model.<br /><br /></div><div>Lets take an example. Attracs_Implementation_Uses.inc contains ParcelTrackingHandling.<br /><br />This is the unit<br /><br /></div><div><div><div><span style="font-family: courier; font-size: x-small;">unit ParcelTrackingHandling;</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">interface</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">uses</span></div><div><span style="font-family: courier; font-size: x-small;"> Classes,</span></div><div><span style="font-family: courier; font-size: x-small;"> SysUtils,</span></div><div><span style="font-family: courier; font-size: x-small;"> BusinessClasses,</span></div><div><span style="font-family: courier; font-size: x-small;"> BusinessInterfaces;</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">type</span></div><div><span style="font-family: courier; font-size: x-small;"> TMediaHandle = class(TInterfacedObject)</span></div><div><span style="font-family: courier; font-size: x-small;"> private</span></div><div><span style="font-family: courier; font-size: x-small;"> fSendmedias: TStringList;</span></div><div><span style="font-family: courier; font-size: x-small;"> function SendLinkTo(aContactMedia: TContactMedia; aParcel: TParcel): Boolean;</span></div><div><span style="font-family: courier; font-size: x-small;"> function SendMail(const aEmailAddress: string; aParcel: TParcel): Boolean;</span></div><div><span style="font-family: courier; font-size: x-small;"> function SendSms(const aMobileNumber: string; aParcel: TParcel): Boolean;</span></div><div><span style="font-family: courier; font-size: x-small;"> function ExternalLinkPossibleToSend(aParcel: TParcel): Boolean;</span></div><div><span style="font-family: courier; font-size: x-small;"> function GetTrackingSubject(aParcel: TParcel): string;</span></div><div><span style="font-family: courier; font-size: x-small;"> procedure MayAddRole(aResults: TStringList; aContactMedia: TContactMedia);</span></div><div><span style="font-family: courier; font-size: x-small;"> public</span></div><div><span style="font-family: courier; font-size: x-small;"> constructor Create;</span></div><div><span style="font-family: courier; font-size: x-small;"> destructor Destroy; override;</span></div><div><span style="font-family: courier; font-size: x-small;"> function GetReceivingParty(aParcel: TParcel): TDepartment;</span></div><div><span style="font-family: courier; font-size: x-small;"> function SendExternalLink(aParcel: TParcel; aResults: TStringList): Boolean;</span></div><div><span style="font-family: courier; font-size: x-small;"> end;</span></div></div><div><br />I could make an interface for this in a new unit<br /><span style="font-family: courier; font-size: x-small;"><br /></span><div><span style="font-family: courier; font-size: x-small;">unit BusinessInterfaces;</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">interface</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">uses</span></div><div><span style="font-family: courier; font-size: x-small;"> Classes,</span></div><div><span style="font-family: courier; font-size: x-small;"> BusinessClasses;</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">type</span></div><div><span style="font-family: courier; font-size: x-small;"> ITracking = interface</span></div><div><span style="font-family: courier; font-size: x-small;"> ['{309FF866-56EC-405D-8168-D03DB8BBB8F2}']</span></div><div><span style="font-family: courier; font-size: x-small;"> function GetReceivingParty(aParcel: TParcel): TDepartment;</span></div><div><span style="font-family: courier; font-size: x-small;"> function SendExternalLink(aParcel: TParcel; aResults: TStringList = nil): Boolean;</span></div><div><span style="font-family: courier; font-size: x-small;"> end;</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">implementation</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><span style="font-family: courier; font-size: x-small;">end.</span></div></div></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div>But unfortunately this require BusinessClasses in the uses as TParcel that is a class in the model is used as parameter. Any idea how to avoid this chicken and egg situation ?</div><div><br /></div><div>Input and comments are appreciated 😃</div><div><br /></div>Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com2tag:blogger.com,1999:blog-7577743529948922238.post-47512997247351945322021-02-21T09:23:00.001+02:002021-02-21T09:25:41.410+02:00Bold big steps <div><br></div><div><p class="p2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;">Now when Bold framework are open source we have the possibility to decide in what direction we want. Bold for Sydney is next obvious step. So far Daniel Mauric have done most of the development in Attracs version of Bold so far. Both bugfixes, optimizations and new features. For example our version don't require calls to defaultsubscribe in codederived members. This make code more clean and readable.</span></p><p class="p2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;">But with open source we can cooperate as there are many smart developers <span class="Apple-converted-space"> </span>in Bolds community. One example is Yuri that solved the problem with x64. There was a runtime exception that was challenging to fix. Thanks Yuri! I have four ideas here for improvements in Bold. I am not sure if they are doable. I am humble </span><span class="s2" style="font-size: 19.13px;">😊</span></p><p class="p1" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; min-height: 22.8px; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;"></span></p><ol class="ol1" style="-webkit-text-size-adjust: auto;"><li class="li2" style="margin: 0px; font-stretch: normal; line-height: normal;"><span style="font-size: 19.1299991607666px;">Threads</span></li></ol><p class="p2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;">With Bold you don't need to write SQL to fetch data from database. Bold generate needed SQL and execute it whenever code needs it. We call it lazy fetch. Disadvantage are that it is slow as SQL is executed one by one in serie. Performance can be improved by prefetch data before it is needed. To call TBoldlist.EnsureObjects is one way. We have even an improvement called spanfetch that Bolds author Jan Norden wrote for us 10 years ago. It try to improve performance by collect access for each class before it is needed in derived members. But the generated SQL is still executed in serie in main thread. So the hourglass is common if there is much data to load. I suggesting have a pool of threads and let them execute SQL instead. It has some advantages.</span></p><ul class="ul1" style="-webkit-text-size-adjust: auto;"><li class="li2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal;"><span class="s3" style="font-size: 17px;"></span><span class="s1" style="font-size: 19.13px;">Hourglass is gone and main thread is responsive all the time.</span></li><li class="li2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal;"><span class="s3" style="font-size: 17px;"></span><span class="s1" style="font-size: 19.13px;">Better performance as each SQL is executed in own thread in parallell.</span></li><li class="li2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal;"><span class="s3" style="font-size: 17px;"></span><span class="s1" style="font-size: 19.13px;">Possible to cancel current loading. Just terminate threads that executes SQL.</span></li></ul><p class="p1" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; min-height: 22.8px; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;"></span></p><ol class="ol1" style="-webkit-text-size-adjust: auto;"><li class="li2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal;"><span class="s1" style="font-size: 19.13px;">Replace inc-files </span></li></ol><p class="p2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;">Code from modelled methods are in inc-files. Class definitions are in a separate inc-file. They are then references from businessclasses.pas. It works well but has some disadvantages for a developer. Most tools assume that code is only in pas-files. An example is Codeinsight in Delphi. It works not so good in inc-files. But also other tools that handle code like analysera have problem.</span></p><p class="p2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;">If you load businessclasses.pas Delphi Sydney be prepared to wait. Much slower than previous releases. I suppose it is because the new language server protocol for Codeinsight. It parse the file when loaded on IDE. Our model has about 460 classes so it try to parse the whole model which of course is slow. If classes can be arranged in ordinary pas-files instead.</span></p><p class="p2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;">Advantages:</span></p><ul class="ul1" style="-webkit-text-size-adjust: auto;"><li class="li2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal;"><span class="s3" style="font-size: 17px;"></span><span class="s1" style="font-size: 19.13px;">Smaller files don't need to load all at once so LSP don't need to parse so much when load businessclasses.pas.</span></li><li class="li2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal;"><span class="s3" style="font-size: 17px;"></span><span class="s1" style="font-size: 19.13px;">Tools like Codeinsight and code analyzers works better.</span></li></ul><p class="p1" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; min-height: 22.8px; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;"></span>This means code generation needs to be changed to generate code to pas-files instead.</p><ol class="ol1" style="-webkit-text-size-adjust: auto;"><li class="li2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal;"><span class="s1" style="font-size: 19.13px;">Interfaces</span></li></ol><p class="p2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;">Unittesting with Bold isn't easy. If I want to test class A but that have links to class B that have links to class C. We want to test class A in isolation. Best way to achieve that is to use interfaces instead of direct links to other classes. This means code generation need to be changed to generate interfaces for links.</span></p><p class="p1" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; min-height: 22.8px; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;"></span><br></p><ol class="ol1" style="-webkit-text-size-adjust: auto;"><li class="li2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal;"><span class="s1" style="font-size: 19.13px;">OCL syntax checks</span></li></ol><p class="p2" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 19.13px;">Visual Studio can syntax check LINQ if I understand it correct in compile time. Could we make similar checks with OCL? BoldHandle already have methods to validate OCL. But only in runtime.</span></p><p class="p1" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; min-height: 22.8px; -webkit-text-size-adjust: auto;"><br><span class="s1" style="font-size: 19.13px;"></span></p><p class="p1" style="margin: 0px; font-stretch: normal; font-size: 19.1px; line-height: normal; min-height: 22.8px; -webkit-text-size-adjust: auto;"><a href="https://stackoverflow.com/questions/5681726/how-to-get-compile-time-checking-for-value-types-in-linq-lambdas-expression-tree">https://stackoverflow.com/questions/5681726/how-to-get-compile-time-checking-for-value-types-in-linq-lambdas-expression-tree</a><span class="s1" style="font-size: 19.13px;"></span></p></div>Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-49891863544310138772020-09-26T19:03:00.000+03:002020-09-26T19:03:43.046+03:00Bold source is available!<h2>
<span style="font-family: inherit;">Yes, finally Bolds source is available !</span></h2>
<div>
<span style="font-family: inherit;">To make a long story short, her are <a href="https://github.com/Embarcadero/BoldForDelphi" target="_blank">Bold for Delphi repository</a>.</span><br />
<span style="font-family: inherit;"><br /></span>
<h3>
<span style="font-family: inherit;">The longer story</span></h3>
</div>
<span style="font-family: inherit;"><span style="white-space: pre-wrap;">I begin working with </span><a href="http://www.attracs.com/en" style="white-space: pre-wrap;" target="_blank">Attracs</a><span style="white-space: pre-wrap;"> in autumn 2005. I had no knowledge about Bold or even </span><a href="http://en.wikipedia.org/wiki/Embarcadero_Delphi" style="white-space: pre-wrap;" target="_blank">Delphi</a><span style="white-space: pre-wrap;">. 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/</span><a href="http://www.embarcadero.com/" style="white-space: pre-wrap;" target="_blank">Embarcadero </a><span style="white-space: pre-wrap;">keep the IP and have no maintenance.</span></span><br />
<div>
<span style="font-family: inherit; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div>
<span style="font-family: inherit;"><span id="docs-internal-guid-6144e356-ab11-0efd-0e7e-e90dfa56d3ca"><span style="vertical-align: baseline; white-space: pre-wrap;"><b>May 2012</b>. 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. </span></span><span style="vertical-align: baseline; white-space: pre-wrap;">A petition could be a possibility. So I <a href="http://www.change.org/petitions/embarcadero-technologies-release-the-intellectual-property-of-bold-for-delphi" target="_blank">set it up</a> and tried to spread the word. Not much happened. But after a while, <a href="http://www.adug.org.au/" target="_blank">ADUG</a> posted a <a href="http://www.delphifeeds.com/go/s/93128" target="_blank">blog</a> about this on <a href="http://www.delphifeeds.com/" target="_blank">DelphiFeeds</a></span><span style="vertical-align: baseline; white-space: pre-wrap;">. 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.</span></span></div>
<div>
<span style="font-family: inherit; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div>
<span id="docs-internal-guid-6144e356-ab1a-3c27-a17f-5c734f4adac8"><span style="font-family: inherit; vertical-align: baseline;"><span style="white-space: pre-wrap;"><b>August 2012</b>. Now I got attention from Embarcadero. After some emails, I and </span><span style="white-space: pre-wrap;">representatives</span><span style="white-space: pre-wrap;"> from my employer Attracs had a Skype meeting with Embarcadero. We all agreed on </span><a href="http://en.wikipedia.org/wiki/Non-disclosure_agreement" style="white-space: pre-wrap;" target="_blank">NDA</a><span style="white-space: pre-wrap;">. 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. </span></span></span></div>
<div>
<span style="font-family: inherit; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div>
<span style="font-family: inherit;"><span style="vertical-align: baseline; white-space: pre-wrap;"><b>October 2013</b>. </span><span style="white-space: pre-wrap;">Finally, we arranged a second meeting on Skype with Embarcadero, myself and </span><span style="white-space: pre-wrap;">representatives</span><span style="white-space: pre-wrap;"> from Attracs. </span><span style="white-space: pre-wrap;">Unfortunately, the meeting failed. Embarcadero had terms for the license that Attracs could not accept.</span></span></div>
<div>
<span style="font-family: inherit; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div>
<span style="font-family: inherit;"><span style="vertical-align: baseline; white-space: pre-wrap;"><b>January 2014</b>. I had another Skype meeting with Embarcadero. </span><span style="white-space: pre-wrap;">We </span><span style="white-space: pre-wrap;">discussed how to continue as we both have common interests in Bold. But no concrete result from this.</span></span><br />
<span style="font-family: inherit; white-space: pre-wrap;"><br /></span>
<b style="font-family: inherit; white-space: pre-wrap;">September 2014.</b><span style="font-family: inherit;"><span style="white-space: pre-wrap;"> 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 </span></span><span style="white-space: pre-wrap;">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.</span><br />
<span style="font-family: inherit; white-space: pre-wrap;"><br /></span></div><div><span style="white-space: pre-wrap;">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 <b>THANKS</b> to Marco Cantu for his work to realize this. I don't believe it has happened without him.</span></div><div><br /></div><div>But this is just the first step on the journey. There is so much to do.</div><div>There is now a Slack space dedicated to Bold for Delphi and how to organize stuff.</div><div>If you are interested in Bold I can invite you if you send an email to roland(dot)bengtsson(at)gmail(dot)com.</div><div><br />Current situation and roadmap</div><div><ul style="text-align: left;"><li>Current source is for D2006/D2007. There is a missing file due to copyright problem but we work to solving that</li><li>Attracs Bold version is for Delphi Sydney. We will publish that when som dependencies are removed.</li><li>Bold have no visual UML editor. There are discussions of the best options.</li><li>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"!</li><li>We have some unittests but as always there is much room for improvement.</li><li>Currently it feels like we try to support D2007 but has focus on later Delphi versions.</li></ul></div><div><br /></div>
<span style="font-family: inherit;"><span style="vertical-align: baseline; white-space: pre-wrap;">Finally I want to <b>thanks</b> 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.</span>
</span><br />
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;">Regards</span></div>
<div>
<span style="font-family: inherit;">Roland Bengtsson</span></div>
Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com1tag:blogger.com,1999:blog-7577743529948922238.post-33896930364126158022020-08-19T07:25:00.001+03:002020-08-19T07:32:09.806+03:00Bold will be open source !!!<p> Wow, I have never been so excited about a sentence in a blog post.</p><p>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 <a href="https://www.change.org/p/embarcadero-technologies-release-the-intellectual-property-of-bold-for-delphi">https://www.change.org/p/embarcadero-technologies-release-the-intellectual-property-of-bold-for-delphi</a>. Thanks for those that signed it and make attention to Embarcadero. And today I see this blog <a href="https://blogs.embarcadero.com/august-2020-gm-blog/">https://blogs.embarcadero.com/august-2020-gm-blog/</a></p><p><span style="background-color: white; font-family: Muli; font-size: 16px;"><b><i>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.</i></b></span></p><p>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.</p><p>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)attracs.com with questions or thoughts. But the first and most important move, to wait for Embarcadero publish to the source </p><p>Roland Bengtsson</p><p><br /></p>Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com7tag:blogger.com,1999:blog-7577743529948922238.post-43468553510166717652018-02-24T16:16:00.000+02:002018-02-24T17:38:03.367+02:00Validation of dataSometimes when I analyze data in database I discover bugs.<br />
For example if a class/table TripEvent contains 2 date attributes ArriveDate and CompleteDate.<br />
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.<br />
<br />
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:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">ArriveDate <= CompleteDate</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
ArriveDate should always be less or equal to CompleteDate.<br />
What happens if this rule is violated it is up to us to decide.<br />
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.<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">procedure TTripEvent.PrepareUpdate;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">begin</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> inherited;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> if not (M_ArriveDate.IsNull or M_CompleteDate.IsNull) then</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Assert(ArriveDate <= CompleteDate,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Format('Validation failed as ArriveDate %s > CompleteDate %s', [DateTimeToStr<b style="background-color: #fafafa; color: #c00000; font-size: small;">(</b>ArriveDate)<b style="background-color: #fafafa; color: #c00000; font-size: small;">, </b></span><span style="font-family: "courier new" , "courier" , monospace;">DateTimeToStr</span><span style="font-family: "courier new" , "courier" , monospace;"><b style="background-color: #fafafa; color: #c00000; font-size: small;">(</b>CompleteDate)]));</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">end;</span><br />
<br />
Before validation there must be a nullcheck as there is no point compare null values.<br />
Now if validation failed an exception is raised and that is logged with callstack.<br />
I can now see where in the source it is called and easier fix it.Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com2tag:blogger.com,1999:blog-7577743529948922238.post-1278048770579396892017-06-11T16:01:00.002+03:002017-06-11T16:03:44.837+03:00True Unit tests in Bold ?<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I think you all heard about unit testing. Maybe some of you even practise it?</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I recently bought <a href="https://leanpub.com/dependencyinjectionindelphi" target="_blank">Dependency Injection</a> 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.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">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).</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">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.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">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.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">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.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Next step would be to change application code to use interfaces.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Instead of</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "courier new"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">vPerson.homeAddress as TAddress;</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">do</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "courier new"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">vPerson.homeAddress as IAddress;</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">And I think this is the main issue, a lot of changes is required.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">But it can at least be done in smaller steps, class by class.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">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.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<span id="docs-internal-guid-5190256b-973c-e095-59b6-f020ab1ddd77"></span><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Comments are welcome because all this is completely untested. I just brainstorm here :)</span></div>
Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-50504068991288316022017-03-07T09:45:00.002+02:002017-03-07T09:45:31.328+02:00New QC issueJust made new issue in Embarcadero quality central<br />
<a href="https://quality.embarcadero.com/browse/RSP-17015">https://quality.embarcadero.com/browse/RSP-17015</a><br />
<br />
This is basically a clone of old issue on<a href="https://www.blogger.com/%C2%A0http://qc.embarcadero.com/wc/qcmain.aspx?d=97382" target="_blank"> http://qc.embarcadero.com/wc/qcmain.aspx?d=97382</a><br />
with 310 votes.<br />
<br />
Please continue vote on issue and sign my petition on <a href="https://www.change.org/p/embarcadero-technologies-release-the-intellectual-property-of-bold-for-delphi">https://www.change.org/p/embarcadero-technologies-release-the-intellectual-property-of-bold-for-delphi</a> if you missed that.<br />
<br />Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com1tag:blogger.com,1999:blog-7577743529948922238.post-38490017850771379652017-01-19T08:13:00.004+02:002017-01-19T08:14:29.416+02:00Old paper found<a href="http://www.freepascal.org/~michael/articles/bold1/bold1.pdf">http://www.freepascal.org/~michael/articles/bold1/bold1.pdf</a><br />
<br />
Good intro to Bold for DelphiRoland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-38023213546866719572017-01-07T11:55:00.001+02:002017-01-07T12:15:39.640+02:00Help me to make Bold open source project!<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">About 4 years ago I started this petition </span><a class="js-link post-link" href="https://www.linkedin.com/redir/redirect?url=https%3A%2F%2Fwww%2Echange%2Eorg%2Fp%2Fembarcadero-technologies-release-the-intellectual-property-of-bold-for-delphi&urlhash=TiTU&_t=tracking_anet" style="background: rgb(255, 255, 255); border: 0px; box-sizing: border-box; color: #008cc9; cursor: pointer; font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: color 0.1s; vertical-align: baseline;" target="_blank">https://www.change.org/p/embarcadero-technologies-release-the-intellectual-property-of-bold-for-delphi</a><span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;"> to make Bold open source. </span><br />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">Right now there is 278 supporters.</span><br />
<br style="background-color: white; box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; font-size: 15px;" />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;"><b>What is Bold</b></span><br />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">It is an <a href="https://en.wikipedia.org/wiki/Object-relational_mapping" target="_blank">ORM</a> framework founded by a Swedish company Boldsoft that later was bought by Borland around 2002. The idea with Bold is that the <a href="https://en.wikipedia.org/wiki/Unified_Modeling_Language" target="_blank">UML model</a> 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 <a href="https://en.wikipedia.org/wiki/SQL" target="_blank">SQL</a> script to be applied to the database and class definitions. </span><br />
<br style="background-color: white; box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; font-size: 15px;" />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">Bold do the translations of rows in database to objects in memory in both directions.</span><br />
<br style="background-color: white; box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; font-size: 15px;" />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">For example to read the name of a table called Person</span><br />
<br style="background-color: white; box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; font-size: 15px;" />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">myName := </span><a class="js-link post-link" href="https://www.linkedin.com/redir/redirect?url=Person%2EName&urlhash=j54D&_t=tracking_anet" style="background: rgb(255, 255, 255); border: 0px; box-sizing: border-box; color: #008cc9; cursor: pointer; font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: color 0.1s; vertical-align: baseline;" target="_blank">Person.Name</a><span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">;</span><br />
<br style="background-color: white; box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; font-size: 15px;" />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">To update the name:</span><br />
<br style="background-color: white; box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; font-size: 15px;" />
<a class="js-link post-link" href="https://www.linkedin.com/redir/redirect?url=person%2EName&urlhash=W68o&_t=tracking_anet" style="background: rgb(255, 255, 255); border: 0px; box-sizing: border-box; color: #008cc9; cursor: pointer; font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: color 0.1s; vertical-align: baseline;" target="_blank">person.Name</a><span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;"> := 'Bob';</span><br />
<br style="background-color: white; box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; font-size: 15px;" />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">So this is much more intuitive that writing SQL and less error prone.</span><br />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">It has also a lot more to offer like:</span><br />
<br />
<ul>
<li><a href="https://en.wikipedia.org/wiki/Object_Constraint_Language" style="font-family: "source sans pro", helvetica, arial, sans-serif; font-size: 15px;" target="_blank">OCL</a><span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;"> that is a side effect free (readonly) query language invented by </span><a href="https://en.wikipedia.org/wiki/IBM" style="font-family: "source sans pro", helvetica, arial, sans-serif; font-size: 15px;" target="_blank">IBM</a><span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">.</span></li>
<li>Derived members to calculate links and values automatically when needed.</li>
<li>The algorithm can be implemented in OCL or in Delphi code.</li>
<li>As no direct SQL is used switch database is often painless. Bold framework use only basic SQL for DB communication.</li>
<li>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).</li>
<li>For those that have bought Devexpress VCL components there is a <a href="https://github.com/MauricDaniel/BoldDevEx" style="font-family: "source sans pro", helvetica, arial, sans-serif; font-size: 15px;" target="_blank">separate repository</a><span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;"> that adapt the components for Bold. Result is a much modern look & feel and Bolds features.</span></li>
</ul>
<br />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">More information about Bold in </span><a href="https://en.wikipedia.org/wiki/Bold_for_Delphi" style="font-family: "source sans pro", helvetica, arial, sans-serif; font-size: 15px;" target="_blank">wikipedia</a><span style="color: rgba(0 , 0 , 0 , 0.701960784313725); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 15px;"> or just ask me.</span></span><br />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;"><br /></span>
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961);"><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">Latest official release of Bold was in Delphi 7 Architect.</span><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><span style="color: rgba(0 , 0 , 0 , 0.701960784313725); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 15px;">There is also an unofficial version for D2006 (and D2007 as they are binary compatible).</span></span><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><span style="color: rgba(0 , 0 , 0 , 0.701960784313725); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 15px;">But after this Borland, CodeGear and Embarcadero have been quiet about Bold.</span></span><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">And this left many customers behind that hope for updates. I think many developers left Delphi because of this. </span><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;"><b>The future ?</b></span><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">But Bold has been actively developed for those that have the source. My company is an example of that. </span><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">We have fixed both bugs, optimized it and add more features. We love the idea of Bold as open source. </span><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">But Embarcadero owns the IP, so we must have their explicit permission before we publish anything. </span><span style="color: rgba(0 , 0 , 0 , 0.701960784313725); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 15px;">Bold has shown the strength in our case as it is been used in production since 2003.</span></span><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><span style="color: rgba(0 , 0 , 0 , 0.701960784313725); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 15px;">I restarted the dialog with Embarcadero again about Bold as open source. </span></span><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;"><b>What can you do ?</b></span><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">So what we want to know is this:</span></span><br />
<ol>
<li><span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961);">What are the interests for Bold now ?</span></li>
<li><span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961);">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 ?</span></li>
<li><span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961);">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.</span></li>
</ol>
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961);"><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">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.</span><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">You make no promises. We just want to investigate the interests.</span><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><br style="box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;" /><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;">Comments, questions is encouraged!</span></span><br />
<span style="background-color: white; color: rgba(0 , 0 , 0 , 0.701961);"><span style="color: rgba(0 , 0 , 0 , 0.701961); font-family: "source sans pro" , "helvetica" , "arial" , sans-serif; font-size: 15px;"><br /></span></span>Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-39599948429073357482015-09-16T10:39:00.000+03:002015-10-23T11:38:43.183+03:00Boldified component suite from DevexpressIt have been a while since I wrote something. Now I have the pleasure to announce that Daniel Mauric released his boldified DevExpress components as open source. They are stored at <a href="https://github.com/MauricDaniel/BoldDevEx" target="_blank">https://github.com/MauricDaniel/BoldDevEx</a>.<br />
<br />
Attracs have used some of the components for several years in production. But of course no warranty that it works perfect .<br />
<br />
I want to point out that the grid is very useful component to have boldified. it combine the advantage of the original Boldgrid with a moden look & feel of the Devexpress grid. And a lot of features of course.<br />
This is how to set it up:<br />
<br />
<ul>
<li style="box-sizing: border-box;">Add a TcxGrid component on the form.</li>
<li style="box-sizing: border-box;">Select the TcxGridLevel with Right mouse button and choose Create View/Bold Table.</li>
<li style="box-sizing: border-box;">Delete the default TcxGridDBTableView component.</li>
<li style="box-sizing: border-box;">Decide a name for the grid for example <strong style="box-sizing: border-box;">Users</strong>. Rename the TcxGrid to <strong style="box-sizing: border-box;">grdUsers</strong>, TcxGridLevel to <strong style="box-sizing: border-box;">lvUsers</strong>, TcxGridBoldTableView to <strong style="box-sizing: border-box;">tvUsers</strong>.</li>
<li style="box-sizing: border-box;">Set property tvUsers.OptionsView.ColumnAutoWidth to True unless there are many columns so each column became very thin.</li>
<li style="box-sizing: border-box;">Add a BoldListHandle to the form and set the OCL expression for that.</li>
<li style="box-sizing: border-box;">Connect the grids Bold Table view DataController.BoldHandle to the BoldListHandle above.</li>
<li style="box-sizing: border-box;">Add columns and set OCL expressions for the column at DataBinding.BoldProperties.Expression property.</li>
<li style="box-sizing: border-box;">Inspect the columns so each column got a reasonable name. It should begin with <strong style="box-sizing: border-box;">col</strong>.</li>
<li style="box-sizing: border-box;">In general avoid things like formatdatetime, round, orderby etc in the columns OCL expression.<br /><strong style="box-sizing: border-box;">Note</strong> When dealing with dates, floats, integers as string sorting is not working good anymore. It only works if the grid know the actual datatype. Things like default sorting and formatting can be done in the grid instead. Also avoid this kind of OCL <strong style="box-sizing: border-box;">if islocalAdmin then 'X' else '' endif</strong>. In this case <strong style="box-sizing: border-box;">isLocalAdmin</strong> is enough and let the grid display is as a boolean checkbox. <span style="box-sizing: border-box;"><b>Note:</b> </span> See Boolean string representation for a column when the grid is used for editing.</li>
<li style="box-sizing: border-box;">If the grid is readonly then set property OptionsData.Editing to False of the view. If only some of the columns are readonly then set views OptionsData.Editing to True and then decide at the columns Options.editing property.</li>
<li style="box-sizing: border-box;">The views OptionsSelection.CellSelect can be set to False of you want to select only a whole row.</li>
</ul>
<div>
All controls implement <b>IBoldValidateableComponent </b>which means they can be validated at design time <b>Bold menu/Validate Current Form.</b>
<br />
<b><br /></b>
And you must of course have installed the original VCL DevExpress components to make use of this. Currently we use version 14.2.3. Version 15 have dropped support for Delphi 2007 and this is the latest version that Bold support. So we have to stay here until we add Unicode support to Bold and upgrade Delphi.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-MdQGXqbiK5M/Vf0EHfdBIII/AAAAAAAAPDw/U56qLsUvjD0/s1600/BoldDevexgrid.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="205" src="http://2.bp.blogspot.com/-MdQGXqbiK5M/Vf0EHfdBIII/AAAAAAAAPDw/U56qLsUvjD0/s320/BoldDevexgrid.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">An example of boldified DevExpress grid</td></tr>
</tbody></table>
<br /></div>
Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-25870297003980463622015-05-30T21:44:00.001+03:002015-06-02T21:24:39.876+03:00New features in Attracs BoldIt is very easy to believe that Bold for Delphi is dead and the best action is to leave Delphi and just port your existing applications to some other platforms like C#.<br />
<div>
<br /></div>
<div>
I would like to inform that Attracs version of Bold is very actively developed.</div>
<div>
Beside all small bug fixes and changes this is some bigger improvements.</div>
<div>
Thanks to our skilled consultants that made it possible.</div>
<div>
<br /></div>
<div>
<b>Autosubscription. </b></div>
<div>
You do not need to call DefaultSubscribe in derived code. Bold handle that automatically resulting in cleaner code.</div>
<div>
<br /></div>
<div>
<b>No hash lookup for datatypes</b></div>
<div>
Internally Bold now call hash lookups for datatypes. This is fast but when done frequently the time will add up. Attracs version use hardcoded datatypes instead as this changes very seldom or never. Together with some other optimization Bold can now handle about twice as many objects per second.</div>
<div>
<br /></div>
<div>
<b>Developer Express <a href="https://www.devexpress.com/products/vcl/exquantumgrid/" target="_blank">grid</a> and editors is boldaware</b></div>
<div>
Not much to say about that. Much nicer components than the original in Bold</div>
<div>
<br /></div>
<div>
<b>Caching of OCL result</b></div>
<div>
Boldaware components evaluate OCL expressions when size of component is changed. For grids this is done for all cells. Using a cache is more effective.</div>
<div>
<br /></div>
<div>
<b>Spanfetch avoid lazyfetch</b></div>
<div>
In Bold it is very easy to trigger a lazy fetch of data. This means that one SQL statement is generated each time data is needed. This can be merged to one final SQL per table that is more effective. So this means a parsing of OCL and calculate the most effective SQL from that. Now there is even support for OCL variables but still a bit unstable. A very powerful and complicated addition to Bold.</div>
<div>
<br /></div>
<div>
<b>ViewModels</b></div>
<div>
When you have a many Bold-handles on a form it is easy to make a mess. Viewmodel is a new component that collect the handles in a nice treeview. It have also some other features so very little code is required on forms. In some cases no code at all. Less code also means less chances for bugs.</div>
<div>
<br /></div>
<div>
<b>LogServer</b></div>
<div>
This is the latest feature. Usually we log to a plain text-file. But that means a lot of information is lost. Because then we need to parse raw text to get information like performance, frequency of events, exceptions etc. Log to a database is better because it is more structured. Data is saved on the proper place.</div>
<div>
This also means we can log more as it is easy to find data with SQL and diskspace is cheap. We log all user actions to a database by intercept events also from timers etc. We can also log all modifications of objects. The log can contain time, user, value etc. Hopefully this means much better chance to reproduce those random bugs in live environment.</div>
Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-41511387323407139342014-05-06T10:10:00.003+03:002014-05-06T10:25:35.741+03:00Voices from the petitionI just want to highlight some of the comments from<a href="http://www.change.org/petitions/embarcadero-technologies-release-the-intellectual-property-of-bold-for-delphi" target="_blank"> petition</a>.<br />
<br />
<br />
<ul>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">I am looking for MDD framework for delphi, there is none like Bold. Other frameworks are just in its infancy. Please release Bold source.</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">We need sources for certification.</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">I use it for development and is stuck with Delphi 5...</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">As Developer find no support/update for Bold</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">We need a good framework like BOLD in this language. Release it as opensource , so a new guy in Delphi like me could use it and the community can improve it. </span><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">It'll be an advantage for Delphi.</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">I am used this framework. And I liked it/</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">Trying to resurrect old code in D7 that needs this ancient software.</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">I like this Framework. Let go Bold it's way.</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">We've a lot good old apps using bold as it's main technologie and to be up-to-date, we had to rewritte all things from scratch...which is a very bad idea...(time consuming). Bold as opensource and compatible with the latest version of Delphi (unicode) would be a great step into the future...</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">I have products that sadly still cannot be upgraded to current Delphi from d7.</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">We are short of tools like Bold</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">Want to invest in learning this MDA framework, since it is the only one I know that actually succeeds in raising the abstraction level of the design work.</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">I have developed Bold Applications that are now locked into Delphi 7. If there is no future to Bold these systems will be moved to Visual Studio with ECO and I will be leaving the team.</span></li>
<li><span style="background-color: white; color: #4b4f4f; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;">I write an application which depends on Bold and cannot upgrade to XE2 because the work in re-writing the application without Bold is too large.</span></li>
</ul>
<div>
<br /></div>
<div>
So obviously there is still a huge interest for Bold. 194 users signed petitions.</div>
Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-32647727612633918702013-12-04T15:33:00.002+02:002015-06-02T21:24:55.438+03:00A hint how to use collect in OCLSometimes I want to merge several list into one big list. Consider this OCL expression<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">WorkPool.allinstances.buffInProcess->union(WorkPool.allinstances.buffopenplans)->union(Workpool.allinstances.buffforwarded)</span><br />
<br />
So in this case Workpool contain some buffers or multilinks. I want to merge 3 multilinks into one list.<br />It can be done with collect.<br /><br />
<span style="font-family: Courier New, Courier, monospace;">WorkPool.allinstances->collect(buffInProcess->union(buffopenplans)->union(buffforwarded))</span><br />
<div>
<br />The result is exact the same but you do not need to use <span style="font-family: 'Courier New', Courier, monospace;">WorkPool.allinstances </span><span style="font-family: inherit;">on many places.</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
Another case</div>
<div>
<br /></div>
<div>
<span style="font-family: inherit;">Instead of</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">if myLooongexpression.condition then<br /> myLooongexpression.attributeone</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">else</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> myLooongexpression.attributetwo</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">endif</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: inherit;">do this</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">myLooongexpression->collect(if condition then attributeone else attributetwo endif)</span></div>
<div>
<br /></div>
Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-89410603948992743892013-11-10T18:27:00.002+02:002013-11-10T18:27:58.192+02:00Bold need your attention<div class="post-text" itemprop="description" style="border: 0px; margin: 0px 5px 5px 0px; padding: 0px; vertical-align: baseline; width: 660px; word-wrap: break-word;">
<div style="border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<span style="background-color: rgba(255, 255, 255, 0);">Bold is propably the best persistant framework for Delphi. Only Embarcadero can make it available again. Tell them that community need Bold and give yor votes on <a href="http://qc.embarcadero.com/wc/qcmain.aspx?d=97382" rel="nofollow" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">QC</a>. Currently it have 216 votes an place 10, but more is needed. Thanks!</span></div>
<div style="-webkit-text-size-adjust: auto; background-color: white; color: #333333; font-family: Tahoma, Geneva, Arial, sans-serif; font-size: 14px; line-height: 18px;">
<br /></div>
</div>
Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-92077985146323698382013-07-20T15:17:00.002+03:002013-07-21T11:07:22.480+03:00Future for Bold ?Many may wonder what happened after my <a href="http://www.change.org/petitions/embarcadero-technologies-release-the-intellectual-property-of-bold-for-delphi">petition</a> ? Well, the discussion with Embarcadero is not dead. There are now 176 supporters on the petition and I am still hopeful that we reach a solution for this issue.<br />
<div>
<br /></div>
<div>
Because it is an issue for: </div>
<div>
<ol>
<li>For those developers that still use Bold in old but important applications. They are forced to stay with an old Delphi version. Many have chosen to leave Delphi for more active development platforms.</li>
<li>For the whole Delphi community that are not aware what a great ORM framework Bold is. For the right type of application ORM and Bold is a really timesaver.</li>
<li>For Embarcadero that miss those Delphi licenses if those customers above would update.</li>
<li>For my employer <a href="http://www.attracs.com/en">Attracs</a> as we may need developers with Bold experience. It is not easy to find these days.</li>
</ol>
<div>
I have promised Embarcadero to not reveal any details, but there have been discussions with Embarcadero about how we should continue with Bold. In the meantime I collected some links of Bold resources. Mostly where people mention Bold and what they want it to be. Yes I know I am involved in many discussions... :)</div>
</div>
<div>
<br /></div>
<div>
<b>Blogs and forums</b></div>
<div>
<a href="http://mrpmorris.blogspot.fi/2009/06/embarcadero-should-revive-bold-for.html">Peter Morris Blog</a> </div>
<div>
<a href="http://members.adug.org.au/2012/06/01/embarcadero-be-bold-once-more/">ADUG Australian User Group</a></div>
<div>
<a href="http://blogs.embarcadero.com/davidi/2012/09/25/41672#comment-39154">Comments from David Intersimones Blog</a></div>
<div>
<a href="http://donaldshimoda.blogspot.fi/2013/03/embarcadero-drops-anydac-support-for.html">Parallell Pascal Worlds Blog</a></div>
<div>
<a href="http://www.linkedin.com/groups/Bold-Delphi-3112789?trk=myg_ugrp_ovr">Bold group at Linkedin</a></div>
<div>
<a href="http://www.borlandtalk.com/anyone-still-using--vt113975.html">BorlandTalk</a><br />
<a href="http://stackoverflow.com/questions/236656/any-active-bold-for-delphi-users">Active Boldusers on StackOverFlow</a></div>
<div>
<a href="http://codenewsfast.com/cnf/article/235748/waArticleBookmark.7357984">Good summary what happened after Borland bought Bold</a><br />
<br /></div>
<div>
<b>Other resources</b></div>
<div>
<a href="http://codecentral.embarcadero.com/Item/23890">Latest official build of Bold for D2006/D2007</a></div>
<div>
<a href="http://www.viewpointsa.com/bold_resources/getting_started_with_bold/Part1-IntroducingtheBasic.html">Introduction to Bold Part 1</a></div>
<div>
<a href="http://www.viewpointsa.com/bold_resources/getting_started_with_bold/Part2-ExtendingModels.html">Introduction to Bold Part 2</a></div>
<div>
<a href="http://www.viewpointsa.com/bold_resources/getting_started_with_bold/Part3-OCL.html">Introduction to Bold Part 3</a><br />
<a href="http://www.rsdn.ru/article/delphi/bold4delphi2.xml#E2PAC">Bold tutorial</a> (In Russian but use <a href="http://translate.google.com/">Google translate</a>)</div>
<div>
<a href="http://www.howtodothings.com/computers/a991-conserving-memory-in-bold.html">Conserving memory in Bold</a><br />
<a href="http://delphi.wikia.com/wiki/Bold_for_Delphi">Bold on Wikia</a><br />
<a href="http://boldtcp.codeplex.com/">Bold TCP Server</a><br />
<a href="http://web.archive.org/web/20021004001326/http://www.boldsoft.com/products/boldfordelphi/index.html">Boldsofts site 4 Oct 2002</a></div>
Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com068410 Nedervetil, Finland63.708443499999987 23.32657779999999548.833161499999989 -17.982016200000004 78.583725499999986 64.6351718tag:blogger.com,1999:blog-7577743529948922238.post-66133463061933182872012-11-09T23:34:00.001+02:002014-04-05T18:08:17.715+03:00Use Custom Events to remove dependenciesI have used Delphi a lot but until now not realized how powerful events are. During the last week I got an Aha experience when I realize what can be done. And how clean code can be written with events.<br />
<br />
An event is the same a a function pointer for those that use for example C or C++. Delphi have a lot of predefined events. For example a button can have OnClick, OnExit etc. It's easy to use them as Delphi IDE helps you with that.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-LsKWKdn_K14/UJ1jpHfUeUI/AAAAAAAACG8/xSM-bCGJR3w/s1600/Dependency.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-LsKWKdn_K14/UJ1jpHfUeUI/AAAAAAAACG8/xSM-bCGJR3w/s320/Dependency.png" height="188" width="320" /></a></div>
If you use custom events it can help you break dependencies between classes. This make it easier to write tests for the code and refactor it.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<b>An Example</b><br />
This illustrate a form that create and show a dialog. This dialog may also be called from 2 other forms. In the dialog there are special cases to handle this.<br />
First look at the old code before the change:<br />
<br />
<br />
frmBook.pas<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">procedure TBookForm.OrderSearch(Sender: TObject);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;">var</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm: TFindParcelForm;</span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">begin</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm := TFindParcelForm.Create(self);</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> vForm.ShowModal;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;">end;</span></span><br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">procedure TBookForm.OrderNew(Sender: TObject);</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">begin</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> // Code to make new order</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">end;</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span>
<br />
frmFindParcel.pas<br />
<span style="font-size: x-small;"><span style="font-family: Courier New, Courier, monospace;">type</span><span style="font-family: Courier New, Courier, monospace;"> TFindParcelForm = class(TForm)</span> <span style="font-family: 'Courier New', Courier, monospace;">// Som declarations</span></span><br />
<span style="font-size: x-small;"><span style="font-family: 'Courier New', Courier, monospace;">end;</span></span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">// Dependencies to owner</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">uses</span><br />
<div>
<span style="font-size: x-small;"><span style="font-family: 'Courier New', Courier, monospace;"> frmBook,</span></span></div>
<div>
<span style="font-size: x-small;"><span style="font-family: 'Courier New', Courier, monospace;"> frmPlan,</span></span></div>
<div>
<span style="font-size: x-small;"><span style="font-family: 'Courier New', Courier, monospace;"> frmOrg; </span></span></div>
<div>
<br /></div>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">procedure TFindParcelForm.MakeOrderClick(Sender: TObject);</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">begin</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> // Block1 of code here</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> if owner is TBookForm) then</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> (Owner as TBookForm).OrderNew(self)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> else if Owner is TPlanForm then</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> (Owner as TPlanForm).OrderNew(self)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> else if Owner is TOrgForm then</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> (Owner as TOrgForm).OrderNew(self)</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> </span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> // Block2 of code here</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">end;</span><br />
<br />
Let's now use the predefined event TNotifyEvent. It is defined in VCL Classes.pas:<br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span>
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">TNotifyEvent = procedure(Sender: TObject) of object;</span><br />
<div>
<br /></div>
frmBook.pas<br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">procedure TBookForm.OrderSearch(Sender: TObject);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;">var</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm: TFindParcelForm;</span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">begin</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm := TFindParcelForm.Create(self);</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm.OnNewOrder := OrderNew;</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm.ShowModal;</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;">end;</span></span><br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">// Have the same signature as TNotifyEvent</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">procedure TBookForm.OrderNew(Sender: TObject);</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">begin</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> // Code to make new order</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">end;</span><br />
<br />
frmFindParcel.pas<br />
<br />
<span style="font-size: x-small;"><span style="font-family: Courier New, Courier, monospace;">type</span><span style="font-family: Courier New, Courier, monospace;"> TFindParcelForm = class(TForm)</span> <span style="font-family: 'Courier New', Courier, monospace;">// Some declarations</span><span style="font-family: 'Courier New', Courier, monospace;"> private</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: Courier New, Courier, monospace;">fNewOrder: TNotifyEvent;</span><span style="font-family: 'Courier New', Courier, monospace;"> public</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: Courier New, Courier, monospace;">property OnNewOrder: TNotifyEvent read fNewOrder write fNewOrder;</span><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-size: x-small;"><span style="font-family: 'Courier New', Courier, monospace;">end;</span></span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">procedure TFindParcelForm.MakeOrderClick(Sender: TObject);</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">begin</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> // Block1 of code here</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if Assigned(OnNewOrder) then</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> OnNewOrder(Self);</span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> // Block2 of code here</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">end;</span><br />
<br />
So what happened was that we have broken the dependency from FrmFindParcel.pas to the owners TBookForm, TPlanForm and TOrgForm. This means that it is now easier to test frmFindParcel as a separate unit. Method MakeOrderClick is now simplified and is not aware of the owner. If else is also gone.<br />
<br />
But we don't need to stop here. With a small addition we can make own custom events as the blog title suggests.<br />
<br />
<span style="font-size: x-small;"><span style="font-family: Courier New, Courier, monospace;">type</span></span><br />
<span style="font-size: x-small;"><span style="font-family: Courier New, Courier, monospace;"> TSetOrder = procedure(aOrder: TOrder; aPrice: Double) of objects;</span></span><br />
<span style="font-size: x-small;"><span style="font-family: Courier New, Courier, monospace;"> TGetOrder = function(): TOrder of objects;</span></span><br />
<span style="font-size: x-small;"><span style="font-family: Courier New, Courier, monospace;"><br /></span><span style="font-family: Courier New, Courier, monospace;"> TFindParcelForm = class(TForm)</span> <span style="font-family: 'Courier New', Courier, monospace;">// Some declarations</span><span style="font-family: 'Courier New', Courier, monospace;"> private</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: Courier New, Courier, monospace;">fNewOrder: TNotifyEvent;</span></span><br />
<span style="font-size: x-small;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">fOnSetOrder: </span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">TSetOrder;</span><br />
<span style="font-size: x-small;"><span style="font-family: Courier New, Courier, monospace;"> fOnGetOrder: TGetOrder;</span></span><br />
<span style="font-size: x-small;"><span style="font-family: 'Courier New', Courier, monospace;">public</span><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-size: x-small;"><span style="font-family: Courier New, Courier, monospace;"> property OnNewOrder: TNotifyEvent read fNewOrder write fNewOrder;</span><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-size: x-small;"><span style="font-family: 'Courier New', Courier, monospace;"> property OnSetOrder: TSetOrder read fOnSetOrder write fOnSetOrder;</span></span><br />
<span style="font-size: x-small;"><span style="font-family: 'Courier New', Courier, monospace;"> property OnGetOrder: TGetOrder read fOnGetOrder write fOnGetOrder;</span></span><br />
<span style="font-size: x-small;"><span style="font-family: 'Courier New', Courier, monospace;">end;</span></span><br />
<br />
We added 2 new events OnSetOrder that is a procedure with 2 parameters. And OnGetOrder that just return an order.<br />
<br />
Usage:<br />
<br />
frmBook.pas<br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">procedure TBookForm.OrderSearch(Sender: TObject);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;">var</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm: TFindParcelForm;</span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">begin</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm := TFindParcelForm.Create(self);</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm.OnNewOrder := OrderNew;</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm.</span></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">OnSetOrder</span><span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> := SetActiveOrder;</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm.</span></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">OnGetOrder</span><span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> := GetActiveOrder;</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;"> vForm.ShowModal;</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="font-size: x-small;">end;</span></span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">procedure TBookForm.</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> SetActiveOrder</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">(aOrder: TOrder; aPrice: Double);</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">begin</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> // Code to set Active Order</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">end;</span><br />
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">function TBookForm.</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> GetActiveOrder</span><span style="font-family: Courier New, Courier, monospace; font-size: x-small;">: TOrder;</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">begin</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> // Code return active Order</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">end;</span></div>
<div>
<br /></div>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">// Have the same signature as TNotifyEvent</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">procedure TBookForm.OrderNew(Sender: TObject);</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">begin</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> // Code to make new order</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">end;</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span>
frmFindParcel.pas<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">procedure TFindParcelForm.TestOrderClick(Sender: TObject);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">var</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> vOrder, vOrder2: TOrder;</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">begin</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> // Block1 of code here</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> vOrder := MakeOrder;</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if Assigned(</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">OnSetOrder</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">) then</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">OnSetOrder</span><span style="font-family: Courier New, Courier, monospace; font-size: x-small;">(</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">vOrder</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">);</span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if Assigned(</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">OnGetOrder</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">) then</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> vOrder2 := </span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">OnGetOrder;</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span>
<br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> // Block2 of code here</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">end;</span><br />
<br />
So to break dependencies and make code more testable, own custom events are a powerful tool to accomplish that.<br />
<br />Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com1tag:blogger.com,1999:blog-7577743529948922238.post-6548111583724761712012-06-14T10:53:00.004+03:002013-05-04T10:29:09.627+03:00Vote on Bold for DelphiHi!<br />
<br />
I have voted on this report on Delphi quality central <a href="http://qc.embarcadero.com/wc/qcmain.aspx?d=97382" target="_blank">http://qc.embarcadero.com/wc/qcmain.aspx?d=97382</a>. Please do the same to support a change in this issue!<br />
<br />
1. Login, if you don't have account create one.<br />
2. Add 5 votes. That is maximum.<br />
<br />
PS <br />
Please join then new group on FaceBook<br />
<a href="http://www.facebook.com/groups/279755425455148/">http://www.facebook.com/groups/279755425455148/</a><br />
<br />
My twitter:<br />
https://twitter.com/#!/d98rolb <br />
<br />Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-28117909418995075642012-06-08T16:28:00.002+03:002013-05-04T10:29:39.474+03:00Petition updateTo this date 131 signs is reached. I think this is remarkable for a closed product that is unsupported for so many years. I did a grouping for countries and Australia was the leader with 22 signs.<br />
Thanks for all signs about the petition! <br />
<br />
The whole list of countries can be downloaded <a href="https://sites.google.com/site/boldfordelphi/downloads/Bold_Countries.pdf?attredirects=0&d=1" target="_blank">here</a>Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com2tag:blogger.com,1999:blog-7577743529948922238.post-60102545041296374382012-05-22T23:36:00.001+03:002013-05-04T10:29:29.793+03:00Petition is publishedYes, this evening a petition is published with the goal to release Bold for Delphi from Embarcadero. Of course I want as many as possible to sign on. Even better if you write why this is important. How would it make your development easier etc.<br />
<br />
<a href="http://www.change.org/petitions/embarcadero-technologies-release-the-intellectual-property-of-bold-for-delphi" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; text-align: left; text-decoration: none;"><b>Get Bold for Delphi back!</b></a><br />
<br />
<img border="0" src="http://1.bp.blogspot.com/-rH8Rl_cWgoc/T7v5d8jbFTI/AAAAAAAABoU/D-JrS4om4IA/s1600/bfd_r40_vert_small.gif" />Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-26479600507558269922012-05-15T22:45:00.001+03:002013-05-04T10:29:47.724+03:00I'm very impressed...of the <a href="http://archive.org/web/web.php">wayback machine</a> for Internet. Just think of the proportions of this project. To store all webpages of the whole internet as they change in time. It is of course impossible to catch everything.<br />
<br />
It works remarkably well. For example <a href="http://www.boldsoft.com/">www.boldsoft.com</a> just link to some strange jumbo page... But in the wayback machine I can travel back in time to <a href="http://web.archive.org/web/20021004001326/http://www.boldsoft.com/products/boldfordelphi/index.html">4 October 2002</a>. The pictures is mostly missing but I can read the text, documentation, ads etc. Very useful. I grabbed a chm-file with Bold references and added it to my archive of <a href="https://sites.google.com/site/boldfordelphi/downloads">Bold documentation</a>.Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0tag:blogger.com,1999:blog-7577743529948922238.post-32529029246725126862011-08-24T23:08:00.000+03:002013-05-04T10:29:56.944+03:00Restart for Bold ?I have started a group in LinkedIn about Bold. Anyone that is interested in this framework should join it!<br />
Go to <a href="http://www.linkedin.com/groups/Bold-Delphi-3112789?gid=3112789&trk=hb_side_g">www.linkedin.com</a>Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com0Nedervetil, 68410 Kronoby, Finland63.699560200000008 23.35189279999997363.695002200000005 23.339305799999973 63.704118200000011 23.364479799999973tag:blogger.com,1999:blog-7577743529948922238.post-22874954810971109002011-07-14T07:56:00.000+03:002013-05-04T10:30:05.555+03:00Bold documentationThe documentation for Bold is not that good. But I have put some docs for download <a href="https://sites.google.com/site/boldfordelphi/downloads">here</a>.Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com3tag:blogger.com,1999:blog-7577743529948922238.post-86888211020412946452010-06-28T23:09:00.006+03:002013-05-04T10:30:20.127+03:00What to choose to achieve loading speedIt is important to use the right tool for the job. As a developer there is often the choice between to use a technology that let you do anything at the cost of you must also take care of everything. Or use a framework that take care of most details. The level of abstraction is raised. Bold for Delphi is such framework.<br />
<br />
The header of todays post says <b>Loading speed</b>. Performance is often important in applications. Here is a simple list of techniques of show data from a database with comments about speed.<br />
<br />
<div>
<div>
<ol>
<li>Using OCL with all dependent objects in object-space (RAM) and PS set to False. I used to call this warm objects. In my personal experience there is nothing that can beat that in speed. The GUI is very fast updated.</li>
<li>Handwritten SQL versus Bold is like assembler versus C or C++. When written properly it can be very fast. But it is also easy to write slow SQL with sub-queries, introduce unnecessary complexity etc.</li>
<li>Using OCL with dependent objects not in object-space (RAM) and PS set to True. This is cold objects. In some cases it can have equal performance as well written SQL. Note there is some limitations of the expression as derived attributes and links cannot be used. The result must be a collection of Bold objects.</li>
<li>Using OCL with all dependent objects not in objects in object-space (RAM) and PS set to False and prefetch is used to load objects. See the explanation what prefetch is.</li>
<li>Using OCL with all dependent not in objects in object-space (RAM) and PS set to False and prefetch is not used. This is lazy fetch. One SQL call is generated for every object loaded and this can be a bit slower.</li>
</ol>
<div>
One thing to be noted is that the database cache has big impact of the performance. The second time the same SQL is executed the data is already in the cache and is delivered faster.</div>
<div>
<br /></div>
<div>
When Bold load data and PS is set to False Bold evaluate and generate the needed SQL to load data in object space. The next time Bold need the same object it is already in memory and the speed gained is very high. It is number one at my list above. The problem is when new data is to be loaded all the time.</div>
<div>
<br /></div>
<div>
<span class="Apple-style-span" style="font-size: x-large;"><span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;">Prefetch</span></span><br />
Bold contains some methods to avoid lazy fetch, EnsureObjects and FetchLinksWithObjects. The problem is then the model grow an by just reading a derived member may start a chain of lazy fetches that could be hard to anticipate.<br />
<br /></div>
<div>
One solution we at Attracs use with success is prefetching. When loading bigger datastructures from database it is often many instances of the same class. It is much more effective to load many instances in one SQL call compared to one SQL call per instance. We use some kind of prefetch language to archieve this.</div>
<div>
A prefetch expression can look like this:</div>
<div>
<br /></div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">(activeCustomers, (activeOrders, invoice))</span></div>
<div>
<br /></div>
<div>
The precondition in this fabricated case is class CustomerPool that have a multilink ActiveCustomers that have the class Customer in the other end. The Customer have a multilink to Order class by the multilink activeOrders. And the Order class have a link to Invoice class. by doing a prefetch on this then all Customers is loaded in one SQL and the same with Order and Invoice class. The result is better user experience.</div>
<div>
<br /></div>
<div>
Some people may think that the syntax of this prefetch language is a bit funny. It should be noted that prefetch is not part of the Bold framework (yet). It is an in house technique to get better performance.</div>
<div>
</div>
<div>
<br />
Now we also have a method that generate a prefetch expression from an OCL expression. This make it much easier as the prefetches can adapt from changes in model. The result is more dynamic and less hard coding!</div>
</div>
</div>
Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com18tag:blogger.com,1999:blog-7577743529948922238.post-13701112323285766312010-06-12T22:04:00.022+03:002013-05-04T10:30:33.885+03:00A faq about using Bold for Delphi<div>
<span class="Apple-style-span"><span class="Apple-style-span" style="font-size: x-large;">A FAQ about Bold for Delphi</span></span></div>
<ol>
<li><a href="http://boldfordelphi.blogspot.com/#req">What is the requirements to start using Bold ?</a></li>
<li><a href="http://boldfordelphi.blogspot.com/#uml">What is <b>UML</b> ?</a></li>
<li><a href="http://boldfordelphi.blogspot.com/#orm">What is <b>ORM</b> ?</a></li>
<li><a href="http://boldfordelphi.blogspot.com/#ocl">What is <b>OCL</b> ?</a></li>
<li><a href="http://boldfordelphi.blogspot.com/#derattr">What is a derived member ?</a></li>
</ol>
<div>
<div>
<b><a href="http://www.blogger.com/blogger.g?blogID=7577743529948922238" name="req">Q:</a></b> What is the requirements to start using Bold ?</div>
</div>
<div>
<b>A: </b>Currently Bold is only available in 3 editions, all in obsolete versions of Delphi:</div>
<div>
<ul>
<li>Delphi 7 Architect.</li>
<li>Delphi 2005 Architect</li>
<li>Delphi 2006 Architect</li>
<li>Delphi 2007 using package from Delphi 2006</li>
</ul>
<div>
So Bold can be used with D2007 if the package was compiled with D2006 as they are <a href="http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:2010">binary compatible</a>.</div>
<div>
<br /></div>
</div>
<b><a href="http://www.blogger.com/blogger.g?blogID=7577743529948922238" name="uml">Q:</a></b> What is <b>UML</b> ?<br />
<b>A: UML</b> (Unified Modeling Language) is a standardized general-purpose modeling language. Bold use <a href="http://en.wikipedia.org/wiki/Model-driven_architecture">MDA</a> (Model-driven architecture) meaning that a change of the model is the first step in development. Then that change is applied on the database. Then the code may be changed to adapt to the previous model changes. In UML you can specify relations between classes as singlelinks (on to one) or multilinks (one to many). Each class can have attributes of basic datatypes and methods attached.<br />
See also <a href="http://en.wikipedia.org/wiki/Unified_Modeling_Language"><b>UML</b> on Wikipedia</a><br />
<br />
<b><a href="http://www.blogger.com/blogger.g?blogID=7577743529948922238" name="orm">Q:</a></b> What is <b>ORM</b> ?<br />
<b>A: ORM</b> (Object-relational mapping) means to convert relations in a traditional SQL database to objects in memory that can be used with a objectoriented language. It is of course possible to change objects and store them in the database. This makes programming much easier as it is not needed to write SQL to read and writa data from the database. It is much easier to write complex expressions if you don't need to use SQL.<br />
<br />
Compare this by <a boldfordelphi.blogspot.com="" href="http://www.blogger.com/blogger.g?blogID=7577743529948922238" http:="" ocl="">OCL</a> ?:<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">PlanMission.allinstances->select(created > #2010-02-04).created</span><br />
<br />
and in <b>SQL</b>:<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">SELECT created FROM PlanMission WHERE (PlanMission.Created > '2010.02.04')</span><br />
<br />
See also <a href="http://en.wikipedia.org/wiki/Object-relational_mapping"><b>ORM</b> on Wikipedia.</a><br />
<br />
<b><a href="http://www.blogger.com/blogger.g?blogID=7577743529948922238" name="ocl">Q:</a></b> What is <b>OCL</b> ?<br />
<b>A: OCL</b> (Object Constraint Language) is a language that is used a lot in Bold. It has no sideeffects meaning that there is no way of changing objects. All operations is read-only. It is easy to work with a list of objects and filter a certain property or type.<br />
<br />
You can build an OCL expression in designtime by a dialog that contains a context sensitive list of keywords.<br />
<br />
<a href="http://1.bp.blogspot.com/_1bdfnIZ6JLQ/TBPZj87slsI/AAAAAAAABM0/Z99YkR1B0LU/s1600/OCL+Editor.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="168" src="http://1.bp.blogspot.com/_1bdfnIZ6JLQ/TBPZj87slsI/AAAAAAAABM0/Z99YkR1B0LU/s400/OCL+Editor.png" width="400" /></a><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
See also <a href="http://en.wikipedia.org/wiki/Object_Constraint_Language"><b>OCL</b> on Wikipedia</a>.<br />
<br />
<div>
<b><a href="http://www.blogger.com/blogger.g?blogID=7577743529948922238" name="derattr">Q:</a></b> What is a derived member ?</div>
<div>
<b>A:</b> A derived member is typically not stored in the database. It is transistant and exists only in Bolds objectspace in RAM. For example if you have 3 classes Invoice, InvoiceRow and Vat.</div>
<div>
The InvoiceRow have the attribute NetValue and a singlelink to Invoice. Invoice have a single link to Vat and a multilink InvoiceRows. Vat have an attribute VatValue.</div>
<div>
Now InvoiceRow can have 2 derived attributes VatValue and TotalValue. Invoice can also have 3 derived attributes NetValue, VatValue and TotalValue. See the model.<br />
<a href="http://sites.google.com/site/boldfordelphi/faq/invoice.png?attredirects=0"><img alt="UML model" src="http://sites.google.com/site/boldfordelphi/faq/invoice.png" /></a><br />
<div>
So class Invoice have 3 attributes, InvoiceRow also 3 and Vat have 1. Only 2 of those 7 attributes are stored persistent in the database, The remaining 5 is marked as derived with a / before the name.<br />
<br />
We can define the value for a derived attribute in a method or in OCL. Often OCL is simpler and safer. In code you have to take care of subscribing other attributes and objects in case they change. In OCL this occurs automatic.<br />
<br /></div>
OCL expressions for derived attributes:<br />
<br />
<ul style="font-family: courier new,monospace;">
<li>InvoiceRow.vatValue: netvalue * mainInvoice.invoiceVat.vatValue<br />
</li>
<li>InvoiceRow.totalValue: netValue + vatValue<br />
</li>
<li>Invoice.netValue: invoiceRows.netValue->Sum<br />
</li>
<li>Invoice.vatValue: netValue * invoiceVat.vatValue<br />
</li>
<li>Invoice.totalValue: invoiceRows.totalValue->Sum<br />
</li>
</ul>
Derived attributes have the property that they are recalculated every time a dependent object change and that attribute is read.<br />
<br />
<b>NOTE:</b> The recalc does only happen if the derived attribute is read.<br />
<br />
In this case if one of the Invoicerows netValue change and this InvoiceRows vatValue is read it notice the change and recalc. But totalValue is not recalced until it is read. When Invoice.totalValue is read it will be recalced if any of the other attrbutes have changed value. If nothing has changed the attribute value is cached and the calculation will not happened.<br />
<br />
This behaviour save CPU time specially for complex expressions. Compare if those attributes would be methods that do the calculations every time they where called. And of course the chain of derivations can be arbitrary long and complex.</div>
Roland Bengtssonhttp://www.blogger.com/profile/00938666963895712685noreply@blogger.com8