Monday, January 10, 2011

IT Perfection - Does it exist?

So often I see time and time again IT professionals being constantly upset and disgruntled with complaints such as:
  • "We aren't following best practice"
  • "This should all be documented"
  • "They keep cutting corners"

Are these complaints fair enough? Yes! Of course they are, but in certain circumstances we just have to deliver to the business, even though it isn't the most technically elegant solution.

The downside to just slapping work out brings us into a term I have grown to love called technical debt.

So next time you hear IT professionals complaining around poor quality or rushed work, try to understand why corners have been cut. If you scratch the surface you may find the business potentially gaining a competitive advantage by rushing through a release.

On the other hand you may find yourself working in a workplace that is accepting of rushed work. But with rushed and unmanageable comes the overhead of maintenance, constant bugs appearing and reappearing. Is this acceptable? Well it is if the business is willing to accept the consequences their rushed approach to development is causing. It may also be keeping them at the top of their industry.

Thursday, January 6, 2011

Technical Debt

Technical debt is a wonderful term that I don't think gets used enough in the IT world we work in.

To explain this term let's say your wife gets a hold of your credit card and goes on a shopping spree, purchasing anything and everything to her hearts content, satisfying her retail therapy in the short term. But at some point the debt will grow and grow to an unmanageable state, till you end up bankrupt and starting again.

Bankrupt in IT terms might be the system that ends up to be such a mess that all the developers are screaming out for a complete re-write.

So the further and further you go into debt, the harder and harder it is to get back out of debt. So always re-factor and improve as you go. Developers never stop learning and they are always finding new and better ways of doing things.

So next time you see a piece of code that isn't written well, re-write, add comments and clean it up. Continuous improvement is the way forward to keeping your debt to a manageable level.

SSRS Reporting Service - Multiple Parameters

Having come across this problem time and time again I thought I would share this useful little trick to passing in multiple parameters with SSRS.

First of all, create a function that will parse your multiple values to make it seem like you are passing an array...take a look at this:

----------------------------------------------------------
CREATE FUNCTION dbo.ufn_Split
(
@String nvarchar(4000),
@Delimiter char(1)
)

RETURNS @Results TABLE (value nvarchar(4000))
AS

BEGIN
DECLARE @INDEX INT
DECLARE @SLICE nvarchar(4000)

SELECT @INDEX = 1

IF @String IS NULL RETURN
WHILE @INDEX !=0
BEGIN
SELECT @INDEX = CHARINDEX(@Delimiter,@STRING)
IF @INDEX !=0
SELECT @SLICE = LEFT(@STRING,@INDEX - 1)
ELSE
SELECT @SLICE = @STRING
INSERT INTO @Results(value) VALUES(@SLICE)
SELECT @STRING = RIGHT(@STRING,LEN(@STRING) - @INDEX)
IF LEN(@STRING) = 0 BREAK
END

RETURN
END
----------------------------------------------------------

And then to use the function here is an example

----------------------------------------------------------
CREATE PROCEDURE [dbo].[rpt_GetPackingSlip]
(
@OrderID varchar(100)
)
AS
SELECT
c.customer_ID,
c.title_code,
c.first_name,
c.surname,
c.email,
o.order_ID,
oi.price_paid,
oi.product_attributes,
oi.product_name as ProductName,
oi.quantity
FROM
Customer c
INNER JOIN [Orders] o on o.customer_ID = c.customer_ID
LEFT JOIN Order_Item oi on oi.order_ID = o.order_ID
WHERE
o.order_ID IN (SELECT value FROM dbo.ufn_Split(@OrderID, ','))
----------------------------------------------------------

I hope this helps!