C# 3.0 – .NET Framework ?

September 30, 2007 on 12:32 pm | In Uncategorized | No Comments

SDJ 10 2007I’ve written an article about C# 3.0 for a polish programmers magazine Software Developer’s Journal. That’s not my first article but the first one to hit the cover and by the issue lead. Great, right? Well I’m afraid not! Why? Because of embarrassing mistake on the cover:

C# 3.0 has nothing to do with .NET Framework 3.0. The new C# version will by introduced with .NET Framework 3.0 that comes with new Visual Studio 2008. The third version of framework is essentially the same with the second but enriched with a bunch of foundations (WPF, WCF, WWF). This information appears in the first paragraph of my text!

I’ll ask the editorial office to consult the cover with my the nest time. I’ll spare myself the shame.

Who needs DBNull?

September 17, 2007 on 8:23 pm | In Uncategorized | No Comments

I’m currently taking part in my first MS certified .NET training. I’ll write some more about this training after it’s over, but now I have to share one thing with you. Once again I notices that DBNull is causing more confusion than it is worth. A certified .NET instructor had a hard time describing it to course attendees. Some time ago I had a long conversation about it. Both time I couldn’t help my self thinking: “who to hell needs this DBNull”. Because in .NET DBNull is not equal null. DBNull is a little extraordinary data type. It is used to describe a value from DB that does not exists in opposition to a value that exists but is null. Hmm… I don’t buy it. And a course attendee was not buying it also. We have defined a class like this

 public sealed class ProductSummaryStatistics

 {  private readonly string   mDescription;

  private readonly int      mProductCount;

  private readonly decimal? mMinimumPrice;

  private readonly decimal? mMaximumPrice;

  private readonly decimal? mAveragePrice;

//...

}

We ware told what the nullable types are. I had BTW impression that our trainer was not 100% clear about the difference between value and reference types, since with that knowledge the difference between decimal and decimal? is crystal clear in a second.

But back to our story. We were told to use a helper method co convert the “may by null” values to the fields in our class. That’s the helper code:

public static Nullable<T> DbValueToNullable<T>(object dbValue)

where T : struct

  {

   Nullable<T> returnValue = null;
if ((dbValue != null) && (dbValue != DBNull.Value))

   {

    returnValue = (T)dbValue;

   }

   return returnValue;

  }

My coulage could not understand why do we have to convert our DB data that might by null to nullable type. And to by frank I don’t understand neither. And it is really not important that my lack of understanding is other than my colleague. We don’t need DBNull!

.NET Remoting Articles

September 11, 2007 on 7:39 pm | In Uncategorized | No Comments

SDJ The good folks at Software Developers Journal are working hard on delivering good content to polish speaking software developers community. They recently made two of my older articles available online (mid 2006). The articles are both about .NET Remoting (The basics of .NET Remoting and Extending .NET Remoting). This rather ascending technology (we have WCF) could by interesting today too. There is a lot of work done with plain old .NET Remoting. You will read there about the basic concepts, about using the communication techniques given by Microsoft, configuration them and implementing your own communication channels.

Clarion 7 Beta Released

September 9, 2007 on 11:36 pm | In Clarion | No Comments

Clarion 7 Logo A new version of Clarion RAD is released. It is the last Win32 version of a tool, that my company used (an in a fact still uses) for the last 10 years with great success. The next generation is Clarion.NET based on .NET Framework.

The first taste of the “wind of change” is seen it current beta version. Clarion 7 IDE is based on well known tool form our neighborhood the SharpDevelop IDE. I have my first “Hello world” app in Clarion 7 behind me and… there is really not much to say to .NET developers. It is rather buggy version. There is no application generator. Data dictionary (a kind of O/R Mapper) is read only – when it works, because on my computer it was only reporting errors. I’ll say it again Clarion without:

  • app generator
  • data dictionary
  • template engine

has nothing to offer for .NET developers. I really wait for a RAD tool that will help my with my enterprise-data-driven-text-box-CRUD-based applications development. I wait for Clarion.NET and Clarion 7 is no good source of “first taste”.

Clarion SharpDevelop Based IDE

Continuous Integration article in SDJ

September 3, 2007 on 7:24 pm | In Continuous Integration, MSBuild | No Comments

I would like to invite all my polish speaking readers to online version of my article about continuous integration in .NET. It was published in July 2007 in Software Developers Journal. You can find it in the download section of SDJ web page. You can read there about:

  • setting up CI server with CruiseControl.NET
  • creating one click build script with MSBuild
  • incorporating unit testing and code coverage into CI process
  • using WebDashboard and CCTray to control the process
  • introducing code analyze with FxCop
  • creating install file and deploying the project.

RTFM you idiot (me)

September 3, 2007 on 12:42 pm | In Uncategorized | No Comments
 

Have I told you lately that reading manuals is good thing? Wow, what a discovery! Believe me, reading the documentation, manuals, MSDN will save you time. One day spend on reading about .NET Framework fundamentals will save you 2 of debugging, and wandering why… I’ve recently found a nasty behavior in my search by example routine. I thought that I know enough about NHibernate to use find by example in discoverable mode (its when you are programming with Intelisense as your help and guide ;) . My code looked like this:

  Customer exampleCustomer = new Customer();
  exampleCustomer.FirstName = view.FirstName;
  exampleCustomer.LastName = view.LastName;
  string[] excludeProps = new string[] { };
  CustomerList customerList =
    customerDao.GetByExample(
      exampleCustomer, excludeProps);

Nothing extraordinary. Right? the exampleCustomer object gets the FirstName and LastName property from view. Than without excluding any property I went to GetByExample to get what I wanted. It worked! Until the customer without FirstName (a company). What did I get when view.FirstName was = “”? A list of all customers with first name matching the attribute with last name ignored! Why? Because the NHibernate reference manual says:

rtfm

“By default, null valued properties and properties which return empty string from the call to ToString() are excluded”.

Right!

Powered by WordPress with Pool theme design by Borja Fernandez.
Text © Marcin Kawalerowicz. Hosting CODEFUSION.