Coder's Revolution

Do you want a revolution?

Blog Archives - 3 Record(s)

Year: '2009' - Month: '5'

Should Optional Method Parameters Be Defaulted To Blank, Or Left Undefined?

ColdFusion, Object Oriented Design (OOP)
Today I offer you a question of preference. Should optional method parameters be defaulted to blank and assumed to exist, or should they only be defined if you intend to use them? In the name of code reusability I will find myself writing generic service methods such as userService.loadUser() which have a large list of optional parameters such as lastName, firstName, userName, companyID, userID, password etc. I will reuse this method any time I want to load a user or a list of users. The question is this: is it more correct to default all of the arguments or check for their existence?
2

SQL Server Temp Tables: When Do I Create My Indexes?

Performance, SQL
My last blog post was originally the start of this one, but I got so carried away talking about the different types of temp tables I split it off. Today's topic is when to create indexes on SQL temp tables-- before or after you add the data. Many people out there seem to hold the same opinion on the subject. I don't like taking other people's word and I also like doing things the hard way. Therefore I created a series of tests to see which way really was fastest.
10

SQL Temp Tables

Performance, SQL
Here's a quick note about SQL temp tables. In SQL Server, there are three kinds of temporary tables you can use. The first kind (my favorite) are known as table variables. They only exist in memory and are not written to disk (unless your OS is low on RAM and starts swapping). Table variable names start with an "@" just like other T-SQL variables and the syntax for one is like so:
6