Browse by Tags
All Tags »
Object Orientation (
RSS)
According to the .NET naming guidelines it is often suggested to adopt camel case for private properties/fields and pascal case for protected and public properties/fields. It is unclear how to name visual controls. Let consider a standard label which...
Calling ToString method will shows the amount value without any currency symbol/name/ISO code. In order to show the correct money formatting we have two choices: Define a static formatting rule Create a custom formatter Personally I prefer the second...
When I have to propagate errors from the domain object to the presentation I usually use exceptions. All errors bubble from bottom to up and then are ready to be published to the UI (managing the catch section). The Notification pattern can be a good...
In the past blog I introduced the concept of Currency. It was really poor in terms of functionality since I have to set all its characteristics (symbol. name and ISO 4217 code) every time. It would be useful to have an internal table containing all currencies...
The Money class I implemented is really primitive. I can't imagine a Money class without arithmetic operators. So, the first step is to implement all base operators: public static Money operator +(Money a, Money b) { return new Money(a._amount + b._amount...
Well, how much cash do I have in my pocket ? I can say 52.24 ! What ? Euro, US Dollars, Yen or whatever ? It's clear that indicate the money just as an amount isn't enought. But to indicate money like a combination of an amount and a symbol is too simplicistic...
Looking any bug track system you have to solve a basic problem: state machine. The state machine consider not only the state of the object but also how it should behave depending on its state. Consider the following states and behaviors: State Next state...
Martin Fowler is introducing several new enterprise patterns for his new book . My attention was captured by the Model View Presenter pattern and I immediatly tryied to apply it in a simple ASP.NET 2.0 (version 8.0.40607.85) web form with a CheckBox,...
Calculate the number of days between two dates seems really simple, but there are some exceptions. The simplest idea is to substract two DateTime and get the number of days in the resulting TimeSpan. The method doesn't work when the two dates are set...
Fixed properties works well when you have a clear and stable idea of the entity but it provides some kind of restriction. Some properties are fixed, such as names, email and so on, but other can change frequently and depending on the business context...
More Posts
Next page »