What’s In a Name? – Final Part 3
Today we end this series on the power of choosing good names for your code. We have not been getting into conventions so much in regard to case, plurality and some of the other things well documented for establishing standards. We have been taking a broader approach to the power of choosing good names which define the intention of the item.
We considered how to distinguish between summary data and line items. We talked about communicating through the chosen name for tables and columns.
Let’s conclude with some ideas around non-database code. Regardless of other languages you may use, remember the concept of Separation of Concerns when designing your code. Doing this simplifies the name you might choose for your classes, methods, properties or processes in non-object oriented languages.
A good name will help you narrow down the scope of your code. A person object only contains properties and methods dealing with a Person. A shipping object contains only address information and shipping instructions or history related to an order. A customer object would handle things such as Persons, Shipping, Orders, etc.
Again, don’t be afraid of space. With modern editors, you have a great deal of assistance completing long object names. So, make your names as long as it takes to communicate clearly.
In Dot Net, don’t forget to use good names for your Name Spaces. Name Spaces greatly reduce contention, and help provide further clarification for the intent of your code. Make them meaningful as well.
Without regard to the conventions you choose as your standards, consistency is the biggest key to success. Even if you don’t have the best methodology, consistency helps yourself and others find code within your code base.
Cheers,
Ben
$$SWYNK$$
Featured Article(s)
Elemental MDX: MDX Time Series Functions: PeriodsToDate() and OpeningPeriod(), Pt. 2
Part 2: BI Architect and SSAS Maestro Bill Pearson continues a three-part overview of the MDX PeriodsToDate() and OpeningPeriods() functions, specifically designed to support the analysis of data within the context of time. In this Part, we will continue our overview of the important PeriodsToDate() function, then we will introduce specialized “shorthand” functions that are based upon it.
Featured White Paper(s)
Ten Tips for Optimizing SQL Server Performance
read more)
Featured Script
fn_bitpatternToDecimal
A simple function to read a string with one byte’s worth of bits (8) and return it’s decimal value (max 255) … (read more)