Archive for the 'programming' Category

Is the Contract Programming of D broken?

In my previous post I mentioned that I wasn’t sure of how the D Contract Programming feature works in an override scenario. Wekempf inspired me to delve deeper into the matter. Here is what I found.
Contract Programming states that preconditions may be weakened by a deriving class, but never hardened. For postconditions the reverse is [...]

Contract Programming in D

If you are a defensive programmer like me, you make heavy use of assertions to guard assumption you make in your code. For example, a method for adding an order item to an order object could look something like this:
class Order
{
private List orders;

int addItem(OrderItem item)
{
assert(assigned(item));
[...]

Is IEE 754 too advanced?

In my previous post I’m afraid I exposed my inexperience in the world of floating point programming. As many pointed out it’s the inherited behavior of the IEEE 754 standard, and, in Walter Brights own words, to change it would break legacy usage. In other words I should direct my concerns about the handling of [...]

Is D:s floating point handling too advanced?

The floating point support in the D Programming Language is more advanced than that of standard C and C++. I’m not sure I like every aspect of it though. The thing I’m having problem with is how D handles the special value NAN (Not A Value).
For instance, a simple comparison will always return false if [...]

Agile low level programming in D

Agile software development techniques have long been utopia for low level system developers. The C programming language has been the most reasonable choice for implementing hardware near applications and drivers; But C was not designed with agility in mind. Hence methods like test driven development has been a pain to implement using C.
Now an alternative [...]