Blog Archives

How do I make a method use a different class in unit tests?

The code you work on has this wonderful simple method. All it does is use a couple of other classes, passing through the parameters it received and setting some properties.

As it is such a simple function nobody bothered to write any tests for it. After all, “It only passes through to another class.”

Read more ›




Why can’t my test access a public constructor?

It’s late in the afternoon. Almost time to go home. Just one issue to finish. A simple class that needs a couple of simple tests. Should be a breeze.

Five minutes later you are ready to bang your head against your desk. The error messages keep flying. And you can’t see why.

Read more ›




How do I test an abstract base class if I can’t instantiate it?

You have a set of classes to write. Classes that have details specific to each, but that also have a lot in common.

You don’t like to repeat yourself and like your code DRY.

So you have created a base class to contain all the common code.

Read more ›




Sorry, just questions, no answers

Lately it has been happening more and more often.

Someone writes a blog post articulating an idea that has been stewing in my mind for some time…

Now Uncle Bob has done it.

Over the years it has never ceased to amaze me that software developers are not held to higher standards.

Read more ›




How do I test an interface? Should I even do that?

Every so often this comes up: I have an interface. It has methods. I should unit test everything. So I should test this interface. But how? It doesn’t have an implementation…?!

Right…

Well…

Hmm…

No. Of course you don’t test the interface.

Read more ›




TL;DR version of Name Value Pairs in ComboBoxes and Kinfolk

Did you read Name Value Pairs in ComboBoxes and Kinfolk?

Too long?

Yeah. You’re right. I realized that after I published it.

Here’s the TL;DR version of it.

You have been tasked with adding a simple ComboBox to a form and load its list of values from a configuration file containing a list of name value pairs.

Read more ›




Name Value Pairs in ComboBoxes and Kinfolk

A couple of hours after I published this, I realized that it was very long. If you just want the punch line then check out
TL;DR version of Name Value Pairs in ComboBoxes and Kinfolk

You have been tasked with adding a simple ComboBox to a form and load its list of values from a configuration file containing a list of name value pairs.

Read more ›




20 resources on (migrating to) Unicode with Delphi

Are you maintaining an application that has been around for more than 5, 6 years? Using a pre-Unicode Delphi version (pre D2009) to do so?

Would you like to switch to a newer Delphi version to gain the advantages of Unicode, generics, extended RTTI, 64 bit, the REST client library and other such niceties?

Read more ›




How to get the location of the user’s “My Documents” folder

Your application allows your users to create and save files. You help your users by remembering where the last file was stored they don’t have to navigate their entire folder structure every time they want to save a file.

So far so good.

First time experience

To make you application even better,

Read more ›




How to find all instantiated forms in your project at run time – Take two

Boy, do I feel stupid!

As David pointed out in the comments to take one of this subject, there is a much easier way to get all the instantiated forms at run time:

Forgot all about Screen.CustomForms existence. And it’s been there since at least D5…

Read more ›




Show Buttons
Hide Buttons