Posted by jpluimers on 2015/11/24
A while ago, I came across a class having (among other members) two methods named like this:
Within one of the other members of the class, I had to (temporarily) Stop processing, then Start it again.
But I couldn’t, as neither Start, nor Stop would make a record of the state it left the instance in.
Always ensure you know the state of an instance.
So I added the state, and tests to ensure a Stop/Start change was indeed not breaking things.
Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Delphi, Delphi 10 Seattle, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 1 Comment »
Posted by jpluimers on 2015/11/18
I missed when the StackExchange App for Android was finally launched, but I totally agree with Paul Lammertsma:
Exceeds expectations This was a long time coming, but it didn’t disappoint. It’s a great aid for a regular on Stack Overflow like me!
via Stack Exchange – Android Apps on Google Play.
Posted in Delphi, .NET, Software Development, Development, Pingback, Stackoverflow, Power User | Leave a Comment »
Posted by jpluimers on 2015/11/04
From a chat with a co-worker a while ago:
So even if you expose such a property as read-only, it can still get its writeable fields overwritten.
That is a pain when those are part of the state of the underlying object.
In other words: encapsulate your state changes.
Here we solved it by making
- the type of the property immutable
- the property writeable
- react on state changes during the write
In this case it was a project mixing C# and Delphi, but you can easily apply the above to any language featuring classes and properties.
Another solution would have been to extend the type of the property so it can expose an event that fires during change. Much more convoluted.
Posted in .NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Delphi, Delphi 10 Seattle, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 2 Comments »
Posted by jpluimers on 2015/10/22
Recently I bumped into it again with one of the more current Delphi XE* versions and Delphi 2007: the IDE changing the DFM files without reason.
This time it was in a multi-team environment with many branches and DFM merge hell.
A few examples of properties and components getting changes:
Warren P suggests to review your DFM changes before committing to version control and I completely agree: it is the only way to ensure they are indeed unwanted changes.
There are some stop-gab things you could try, but these only partially help
Posted in Delphi, Delphi 10 Seattle, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 7 Comments »
Posted by jpluimers on 2015/10/07
A long time ago, there was an interesting discussion here: I was wondering, that what is the closest value to the Zero floating point can have.
Recently I needed to do some calculations on series where getting close to zero could become a problem.
- Math seems to have an Epsilon of 1E-12.
- Sytem.Types has Epsilon of 1E-30 and Epsilon2 of 1E-40.
- XE4+ FMX has IsEssentiallyZero and IsNotEssentiallyZero for Single values.
In practice it depends a lot on what you are doing. Sometimes absolute Epsilons are best, but at other times relative difference is much more applicable.
Then there is also a Machine Epsilon: a way to derive an Epsilon from a data type that works in all languages and platforms.
Posted in .NET, C, C#, C++, Delphi, Development, Software Development | 1 Comment »