-
If j(i) < 1 Then m = m + j(i - 1) Else m = m + j(i - 1) - 1 Single letter variables are good for iterators, but if integer variables will involve coditions such as the statement above, better use a more descriptive variable or refactor the said line to a method with a descriptive name. I guess if...
-
remember the rule to always derive custom exceptions from ApplicationException? so you thought that the CLR never throws an ApplicationException? Krzysztof Cwalina (co-author of Brad Adams in the famous Framework Design Guidelines book) blogs about the exception (pun) here .
-
I noticed that Resharper 2.0 highlighted (meaning it is against a rule) a call to a virtual method in a constructor in one of my business objects. It gave me the following information information in msdn ( http://msdn2.microsoft.com/en-us/library/ms182331.aspx ) Looking at the sample code from the link...
-
anybody who is also using this construct for string properties? we rarely want our string properties to be null and since it is a reference type, we have to have handling for it. can you see any disadvantage of such construct? [code language="C#"] public string StringProperty { get { return _stringProperty;...
-
For most of you who have been using stored procedures and following the MS guidelines in .NET Application Development, you must have been using SET NOCOUNT ON as stated in Chapter 12 of the Improving .NET Application Performance and Scalability . Although the MSDN docs was enough to tell me that with...
-
In response to dehranph's comment on my previous post ( http://community.devpinoy.org/blogs/joeycalisay/archive/2005/11/08/401.aspx ), it reminded me of the naming guidelines in .NET. His comment was about the DeleteCustomer method which has a Customer object as parameter, which we both agreed to be...
-
As I was refactoring some of our codes, what struck me was the idea of object oriented programming particularly encapsulation. For example, we have this Customer object which is distinct with its CustomerID property. We needed to have versioning for the said entity and so we introduced an additional...
-
I have read this before but just want to make a permanent reference to it in this blog. Brad Adams explains why the ArgumentNullException class violates the Design Guidelines here for not following the exception constructor patterns. http://blogs.msdn.com/brada/search.aspx?q=argumentnullexception&p...
-
I've seen a part of this (Brad Adams presentation on Naming) perhaps a month ago, I just discovered that it is a part of a good set of webcasts worth seeing. Can't wait to see Brian Pepin's presentation (design time guru). http://msdn.microsoft.com/netframework/programming/classlibraries/
-
I was reading Steve McConnell's first edition of Code Complete and the book is highly recommended. Although the sample uses old languages like pascal and c, and some topics does not apply to current programming languages, I love the way he presents his arguments on how to do things the right way. Although...
-
I started programming with C and used Hungarian notation since then. It was very helpful back then to instantly know what type the variable is from its name. When I started programming in .NET using Visual Studio, Intellisense made a major breakthrough and helped a lot. You just point your mouse over...
-
I got tired of seeing a common property of our controls (since it is part of an interface) and this week, I got fed up and can’t take it anymore seeing them. AlignmentInContainer You might suggest ContainerAlignment but layout properties obviously relates the control to its immediate parent container...
-
I have read the Exception Handling Best Practices article in .NET in CodeProject and all this time I thought that rethrowing exceptions is this way: [code language="C#"] try { // Some code that throws an exception } catch (Exception ex) { // some code that handles the exception throw ex; } [/code] I...