Wednesday, May 06, 2009

Too many items

Our coding standards mandates we don't have more than 10 non-trivial members in a class. So I am doing some code review and for one of the classes there are so many members even ReSharper refuses to count them, just reports that there are too many of them (see picture on the right). I guess there are gonna be some rather serious refactoring.

Wednesday, April 15, 2009

Boolean is difficult

Sometimes you see the C# code like this:

if(isValid()) {
return true;
}
else {
return false;
}

or even "better":

return (isValid()? true : false);

I always wondered why not just write the code like this:

return isValid()

Is the reason is that some of the younger developers don't have any background in C, C++ or any languages where the conditional statements return int, not bool? It is psychologically difficult for them to accept Boolean as the first class citizen - data type. For them Boolean cannot be separated from the if statements or "?" operator. Am I correct? What is your opinion?

Tuesday, April 14, 2009

JavaFx installation

Oddly enough it did not prompt me to download and install JavaFx, it just showed me the small icon. When I clicked on the icon it prompted me to download the latest Java, and after 6 minutes (on high-speed connection) and two browser restarts I've got it up and running.

Monday, April 06, 2009

Fixing Outlook annoyancies

If a message comes as plain text, Outlook will use plain text format to reply to this message. As a result the signature gets messed up, etc. This article shows how to overcome this limitations. A simple macro can convert a received email from plain text to html:

Sub ConvertMessage()
Dim oMailItem As MailItem
Set oMailItem = Application.ActiveExplorer.Selection.Item(1)
oMailItem.BodyFormat = olFormatHTML
'oMailItem.HTMLBody = oMailItem.Body
oMailItem.Close (olSave)
Set oMailItem = Nothing
End Sub

I commented out one of the lines because it works better for me this way.

Tuesday, March 31, 2009

Anger-driven development

Being angry at the badly written code stimulated me to a few hours of very productive refactoring and bug fixing. Do I need to get angry to be productive?

Monday, March 16, 2009

IOC container

I found a great idea in Dave Laribee's article in MSDN Vol 24 # 2: Don't use IOC containers for entities, only for services. I am saying this becase our team is practicing this for the last year or so.