The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,533 other followers

Archive for the ‘Delphi’ Category

Where do you place your unit uses?

Posted by jpluimers on 2019/04/18

Over the years, I have had the question of where to put uses list entries a lot.

Last year, there was one again from a very experienced developer: [WayBack] Where do you place your unit uses? Over the years, I’ve come to preferring to place my uses in the Interface section only, even if its types, constants… – Lars Fosdal – Google+

The answer is really simple, and comes down to this:

  • use only the units you need (Law of Demeter)
  • use the units as close as possible to where you need them (this helps Minimizing Scope which is related to Information Hiding and the Proximity Principle)

Besides these Clean Code and Code Complete arguments, there is another very important argument:

The larger the scope of a unit, the more resources it takes to compile your project.

This gets worse when you have cycles in your unit dependencies.

I think it gets more than progressively worse; I have seen ~5 million line projects use close to 2 gigabytes of RAM during compilation when they had deep/long cyclic dependencies, forcing a full project build with DDevExtensions configured correctly in order to avoid out-of-memory at all.

For the above question, the poll seems to indicate the public at large gets it right:

References

A few tips from the thread:

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »

Just found out about the SysUtils.FindCmdLineSwitch Function

Posted by jpluimers on 2019/04/17

I learn new things every day. So today I learned about [WayBackSysUtils.FindCmdLineSwitch Function, which was introduced in Delphi 4, but I was still messing with ParamCount/ParamStr loops.

It as not changed over time. The above docs are Delphi 2007, and these are some of the newer:

–jeroen

Posted in Conferences, Delphi, Event, Software Development, Development, Conference Topics | Leave a Comment »

Debugging RTL/VCL Code with CodeSite – Dave’s Development Blog

Posted by jpluimers on 2019/04/17

This is so cool! [WayBackDebugging RTL/VCL Code with CodeSite – Dave’s Development Blog.

It comes down to performing CodeSite.Send(...) calls as evaluation expressions in non-breaking breakpoints.

Ensure you have the CodeSite.Logging unit in your uses lists and you’re good to go.

Thanks David for pointing me to this!

This is even more useful than the breakpoint Log Message itself (which is only a string) or plain Eval Expression (which puts just one item into the Delphi event log) despite them being there since Delphi <= 5:[WayBackDebugging code in Delphi XE – Stack Overflow.

–jeroen

via: [WayBack] Debugging RTL/VCL Code with CodeSite – David Hoyle – Google+

 

Posted in Delphi, Development, Software Development | 2 Comments »

Delphi annoyance: in debug mode, no breakpoints are being adhered to, no blue bullets

Posted by jpluimers on 2019/04/16

For all Delphi Galileo versions (the BDS based Delphi versions: 8 until now), I have bumped into this annoyance:

Over time, while working on an application, running it in DEBUG mode in the debugger, wil not fire any breakpoints and all blue bullets (meaning the lines have code generated) are gone.

There are no warnings or (error) dialogs leading to this situation.

The only remedy is to quit Delphi, start it again, then do a full rebuild of the application.

Of course this happens more often with large applications than with small ones.

Is there anyone who has a reliable method to:

  • signal this before it happens
  • workaround it in a better way

–jeroen

Posted in Delphi, Development, Software Development | 1 Comment »

delphi – IfThen(Assigned(Widget), Widget.Description, ‘No Widget’) doesn’t crash. Should it? – Stack Overflow

Posted by jpluimers on 2019/04/16

Very interesting question [WayBackdelphi – IfThen(Assigned(Widget), Widget.Description, ‘No Widget’) doesn’t crash. Should it? – Stack Overflow.

Three important things here:

  • depending on inlining and kind of arguments, function calls can evaluate their arguments one or multiple times
  • lacking formal language specification, you never know if a method will be inlined or not
  • function calls should not have side effects

Via another interesting discussion at [WayBack] Inline functions are not guaranteed to evaluate their arguments exactly once… – David Heffernan – Google+

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

 
%d bloggers like this: