Wrappers.  Encapsulation.  Facades.  All three of these are interchangeable.  There are multiple occasions when these design patterns are required.  They usually are needed when a client wants something they saw elsewhere or they think of something that was not originally put into the software.  Once such occasion was when a client wanted a parameter in SQL Server Reporting Services (SSRS) to default to the end of the day if a time was not specified for a datetime parameter.  My first thought was to have the user bump the date out one day so that it went to the beginning of the next day which is one second after the end of the day.  The client didn’t want the users to have to remember this. 

After 2 games of pool and a discussion with another developer, we came up with a way that if no time is entered, then it will default to the end of the day.  This was helpful as it was used in all three reports the client requested.

DECLARE @DefaultEnd datetime

SET @DefaultEnd = DATEADD(second, -1, DATEADD(day, DATEDIFF(day, 0, @EndTime) +1, 0))

IF (SELECT SUBSTRING(CAST(@EndTime AS VARCHAR(25)), 13, 7)) <> 12:00AM

      SET @EndTime = @EndTime

ELSE

      SET @Endtime = @DefaultEnd

The basic concept is if the user does not enter in a time in the parameter, SSRS actually defaults to 12:00AM.  So we check if it is not equal to 12:00AM, then that means the user entered a time.  If the time is 12:00AM, then we will default to the end of the day of the date they put in the parameter.  The end of the day is considered 11:59:59PM or 23:59:59.  Either way, the correct result is the end of the day.  Another satisfied client and another tool to use for future SQL adventures.